Skip to content
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

LxLy exit roots #90

Merged
merged 6 commits into from
Mar 8, 2024
Merged

LxLy exit roots #90

merged 6 commits into from
Mar 8, 2024

Conversation

wborgeaud
Copy link
Contributor

@wborgeaud wborgeaud commented Mar 6, 2024

Write LxLy global exit roots to storage before executing a block.
Not really tied to Cancun, but this is very similar to EIP-4788 and I reused some functions from #40 so I guess it makes sense to merge it in feat/cancun.

closes #21

@@ -320,8 +331,38 @@ pub mod cancun_constants {
balance: U256::zero(),
// Storage root for this account at genesis.
storage_root: H256(hex!(
"f58e5f1eae7ce386de44266ff0286a88dafe7e4269c1ffa97f79dbbcf4f59e5c"
// "f58e5f1eae7ce386de44266ff0286a88dafe7e4269c1ffa97f79dbbcf4f59e5c"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this root is and why it's not the empty trie root (0x56e81f...)? @Nashtare

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this is a leftover from an initial version of the impl (can't recall why I put this value tbh) but we're not using this constant anymore (it's replaced by the initial_state_and_storage_tries_with_beacon_roots() utility method, which does specify an empty storage root) so could simply be removed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same goes for BEACON_ROOTS_CONTRACT_CODE, I don't think it's used anywhere FWIW

@pgebheim pgebheim added this to the Type 2 - Q1 2024 milestone Mar 6, 2024
@pgebheim pgebheim linked an issue Mar 6, 2024 that may be closed by this pull request
Copy link
Collaborator

@Nashtare Nashtare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks William, very clean. I just need clarity one the insertion, otherwise looks good to me!

PUSH 64 // storage_key has 64 nibbles
%get_storage_trie(@ADDRESS_GLOBAL_EXIT_ROOT_MANAGER_L2)
// stack: storage_root_ptr, 64, storage_key, value_ptr, after_timestamp_storage_insert
%jump(mpt_insert)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this overwrite the previous value?
I believe the reference code mentions: // if root already has a timestamp - don't update it
https://github.com/0xPolygonHermez/cdk-erigon/blob/7393c1521abfdbaff65b6236aee1d632e50c842d/zk/utils/global_exit_root.go#L49

Copy link
Contributor Author

@wborgeaud wborgeaud Mar 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops good catch, fixed

@Nashtare
Copy link
Collaborator

Nashtare commented Mar 7, 2024

Also feat/cancun has been updated from latest main, so CI for clippy should go ✅ now

@Nashtare Nashtare added the crate: evm_arithmetization Anything related to the evm_arithmetization crate. label Mar 7, 2024
@wborgeaud wborgeaud requested a review from muursh as a code owner March 7, 2024 08:46
Copy link
Collaborator

@Nashtare Nashtare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Contributor

@muursh muursh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@wborgeaud wborgeaud merged commit 23b7a28 into feat/cancun Mar 8, 2024
5 checks passed
@wborgeaud wborgeaud deleted the lxly_exit_roots branch March 8, 2024 05:50
BGluth pushed a commit that referenced this pull request Jun 17, 2024
* feat: add block interval

* fix: follow from loop

* feat: add block hash parsing for interval

* fix: proving logic

* fix: typos

* fix: review

* fix: doc tests

* feat: add block time cli argument

* fix: interval display

* feat: add from string for block interval

* fix: remove block interval single variant

* feat: implement concurrent block proving #88 #89 (#96)

* feat: implement concurrent block proving #88 #89

* Update prover/src/lib.rs

Co-authored-by: 0xaatif <169152398+0xaatif@users.noreply.github.com>

* fix suggestion

* Fix duplicated import when #[cfg(feature = "test_only")]

---------

Co-authored-by: 0xaatif <169152398+0xaatif@users.noreply.github.com>
Co-authored-by: Marko Atanasievski <markoatana@gmail.com>

* fix: block interval fmt

* fix: make parsing functions private

* fix: use futures iterator instead of tokio-stream

* fix: use anyhow error instead of block interval error

---------

Co-authored-by: Zach Brown <zach@zb.dev>
Co-authored-by: 0xaatif <169152398+0xaatif@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate: evm_arithmetization Anything related to the evm_arithmetization crate.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Include support for Cannonical Polygon Bridge
4 participants