-
Notifications
You must be signed in to change notification settings - Fork 310
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: Rollup contracts moves msgs between L1 and L2 #609
Conversation
const slot = keccak256(Buffer.concat([l1ToL2Messages[i].toBuffer(), fr(0).toBuffer()])); | ||
const value = 1n | ((2n ** 32n - 1n) << 128n); | ||
// we are using Fr for the value as an easy way to get a correctly sized buffer and string. | ||
const params = `["${inboxAddress}", "${slot}", "0x${new Fr(value).toBuffer().toString('hex')}"]`; |
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'd probably refactor this such that there is a method
const overwriteSlot = (address: EthAddress, slot: number, value: Buffer) => {
// throw anvil stuff in here
}
^ this can be hidden away somewhere.
Then have forceInsertionIndex
be nice n tidy in this file.
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 created #613 as I think it is a tad too cheeky to jump in and overwrite storage slots manually for integration tests.
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.
Im happy with this, have a few suggestions, other comment would to just call inbox.sendMessage
rather than overwriting the slots
@@ -55,6 +61,13 @@ contract Rollup is Decoder { | |||
|
|||
rollupStateHash = newStateHash; | |||
|
|||
// @todo (issue #605) handle fee collector | |||
IInbox inbox = REGISTRY.getInbox(); |
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.
would it be more gas efficient to just make one external call getting all addresses then destructure?
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.
If getting all the addresses we will be reading an extra storage slot for the rollup address as well, e.g., 1 contract access + 3 storage reads. Here we have 1 cold contract access and 1 hot + 2 storage reads.
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.
sounds right
Description
Fixes #523.
Checklist: