fix: add destination base token asset id to bundle#2042
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 579508f595
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…ion-base-token-asset-id-to-bundle
c9e6db0 to
d1776cc
Compare
fb24926 to
7811336
Compare
…ion-base-token-asset-id-to-bundle
l1-contracts/contracts/core/chain-registration/ChainRegistrationSender.sol
Outdated
Show resolved
Hide resolved
| bytes32 destinationChainBaseTokenAssetId = L2_BRIDGEHUB.baseTokenAssetId(_destinationChainId); | ||
| require(destinationChainBaseTokenAssetId != bytes32(0), DestinationChainNotRegistered(_destinationChainId)); | ||
| bytes32 thisChainBaseTokenAssetId = L2_BRIDGEHUB.baseTokenAssetId(block.chainid); | ||
| require(thisChainBaseTokenAssetId != bytes32(0), ThisChainNotRegisteredForInterop(block.chainid)); |
There was a problem hiding this comment.
how is this value populated?
AFAIK L2_BRIDGEHUB.baseTokenAssetId(block.chainid) doesnt get populated by default at all. Previously one could use chain registration sender to register the chain on itself, but it is gone now.
It is better to do what @kelemeno suggested: to query from NTV or maybe even better, to populated the L2_BRIDGEHUB.baseTokenAssetId(block.chainid) during genesis
There was a problem hiding this comment.
It was being populated as part of chain registration script, which registered the chain on itself:
But agree, it is better to query from NTV, resolved in: 6cc63ea
to populated the L2_BRIDGEHUB.baseTokenAssetId(block.chainid) during genesis
not sure what the benefit to this is now, but can add that as well
There was a problem hiding this comment.
but it is nowhere enforced inside the protocol that the script will be run, it is a footgun
| require( | ||
| interopBundle.destinationBaseTokenAssetId == baseTokenAssetId, | ||
| WrongDestinationBaseTokenAssetId(bundleHash, baseTokenAssetId, interopBundle.destinationBaseTokenAssetId) | ||
| ); |
There was a problem hiding this comment.
Stylistic, but repeated fromlines 65-70
Moving to a separate function won't add much, as variables will have to be passed, but might remove repetition
There was a problem hiding this comment.
There is some level of code duplication on InteropHandler (eg, checks above this one), probably worth to refactor it but imo better to do so on a separate PR.
…ion-base-token-asset-id-to-bundle
|
Coverage after merging sma/add-destination-base-token-asset-id-to-bundle into draft-v31 will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
## What ❔ This is a sister PR to: matter-labs/era-contracts#2042 <!-- What are the changes this PR brings about? --> <!-- Example: This PR adds a PR template to the repo. --> <!-- (For bigger PRs adding more context is appreciated) --> ## Why ❔ <!-- Why are these changes done? What goal do they contribute to? What are the principles behind them? --> <!-- The `Why` has to be clear to non-Matter Labs entities running their own ZK Chain --> <!-- Example: PR templates ensure PR reviewers, observers, and future iterators are in context about the evolution of repos. --> ## Is this a breaking change? - [ ] Yes - [ ] No ## Operational changes <!-- Any config changes? Any new flags? Any changes to any scripts? --> <!-- Please add anything that non-Matter Labs entities running their own ZK Chain may need to know --> ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [ ] 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 `zkstack dev fmt` and `zkstack dev lint`. --------- Co-authored-by: kelemeno <34402761+kelemeno@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: Stanislav Bezkorovainyi <stanislavbezkor@gmail.com> Co-authored-by: kelemeno <kl@matterlabs.dev> Co-authored-by: 0xValera <55665573+0xValera@users.noreply.github.com>
What ❔
This is a sister PR to: matter-labs/zksync-era#4678
Why ❔
Checklist