diff --git a/bridgesync/bridgesync.go b/bridgesync/bridgesync.go index e6a61c5e..d8e677c5 100644 --- a/bridgesync/bridgesync.go +++ b/bridgesync/bridgesync.go @@ -35,6 +35,7 @@ func NewL1( waitForNewBlocksPeriod time.Duration, retryAfterErrorPeriod time.Duration, maxRetryAttemptsAfterError int, + syncFullClaims bool, ) (*BridgeSync, error) { return newBridgeSync( ctx, @@ -49,7 +50,7 @@ func NewL1( waitForNewBlocksPeriod, retryAfterErrorPeriod, maxRetryAttemptsAfterError, - false, + syncFullClaims, ) } @@ -66,6 +67,7 @@ func NewL2( waitForNewBlocksPeriod time.Duration, retryAfterErrorPeriod time.Duration, maxRetryAttemptsAfterError int, + syncFullClaims bool, ) (*BridgeSync, error) { return newBridgeSync( ctx, @@ -80,7 +82,7 @@ func NewL2( waitForNewBlocksPeriod, retryAfterErrorPeriod, maxRetryAttemptsAfterError, - true, + syncFullClaims, ) } diff --git a/bridgesync/config.go b/bridgesync/config.go index 66eb00ed..1c4925af 100644 --- a/bridgesync/config.go +++ b/bridgesync/config.go @@ -24,4 +24,6 @@ type Config struct { MaxRetryAttemptsAfterError int `mapstructure:"MaxRetryAttemptsAfterError"` // WaitForNewBlocksPeriod time that will be waited when the synchronizer has reached the latest block WaitForNewBlocksPeriod types.Duration `mapstructure:"WaitForNewBlocksPeriod"` + // SyncFullClaims enables the full sync of the claims, needed to generate certificates (aggSender) + SyncFullClaims bool `mapstructure:"SyncFullClaims"` } diff --git a/bridgesync/e2e_test.go b/bridgesync/e2e_test.go index a19afb8d..f67edae1 100644 --- a/bridgesync/e2e_test.go +++ b/bridgesync/e2e_test.go @@ -61,7 +61,7 @@ func TestBridgeEventE2E(t *testing.T) { go rd.Start(ctx) //nolint:errcheck testClient := helpers.TestClient{ClientRenamed: client.Client()} - syncer, err := bridgesync.NewL1(ctx, dbPathSyncer, bridgeAddr, 10, etherman.LatestBlock, rd, testClient, 0, time.Millisecond*10, 0, 0) + syncer, err := bridgesync.NewL1(ctx, dbPathSyncer, bridgeAddr, 10, etherman.LatestBlock, rd, testClient, 0, time.Millisecond*10, 0, 0, false) require.NoError(t, err) go syncer.Start(ctx) diff --git a/claimsponsor/e2e_test.go b/claimsponsor/e2e_test.go index 8a037a58..bc7f93d6 100644 --- a/claimsponsor/e2e_test.go +++ b/claimsponsor/e2e_test.go @@ -25,7 +25,7 @@ func TestE2EL1toEVML2(t *testing.T) { env := helpers.SetupAggoracleWithEVMChain(t) dbPathBridgeSyncL1 := path.Join(t.TempDir(), "file::memory:?cache=shared") testClient := helpers.TestClient{ClientRenamed: env.L1Client.Client()} - bridgeSyncL1, err := bridgesync.NewL1(ctx, dbPathBridgeSyncL1, env.BridgeL1Addr, 10, etherman.LatestBlock, env.ReorgDetector, testClient, 0, time.Millisecond*10, 0, 0) + bridgeSyncL1, err := bridgesync.NewL1(ctx, dbPathBridgeSyncL1, env.BridgeL1Addr, 10, etherman.LatestBlock, env.ReorgDetector, testClient, 0, time.Millisecond*10, 0, 0, false) require.NoError(t, err) go bridgeSyncL1.Start(ctx) diff --git a/cmd/run.go b/cmd/run.go index b113c06e..1df46df7 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -678,6 +678,7 @@ func runBridgeSyncL1IfNeeded( cfg.WaitForNewBlocksPeriod.Duration, cfg.RetryAfterErrorPeriod.Duration, cfg.MaxRetryAttemptsAfterError, + cfg.SyncFullClaims, ) if err != nil { log.Fatalf("error creating bridgeSyncL1: %s", err) @@ -710,6 +711,7 @@ func runBridgeSyncL2IfNeeded( cfg.WaitForNewBlocksPeriod.Duration, cfg.RetryAfterErrorPeriod.Duration, cfg.MaxRetryAttemptsAfterError, + cfg.SyncFullClaims, ) if err != nil { log.Fatalf("error creating bridgeSyncL2: %s", err) diff --git a/config/default.go b/config/default.go index 74eec57d..d48a1379 100644 --- a/config/default.go +++ b/config/default.go @@ -242,7 +242,7 @@ SyncBlockChunkSize = 100 RetryAfterErrorPeriod = "1s" MaxRetryAttemptsAfterError = -1 WaitForNewBlocksPeriod = "3s" - +SyncFullClaims = false [BridgeL2Sync] DBPath = "/tmp/bridgel2sync" BlockFinality = "LatestBlock" @@ -252,6 +252,7 @@ SyncBlockChunkSize = 100 RetryAfterErrorPeriod = "1s" MaxRetryAttemptsAfterError = -1 WaitForNewBlocksPeriod = "3s" +SyncFullClaims = false [LastGERSync] DBPath = "/tmp/lastgersync"