Commit e1a60453 authored by Tei Im's avatar Tei Im

Rename flags and config variables for clarify to the user

Co-Authored-By: default avatarprotolambda <19571989+protolambda@users.noreply.github.com>
parent 68dcaf41
...@@ -135,7 +135,7 @@ func TestEngineP2PSync(gt *testing.T) { ...@@ -135,7 +135,7 @@ func TestEngineP2PSync(gt *testing.T) {
miner, seqEng, sequencer := setupSequencerTest(t, sd, log) miner, seqEng, sequencer := setupSequencerTest(t, sd, log)
// Enable engine P2P sync // Enable engine P2P sync
_, verifier := setupVerifier(t, sd, log, miner.L1Client(t, sd.RollupCfg), &sync.Config{EngineP2PEnabled: true}) _, verifier := setupVerifier(t, sd, log, miner.L1Client(t, sd.RollupCfg), &sync.Config{EngineSync: true})
seqEngCl, err := sources.NewEngineClient(seqEng.RPCClient(), log, nil, sources.EngineClientDefaultConfig(sd.RollupCfg)) seqEngCl, err := sources.NewEngineClient(seqEng.RPCClient(), log, nil, sources.EngineClientDefaultConfig(sd.RollupCfg))
require.NoError(t, err) require.NoError(t, err)
......
...@@ -214,17 +214,18 @@ var ( ...@@ -214,17 +214,18 @@ var (
EnvVars: prefixEnvVars("L2_BACKUP_UNSAFE_SYNC_RPC_TRUST_RPC"), EnvVars: prefixEnvVars("L2_BACKUP_UNSAFE_SYNC_RPC_TRUST_RPC"),
Required: false, Required: false,
} }
L2EngineP2PEnabled = &cli.BoolFlag{ L2EngineSyncEnabled = &cli.BoolFlag{
Name: "l2.engine-p2p.enabled", Name: "l2.engine-sync",
Usage: "Enables or disables execution engine P2P sync", Usage: "Enables or disables execution engine P2P sync",
EnvVars: prefixEnvVars("L2_ENGINE_P2P_ENABLED"), EnvVars: prefixEnvVars("L2_ENGINE_SYNC_ENABLED"),
Required: false, Required: false,
Value: false, Value: false,
} }
SkipSanityCheck = &cli.BoolFlag{ SkipSyncStartCheck = &cli.BoolFlag{
Name: "skip-sanity-check", Name: "l2.skip-sync-start-check",
Usage: "Skip chain sanity check on pipeline reset", Usage: "Skip sanity check of consistency of L1 origins of the unsafe L2 blocks when determining the sync-starting point. " +
EnvVars: prefixEnvVars("SKIP_SANITY_CHECK"), "This defers the L1-origin verification, and is recommended to use in when utilizing l2.engine-sync",
EnvVars: prefixEnvVars("L2_SKIP_SYNC_START_CHECK"),
Required: false, Required: false,
Value: false, Value: false,
} }
...@@ -266,8 +267,8 @@ var optionalFlags = []cli.Flag{ ...@@ -266,8 +267,8 @@ var optionalFlags = []cli.Flag{
HeartbeatURLFlag, HeartbeatURLFlag,
BackupL2UnsafeSyncRPC, BackupL2UnsafeSyncRPC,
BackupL2UnsafeSyncRPCTrustRPC, BackupL2UnsafeSyncRPCTrustRPC,
L2EngineP2PEnabled, L2EngineSyncEnabled,
SkipSanityCheck, SkipSyncStartCheck,
} }
// Flags contains the list of configuration options available to the binary. // Flags contains the list of configuration options available to the binary.
......
...@@ -448,7 +448,7 @@ func (eq *EngineQueue) tryUpdateEngine(ctx context.Context) error { ...@@ -448,7 +448,7 @@ func (eq *EngineQueue) tryUpdateEngine(ctx context.Context) error {
// checkNewPayloadStatus checks returned status of engine_newPayloadV1 request for next unsafe payload. // checkNewPayloadStatus checks returned status of engine_newPayloadV1 request for next unsafe payload.
// It returns true if the status is acceptable. // It returns true if the status is acceptable.
func (eq *EngineQueue) checkNewPayloadStatus(status eth.ExecutePayloadStatus) bool { func (eq *EngineQueue) checkNewPayloadStatus(status eth.ExecutePayloadStatus) bool {
if eq.syncCfg.EngineP2PEnabled { if eq.syncCfg.EngineSync {
// Allow SYNCING and ACCEPTED if engine P2P sync is enabled // Allow SYNCING and ACCEPTED if engine P2P sync is enabled
return status == eth.ExecutionValid || status == eth.ExecutionSyncing || status == eth.ExecutionAccepted return status == eth.ExecutionValid || status == eth.ExecutionSyncing || status == eth.ExecutionAccepted
} }
...@@ -458,7 +458,7 @@ func (eq *EngineQueue) checkNewPayloadStatus(status eth.ExecutePayloadStatus) bo ...@@ -458,7 +458,7 @@ func (eq *EngineQueue) checkNewPayloadStatus(status eth.ExecutePayloadStatus) bo
// checkForkchoiceUpdatedStatus checks returned status of engine_forkchoiceUpdatedV1 request for next unsafe payload. // checkForkchoiceUpdatedStatus checks returned status of engine_forkchoiceUpdatedV1 request for next unsafe payload.
// It returns true if the status is acceptable. // It returns true if the status is acceptable.
func (eq *EngineQueue) checkForkchoiceUpdatedStatus(status eth.ExecutePayloadStatus) bool { func (eq *EngineQueue) checkForkchoiceUpdatedStatus(status eth.ExecutePayloadStatus) bool {
if eq.syncCfg.EngineP2PEnabled { if eq.syncCfg.EngineSync {
// Allow SYNCING if engine P2P sync is enabled // Allow SYNCING if engine P2P sync is enabled
return status == eth.ExecutionValid || status == eth.ExecutionSyncing return status == eth.ExecutionValid || status == eth.ExecutionSyncing
} }
...@@ -475,7 +475,7 @@ func (eq *EngineQueue) tryNextUnsafePayload(ctx context.Context) error { ...@@ -475,7 +475,7 @@ func (eq *EngineQueue) tryNextUnsafePayload(ctx context.Context) error {
} }
// Ensure that the unsafe payload builds upon the current unsafe head // Ensure that the unsafe payload builds upon the current unsafe head
if !eq.syncCfg.EngineP2PEnabled && first.ParentHash != eq.unsafeHead.Hash { if !eq.syncCfg.EngineSync && first.ParentHash != eq.unsafeHead.Hash {
if uint64(first.BlockNumber) == eq.unsafeHead.Number+1 { if uint64(first.BlockNumber) == eq.unsafeHead.Number+1 {
eq.log.Info("skipping unsafe payload, since it does not build onto the existing unsafe chain", "safe", eq.safeHead.ID(), "unsafe", first.ID(), "payload", first.ID()) eq.log.Info("skipping unsafe payload, since it does not build onto the existing unsafe chain", "safe", eq.safeHead.ID(), "unsafe", first.ID(), "payload", first.ID())
eq.unsafePayloads.Pop() eq.unsafePayloads.Pop()
......
package sync package sync
type Config struct { type Config struct {
// EngineP2PEnabled is true when the EngineQueue can trigger execution engine P2P sync. // EngineSync is true when the EngineQueue can trigger execution engine P2P sync.
EngineP2PEnabled bool `json:"engine_p2p_enabled"` EngineSync bool `json:"engine_sync"`
// SkipSanityCheck is true when the EngineQueue does not do sanity check on pipeline reset. // SkipSyncStartCheck skip the sanity check of consistency of L1 origins of the unsafe L2 blocks when determining the sync-starting point. This defers the L1-origin verification, and is recommended to use in when utilizing l2.engine-sync
SkipSanityCheck bool `json:"skip_sanity_check"` SkipSyncStartCheck bool `json:"skip_sync_start_check"`
} }
...@@ -212,7 +212,7 @@ func FindL2Heads(ctx context.Context, cfg *rollup.Config, l1 L1Chain, l2 L2Chain ...@@ -212,7 +212,7 @@ func FindL2Heads(ctx context.Context, cfg *rollup.Config, l1 L1Chain, l2 L2Chain
return result, nil return result, nil
} }
if syncCfg.SkipSanityCheck && highestL2WithCanonicalL1Origin.Hash == n.Hash { if syncCfg.SkipSyncStartCheck && highestL2WithCanonicalL1Origin.Hash == n.Hash {
lgr.Info("Found highest L2 block with canonical L1 origin. Skip further sanity check and jump to the safe head") lgr.Info("Found highest L2 block with canonical L1 origin. Skip further sanity check and jump to the safe head")
n = result.Safe n = result.Safe
continue continue
......
...@@ -215,7 +215,7 @@ func NewSnapshotLogger(ctx *cli.Context) (log.Logger, error) { ...@@ -215,7 +215,7 @@ func NewSnapshotLogger(ctx *cli.Context) (log.Logger, error) {
func NewSyncConfig(ctx *cli.Context) *sync.Config { func NewSyncConfig(ctx *cli.Context) *sync.Config {
return &sync.Config{ return &sync.Config{
EngineP2PEnabled: ctx.Bool(flags.L2EngineP2PEnabled.Name), EngineSync: ctx.Bool(flags.L2EngineSyncEnabled.Name),
SkipSanityCheck: ctx.Bool(flags.SkipSanityCheck.Name), SkipSyncStartCheck: ctx.Bool(flags.SkipSyncStartCheck.Name),
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment