Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ var (
utils.GossipSequencerHTTPFlag,
utils.GossipBroadcastToAllEnabledFlag,
utils.GossipBroadcastToAllCapFlag,
utils.SkipSignerCheckFlag,
utils.DASyncEnabledFlag,
utils.DAMissingHeaderFieldsBaseURLFlag,
utils.DABlockNativeAPIEndpointFlag,
Expand Down
1 change: 1 addition & 0 deletions cmd/geth/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
utils.GossipSequencerHTTPFlag,
utils.GossipBroadcastToAllEnabledFlag,
utils.GossipBroadcastToAllCapFlag,
utils.SkipSignerCheckFlag,
},
},
{
Expand Down
9 changes: 9 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,11 @@ var (
Value: 30,
}

SkipSignerCheckFlag = cli.BoolFlag{
Name: "skipsignercheck",
Usage: "Skip signer check for the SystemContract engine",
}

// DA syncing settings
DASyncEnabledFlag = cli.BoolFlag{
Name: "da.sync",
Expand Down Expand Up @@ -1847,6 +1852,10 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
cfg.GossipBroadcastToAllCap = ctx.GlobalInt(GossipBroadcastToAllCapFlag.Name)
log.Info("Gossip broadcast to all enabled", "enabled", cfg.GossipBroadcastToAllEnabled, "cap", cfg.GossipBroadcastToAllCap)
}
if ctx.GlobalIsSet(SkipSignerCheckFlag.Name) {
cfg.SkipSignerCheck = ctx.GlobalBool(SkipSignerCheckFlag.Name)
log.Warn("Skip signer check for the SystemContract engine", "skipped", cfg.SkipSignerCheck)
}
// Only configure sequencer http flag if we're running in verifier mode i.e. --mine is disabled.
if ctx.IsSet(GossipSequencerHTTPFlag.Name) && !ctx.IsSet(MiningEnabledFlag.Name) {
cfg.GossipSequencerHTTP = ctx.String(GossipSequencerHTTPFlag.Name)
Expand Down
6 changes: 5 additions & 1 deletion consensus/system_contract/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (s *SystemContract) verifyHeader(chain consensus.ChainHeaderReader, header
return errInvalidNonce
}
// Check that the BlockSignature contains signature if block is not requested
if header.Number.Cmp(big.NewInt(0)) != 0 && len(header.BlockSignature) != extraSeal {
if !s.skipSignerCheck && header.Number.Cmp(big.NewInt(0)) != 0 && len(header.BlockSignature) != extraSeal {
return errMissingSignature
}
// Ensure that the mix digest is zero
Expand Down Expand Up @@ -202,6 +202,10 @@ func (s *SystemContract) verifyCascadingFields(chain consensus.ChainHeaderReader
return err
}

if s.skipSignerCheck {
return nil
}

signer, err := ecrecover(header)
if err != nil {
return err
Expand Down
6 changes: 5 additions & 1 deletion consensus/system_contract/system_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ type SystemContract struct {

ctx context.Context
cancel context.CancelFunc

skipSignerCheck bool
}

// New creates a SystemContract consensus engine with the initial
// authorized signer fetched from L1 (if available).
func New(ctx context.Context, config *params.SystemContractConfig, client sync_service.EthClient) *SystemContract {
func New(ctx context.Context, config *params.SystemContractConfig, client sync_service.EthClient, skipSignerCheck bool) *SystemContract {
log.Info("Initializing system_contract consensus engine", "config", config)

ctx, cancel := context.WithCancel(ctx)
Expand All @@ -48,6 +50,8 @@ func New(ctx context.Context, config *params.SystemContractConfig, client sync_s

ctx: ctx,
cancel: cancel,

skipSignerCheck: skipSignerCheck,
}

if err := s.fetchAddressFromL1(); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions consensus/system_contract/system_contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestSystemContract_FetchSigner(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

sys := New(ctx, config, fakeClient)
sys := New(ctx, config, fakeClient, false)
defer sys.Close()

require.NoError(t, sys.fetchAddressFromL1())
Expand All @@ -62,7 +62,7 @@ func TestSystemContract_AuthorizeCheck(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

sys := New(ctx, config, fakeClient)
sys := New(ctx, config, fakeClient, false)
defer sys.Close()

require.NoError(t, sys.fetchAddressFromL1())
Expand Down Expand Up @@ -117,7 +117,7 @@ func TestSystemContract_SignsAfterUpdate(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()

sys := New(ctx, config, fakeClient)
sys := New(ctx, config, fakeClient, false)
defer sys.Close()

require.NoError(t, sys.fetchAddressFromL1())
Expand Down
4 changes: 2 additions & 2 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ type Ethereum struct {

// New creates a new Ethereum object (including the
// initialisation of the common Ethereum object)
func New(stack *node.Node, config *ethconfig.Config, l1Client l1.Client) (*Ethereum, error) {
func New(stack *node.Node, config *ethconfig.Config, l1Client l1.Client, ) (*Ethereum, error) {
// Ensure configuration values are compatible and sane
if config.SyncMode == downloader.LightSync {
return nil, errors.New("can't run eth.Ethereum in light sync mode, use les.LightEthereum")
Expand Down Expand Up @@ -166,7 +166,7 @@ func New(stack *node.Node, config *ethconfig.Config, l1Client l1.Client) (*Ether
chainDb: chainDb,
eventMux: stack.EventMux(),
accountManager: stack.AccountManager(),
engine: ethconfig.CreateConsensusEngine(stack, chainConfig, &ethashConfig, config.Miner.Notify, config.Miner.Noverify, chainDb, l1Client),
engine: ethconfig.CreateConsensusEngine(stack, chainConfig, &ethashConfig, config.Miner.Notify, config.Miner.Noverify, chainDb, l1Client, config.SkipSignerCheck),
closeBloomHandler: make(chan struct{}),
networkID: config.NetworkId,
gasPrice: config.Miner.GasPrice,
Expand Down
9 changes: 6 additions & 3 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,17 @@ type Config struct {
GossipSequencerHTTP string
GossipBroadcastToAllEnabled bool
GossipBroadcastToAllCap int

// Skip signer check for the SystemContract engine
SkipSignerCheck bool
}

// CreateConsensusEngine creates a consensus engine for the given chain configuration.
func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, config *ethash.Config, notify []string, noverify bool, db ethdb.Database, l1Client sync_service.EthClient) consensus.Engine {
func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, config *ethash.Config, notify []string, noverify bool, db ethdb.Database, l1Client sync_service.EthClient, skipSignerCheck bool) consensus.Engine {
// Case 1: Both SystemContract and Clique are defined: create an upgradable engine.
if chainConfig.SystemContract != nil && chainConfig.Clique != nil {
cliqueEngine := clique.New(chainConfig.Clique, db)
sysEngine := system_contract.New(context.Background(), chainConfig.SystemContract, l1Client)
sysEngine := system_contract.New(context.Background(), chainConfig.SystemContract, l1Client, skipSignerCheck)
sysEngine.Start()
return wrapper.NewUpgradableEngine(chainConfig.IsEuclidV2, cliqueEngine, sysEngine)
}
Expand All @@ -255,7 +258,7 @@ func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, co

// Case 3: Only the SystemContract engine is defined.
if chainConfig.SystemContract != nil {
sysEngine := system_contract.New(context.Background(), chainConfig.SystemContract, l1Client)
sysEngine := system_contract.New(context.Background(), chainConfig.SystemContract, l1Client, skipSignerCheck)
sysEngine.Start()
return sysEngine
}
Expand Down
2 changes: 1 addition & 1 deletion les/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func New(stack *node.Node, config *ethconfig.Config, l1Client sync_service.EthCl
eventMux: stack.EventMux(),
reqDist: newRequestDistributor(peers, &mclock.System{}),
accountManager: stack.AccountManager(),
engine: ethconfig.CreateConsensusEngine(stack, chainConfig, &config.Ethash, nil, false, chainDb, l1Client),
engine: ethconfig.CreateConsensusEngine(stack, chainConfig, &config.Ethash, nil, false, chainDb, l1Client, config.SkipSignerCheck),
bloomRequests: make(chan chan *bloombits.Retrieval),
bloomIndexer: core.NewBloomIndexer(chainDb, params.BloomBitsBlocksClient, params.HelperTrieConfirmations),
p2pServer: stack.Server(),
Expand Down
2 changes: 1 addition & 1 deletion miner/scroll_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@ func TestEuclidV2TransitionVerification(t *testing.T) {
// init worker
db := rawdb.NewMemoryDatabase()
cliqueEngine := clique.New(chainConfig.Clique, db)
sysEngine := system_contract.New(context.Background(), chainConfig.SystemContract, &system_contract.FakeEthClient{Value: testBankAddress})
sysEngine := system_contract.New(context.Background(), chainConfig.SystemContract, &system_contract.FakeEthClient{Value: testBankAddress}, false)
engine := wrapper.NewUpgradableEngine(chainConfig.IsEuclidV2, cliqueEngine, sysEngine)
w, b := newTestWorkerWithEmptyBlock(t, chainConfig, engine, db, 0)
defer w.close()
Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
const (
VersionMajor = 5 // Major version component of the current release
VersionMinor = 10 // Minor version component of the current release
VersionPatch = 3 // Patch version component of the current release
VersionPatch = 4 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)

Expand Down
Loading