-
Notifications
You must be signed in to change notification settings - Fork 7
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: calculate network id #212
base: release/v0.5.0
Are you sure you want to change the base?
Conversation
cmd/run.go
Outdated
reorgDetectorL2 *reorgdetector.ReorgDetector, | ||
l2Client *ethclient.Client, | ||
) *bridgesync.BridgeSync { | ||
if !isNeeded([]string{cdkcommon.RPC, cdkcommon.AGGSENDER}, components) { | ||
return nil | ||
} | ||
|
||
ethermanClient, err := newEtherman(c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of passing c config.Config
to be able to create a ethClient, inject the etherClient. There are 2 functions on run.go
that create the common instance for all classes:
runL1ClientIfNeeded
runL2ClientIfNeeded
cmd/run.go
Outdated
@@ -77,8 +77,8 @@ func start(cliCtx *cli.Context) error { | |||
|
|||
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) | |||
l2BridgeSync := runBridgeSyncL2IfNeeded(cliCtx.Context, components, c.BridgeL2Sync, reorgDetectorL2, l2Client) | |||
l1BridgeSync := runBridgeSyncL1IfNeeded(cliCtx.Context, components, *c, reorgDetectorL1, l1Client) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that is not related to your PR, but renaming c
for config
or even for cfg
would be really nice
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM, left a minor comments.
|
||
return 0, fmt.Errorf("error calling SMC RollupManager.RollupAddressToID(%s). Err: %w", rollupAddr.String(), err) | ||
} | ||
log.Infof("rollupID: %d (obtenied from SMC: %s )", rollupID, contracts.Banana.RollupManager.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log.Infof("rollupID: %d (obtenied from SMC: %s )", rollupID, contracts.Banana.RollupManager.String()) | |
log.Infof("rollupID: %d (obtained from contract: %s )", rollupID, contracts.Banana.RollupManager.String()) |
if err != nil { | ||
log.Errorf("error getting rollupID from %s : %+v", contracts.Banana.RollupManager.String(), err) | ||
|
||
return 0, fmt.Errorf("error calling SMC RollupManager.RollupAddressToID(%s). Err: %w", rollupAddr.String(), err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return 0, fmt.Errorf("error calling SMC RollupManager.RollupAddressToID(%s). Err: %w", rollupAddr.String(), err) | |
return 0, fmt.Errorf("error calling contract RollupManager.RollupAddressToID(%s). Err: %w", rollupAddr.String(), err) |
} | ||
rollupID, err := contracts.Banana.RollupManager.RollupAddressToID(&bind.CallOpts{Pending: false}, rollupAddr) | ||
if err != nil { | ||
log.Errorf("error getting rollupID from %s : %+v", contracts.Banana.RollupManager.String(), err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log.Errorf("error getting rollupID from %s : %+v", contracts.Banana.RollupManager.String(), err) | |
log.Errorf("error getting rollupID from %s: %v", contracts.Banana.RollupManager.String(), err) |
Description
Calculate network ID instead of reading it from config