Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement ReorgDetector V2 #34

Merged
merged 45 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
14f9ab1
Added e2e test for reorg detection
begmaroman Aug 7, 2024
af97f03
Implemented reorg monitor
begmaroman Aug 13, 2024
947b95c
Removed useless test
begmaroman Aug 13, 2024
ff2cf6d
Revert changes
begmaroman Aug 13, 2024
aa2fd26
Implementation
begmaroman Aug 20, 2024
ac4cbe4
Implementation
begmaroman Aug 20, 2024
9517b4b
Implementation
begmaroman Aug 20, 2024
52557ef
Updated tests
begmaroman Aug 20, 2024
0c9e883
Merge remote-tracking branch 'origin/develop' into feature/CDK-385
begmaroman Aug 20, 2024
ac5f738
Updated tests
begmaroman Aug 20, 2024
49fa7d8
Updated tests
begmaroman Aug 20, 2024
0dc2370
Implementation
begmaroman Aug 21, 2024
47c3b94
Implementation
begmaroman Aug 21, 2024
9913d87
Implementation
begmaroman Aug 21, 2024
6028440
Implementation
begmaroman Aug 21, 2024
4ebf12b
Merge remote-tracking branch 'origin/develop' into feature/CDK-385
begmaroman Aug 21, 2024
92e5681
Synced with main
begmaroman Aug 21, 2024
6af5644
Fixed tests
begmaroman Aug 21, 2024
e633b47
Implementation
begmaroman Aug 21, 2024
b1542dc
Implementation
begmaroman Aug 22, 2024
4835d9a
Updated E2E test
begmaroman Aug 22, 2024
9135a2d
Minor update
begmaroman Aug 22, 2024
6c0e817
Minor update
begmaroman Aug 22, 2024
fbcf805
Minor update
begmaroman Aug 22, 2024
b82d0a8
Minor update
begmaroman Aug 22, 2024
892d0d6
Minor update
begmaroman Aug 22, 2024
d88f723
Minor update
begmaroman Aug 22, 2024
c723407
Minor update
begmaroman Aug 22, 2024
fc38452
Minor update
begmaroman Aug 22, 2024
0c91e6f
Finalized reorg detector
begmaroman Aug 26, 2024
63857fd
Finalized reorg detector
begmaroman Aug 26, 2024
9e781f4
Fixed unit tests
begmaroman Aug 26, 2024
2237684
Fixed unit tests
begmaroman Aug 26, 2024
6bdba60
Fixed unit tests
begmaroman Aug 26, 2024
c982e79
Fixed unit tests
begmaroman Aug 26, 2024
effc6aa
Fixed unit tests
begmaroman Aug 26, 2024
5cb68f0
Fixed unit tests
begmaroman Aug 26, 2024
ca3b8f3
Added debug log
begmaroman Aug 26, 2024
569affb
Removed debug logs
begmaroman Aug 26, 2024
e864d36
Fixed e2e tests
begmaroman Aug 26, 2024
e57badb
Fixed e2e tests
begmaroman Aug 26, 2024
cd3d3ef
Fixed e2e tests
begmaroman Aug 26, 2024
3b9a15a
Address comments
begmaroman Aug 26, 2024
d0bc399
Address comments
begmaroman Aug 27, 2024
0b672f9
Address comments
begmaroman Aug 27, 2024
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
2 changes: 1 addition & 1 deletion bridgesync/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestBridgeEventE2E(t *testing.T) {
auth, err := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1337))
require.NoError(t, err)
client, bridgeAddr, bridgeSc := newSimulatedClient(t, auth)
rd, err := reorgdetector.New(ctx, client.Client(), dbPathReorg)
rd, err := reorgdetector.New(client.Client(), reorgdetector.Config{DBPath: dbPathReorg})
require.NoError(t, err)
go rd.Start(ctx)

Expand Down
83 changes: 77 additions & 6 deletions bridgesync/mock_l2_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 8 additions & 9 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ func start(cliCtx *cli.Context) error {
components := cliCtx.StringSlice(config.FlagComponents)
l1Client := runL1ClientIfNeeded(components, c.Etherman.URL)
l2Client := runL2ClientIfNeeded(components, c.AggOracle.EVMSender.URLRPCL2)
reorgDetectorL1 := runReorgDetectorL1IfNeeded(cliCtx.Context, components, l1Client, c.ReorgDetectorL1.DBPath)
reorgDetectorL2 := runReorgDetectorL2IfNeeded(cliCtx.Context, components, l2Client, c.ReorgDetectorL2.DBPath)
reorgDetectorL1 := runReorgDetectorL1IfNeeded(cliCtx.Context, components, l1Client, &c.ReorgDetectorL1)
reorgDetectorL2 := runReorgDetectorL2IfNeeded(cliCtx.Context, components, l2Client, &c.ReorgDetectorL2)
l1InfoTreeSync := runL1InfoTreeSyncerIfNeeded(cliCtx.Context, components, *c, l1Client, reorgDetectorL1)
claimSponsor := runClaimSponsorIfNeeded(cliCtx.Context, components, l2Client, c.ClaimSponsor)
l1BridgeSync := runBridgeSyncL1IfNeeded(cliCtx.Context, components, c.BridgeL1Sync, reorgDetectorL1, l1Client)
Expand Down Expand Up @@ -408,11 +408,10 @@ func newState(c *config.Config, l2ChainID uint64, sqlDB *pgxpool.Pool) *state.St
}

func newReorgDetector(
ctx context.Context,
dbPath string,
cfg *reorgdetector.Config,
client *ethclient.Client,
) *reorgdetector.ReorgDetector {
rd, err := reorgdetector.New(ctx, client, dbPath)
rd, err := reorgdetector.New(client, *cfg)
if err != nil {
log.Fatal(err)
}
Expand Down Expand Up @@ -485,20 +484,20 @@ func runL2ClientIfNeeded(components []string, urlRPCL2 string) *ethclient.Client
return l2CLient
}

func runReorgDetectorL1IfNeeded(ctx context.Context, components []string, l1Client *ethclient.Client, dbPath string) *reorgdetector.ReorgDetector {
func runReorgDetectorL1IfNeeded(ctx context.Context, components []string, l1Client *ethclient.Client, cfg *reorgdetector.Config) *reorgdetector.ReorgDetector {
if !isNeeded([]string{SEQUENCE_SENDER, AGGREGATOR, AGGORACLE, RPC}, components) {
return nil
}
rd := newReorgDetector(ctx, dbPath, l1Client)
rd := newReorgDetector(cfg, l1Client)
go rd.Start(ctx)
return rd
}

func runReorgDetectorL2IfNeeded(ctx context.Context, components []string, l2Client *ethclient.Client, dbPath string) *reorgdetector.ReorgDetector {
func runReorgDetectorL2IfNeeded(ctx context.Context, components []string, l2Client *ethclient.Client, cfg *reorgdetector.Config) *reorgdetector.ReorgDetector {
if !isNeeded([]string{AGGORACLE, RPC}, components) {
return nil
}
rd := newReorgDetector(ctx, dbPath, l2Client)
rd := newReorgDetector(cfg, l2Client)
go rd.Start(ctx)
return rd
}
Expand Down
13 changes: 8 additions & 5 deletions dataavailability/mocks_da/batch_data_provider.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 20 additions & 5 deletions dataavailability/mocks_da/da_backender.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading