zksync-era
zksync-era copied to clipboard
fix(Validium): Add commitment mode cross check
What ❔
Adds a cross-check of the local mode with L1 when setting up the server.
Why ❔
It is now possible to run the node with an incorrect config that doesn’t match the L1 config.
We should force the node to ask the pre-deployed contracts on L1 in which mode it should run.
Checklist
- [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via
zk fmt
andzk lint
. - [ ] Spellcheck has been run via
zk spellcheck
. - [ ] Linkcheck has been run via
zk linkcheck
.
@ilitteri also btw now that it's extracted to a separate function, it probably should be easy to integrate this check to EN as well (as a separate PR).
@ilitteri also btw now that it's extracted to a separate function, it probably should be easy to integrate this check to EN as well (as a separate PR).
Thanks a lot for the nits, I'll make new PRs for adding this cross-check to the EN and for the unit test.
@ilitteri also btw now that it's extracted to a separate function, it probably should be easy to integrate this check to EN as well (as a separate PR).
@popzxc I'm currently working on supporting this cross-check in the EN and found out that the main_node_client does not implement EthInterface
, thus the method cannot be exactly replicated.
Is it ok to replace the type of the main_node_client
for a Arc<dyn EthInterface>
? Or is it better to implement EthInterface
for HttpClient
?
@ilitteri On EN eth_client_url
is a part of required config, and you can see it being used e.g. to instantiate the consistency checker. Right now, ConsistencyChecker
takes a URL and instantiates QueryClient
inside new
just to coerce it to Arc<dyn EthInterface>
. You can change it so that ConsistencyChecker::new
accepts Arc<dyn EthInterface>
and QueryClient
is instantiated outside -- this way you'll have access to it during ETH initialization logic. Does it make sense?
@ilitteri On EN
eth_client_url
is a part of required config, and you can see it being used e.g. to instantiate the consistency checker. Right now,ConsistencyChecker
takes a URL and instantiatesQueryClient
insidenew
just to coerce it toArc<dyn EthInterface>
. You can change it so thatConsistencyChecker::new
acceptsArc<dyn EthInterface>
andQueryClient
is instantiated outside -- this way you'll have access to it during ETH initialization logic. Does it make sense?
This totally makes sense to me, thanks