Skip to content

Commit

Permalink
replace l1bridge2infosync for rpc logic
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaubennassar committed Sep 9, 2024
1 parent b114e12 commit f8162cb
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 845 deletions.
32 changes: 0 additions & 32 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/0xPolygon/cdk/etherman"
ethermanconfig "github.com/0xPolygon/cdk/etherman/config"
"github.com/0xPolygon/cdk/etherman/contracts"
"github.com/0xPolygon/cdk/l1bridge2infoindexsync"
"github.com/0xPolygon/cdk/l1infotreesync"
"github.com/0xPolygon/cdk/lastgersync"
"github.com/0xPolygon/cdk/log"
Expand Down Expand Up @@ -68,7 +67,6 @@ func start(cliCtx *cli.Context) error {
claimSponsor := runClaimSponsorIfNeeded(cliCtx.Context, components, l2Client, c.ClaimSponsor)
l1BridgeSync := runBridgeSyncL1IfNeeded(cliCtx.Context, components, c.BridgeL1Sync, reorgDetectorL1, l1Client)
l2BridgeSync := runBridgeSyncL2IfNeeded(cliCtx.Context, components, c.BridgeL2Sync, reorgDetectorL2, l2Client)
l1Bridge2InfoIndexSync := runL1Bridge2InfoIndexSyncIfNeeded(cliCtx.Context, components, c.L1Bridge2InfoIndexSync, l1BridgeSync, l1InfoTreeSync, l1Client)
lastGERSync := runLastGERSyncIfNeeded(cliCtx.Context, components, c.LastGERSync, reorgDetectorL2, l2Client, l1InfoTreeSync)

for _, component := range components {
Expand Down Expand Up @@ -96,7 +94,6 @@ func start(cliCtx *cli.Context) error {
c.Common.NetworkID,
claimSponsor,
l1InfoTreeSync,
l1Bridge2InfoIndexSync,
lastGERSync,
l1BridgeSync,
l2BridgeSync,
Expand Down Expand Up @@ -538,33 +535,6 @@ func runClaimSponsorIfNeeded(
return cs
}

func runL1Bridge2InfoIndexSyncIfNeeded(
ctx context.Context,
components []string,
cfg l1bridge2infoindexsync.Config,
l1BridgeSync *bridgesync.BridgeSync,
l1InfoTreeSync *l1infotreesync.L1InfoTreeSync,
l1Client *ethclient.Client,
) *l1bridge2infoindexsync.L1Bridge2InfoIndexSync {
if !isNeeded([]string{RPC}, components) {
return nil
}
l1Bridge2InfoIndexSync, err := l1bridge2infoindexsync.New(
cfg.DBPath,
l1BridgeSync,
l1InfoTreeSync,
l1Client,
cfg.RetryAfterErrorPeriod.Duration,
cfg.MaxRetryAttemptsAfterError,
cfg.WaitForSyncersPeriod.Duration,
)
if err != nil {
log.Fatalf("error creating l1Bridge2InfoIndexSync: %s", err)
}
go l1Bridge2InfoIndexSync.Start(ctx)
return l1Bridge2InfoIndexSync
}

func runLastGERSyncIfNeeded(
ctx context.Context,
components []string,
Expand Down Expand Up @@ -662,7 +632,6 @@ func createRPC(
cdkNetworkID uint32,
sponsor *claimsponsor.ClaimSponsor,
l1InfoTree *l1infotreesync.L1InfoTreeSync,
l1Bridge2Index *l1bridge2infoindexsync.L1Bridge2InfoIndexSync,
injectedGERs *lastgersync.LastGERSync,
bridgeL1 *bridgesync.BridgeSync,
bridgeL2 *bridgesync.BridgeSync,
Expand All @@ -676,7 +645,6 @@ func createRPC(
cdkNetworkID,
sponsor,
l1InfoTree,
l1Bridge2Index,
injectedGERs,
bridgeL1,
bridgeL2,
Expand Down
5 changes: 0 additions & 5 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/0xPolygon/cdk/claimsponsor"
"github.com/0xPolygon/cdk/common"
ethermanconfig "github.com/0xPolygon/cdk/etherman/config"
"github.com/0xPolygon/cdk/l1bridge2infoindexsync"
"github.com/0xPolygon/cdk/l1infotreesync"
"github.com/0xPolygon/cdk/lastgersync"
"github.com/0xPolygon/cdk/log"
Expand Down Expand Up @@ -94,10 +93,6 @@ type Config struct {
// ClaimSponsor is the config for the claim sponsor
ClaimSponsor claimsponsor.EVMClaimSponsorConfig

// L1Bridge2InfoIndexSync is the config for the synchronizers that maintains the relation of
// bridge from L1 --> L1 Info tree index. Needed for the bridge service (RPC)
L1Bridge2InfoIndexSync l1bridge2infoindexsync.Config

// BridgeL1Sync is the configuration for the synchronizer of the bridge of the L1
BridgeL1Sync bridgesync.Config

Expand Down
15 changes: 0 additions & 15 deletions l1bridge2infoindexsync/config.go

This file was deleted.

67 changes: 0 additions & 67 deletions l1bridge2infoindexsync/downloader.go

This file was deleted.

201 changes: 0 additions & 201 deletions l1bridge2infoindexsync/driver.go

This file was deleted.

Loading

0 comments on commit f8162cb

Please sign in to comment.