revive/types: Implement the ethereum 7702 transaction#9538
revive/types: Implement the ethereum 7702 transaction#9538lexnv merged 15 commits intolexnv/minimal-poc-block-storagefrom
Conversation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
|
Ah i think I implemented here as well, both pr should be pretty similar I guess, If you can pickup any differences with this one let me know |
|
will merge the diff in #9177 |
|
@lexnv re-opening here, but I think we should merge master and fix it up once the other PR mentioned above is merged |
| s.append(&self.r); | ||
| s.append(&self.s); | ||
| s.append(&self.y_parity); |
There was a problem hiding this comment.
I think the order is wrong here
There was a problem hiding this comment.
Thanks for the catch! 🙏 Yep it looks to be:
authorization_list = [[chain_id, address, nonce, y_parity, r, s], ...]
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
|
Is it a good idea to implement the tx type without the actual functionality? We are just ignoring those new fields? |
it's moved to #9177 the tx types are rejected, when we try to convert them to call |
… into lexnv/eth-eip7702 Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
| extra_data: self.extra_data.clone().0.into(), | ||
| mix_hash: self.mix_hash.0.into(), | ||
| nonce: self.nonce.0.into(), | ||
| // <<<<<<< HEAD |
There was a problem hiding this comment.
What's the purpose of leaving this commented section?
| .collect(); | ||
| // Sort by nibble key. | ||
| // This gives the right lexicographical order to add leaves to the trie. | ||
| pairs.sort_by(|x, y| x.0.cmp(&y.0)); |
There was a problem hiding this comment.
After investigating the trie root computation we know that pair at index 0 has key 0x80 and should be moved at position 0x80 or last (if number of elements is less than 0x80). No need to sort.
This PR compares the incremental trie builder approach with the in-storage approach. This uses real-life ethereum blocks to determine how many bytes we need to store. ### Storage Usage In the worst-case scenario, the validator needs to store in RAM 8004 bytes vs 80538 bytes. This represents roughly 9.9% of the initial data. At a minimum, best case scenario, the validator needs to sore just 406 bytes. This represents roughly 0.5% of the initial data. ``` For tx=6 using index=7 HB size is: 8004 vs total 80538 For tx=64 using index=65 HB size is: 406 vs total 80538 ``` This approach shows that we can optimize the storage items from (between 90-99%): - #9418 ### Implementation Idea Currently, we hold in the storage of pallet/revive the RLP encoded transaction bytes. This represents a [Vec<Vec<u8>>](https://github.com/paritytech/polkadot-sdk/pull/9418/files#diff-f55a8416f5e8564cb4463b5f11dfd00d7c865aabab747a05887feeedd4e1c81dR570-R571) that is used to build the transaction trie root hash. Instead, we place a newly added low-level structure `IncrementalTrieBuilder` into an `environmental` variable. When we receive a transaction, instead of pushing it to the `Vec<Vec<u8>>`, we add it to the low-level builder. This effectively will use the `8004` bytes plus the RLP encodings of a maximum of 2 transactions. --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com> Signed-off-by: xermicus <cyrill@parity.io> Co-authored-by: Serban Iorga <serban@parity.io> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: muharem <ismailov.m.h@gmail.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Evgeny Snitko <evgeny@parity.io> Co-authored-by: alvicsam <alvicsam@gmail.com> Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com> Co-authored-by: sistemd <enntheprogrammer@gmail.com> Co-authored-by: Veronika Romashkina <vrom911@gmail.com> Co-authored-by: Raymond Cheung <178801527+raymondkfcheung@users.noreply.github.com> Co-authored-by: Andrei Eres <eresav@me.com> Co-authored-by: Haiko Schol <hs+github@haikoschol.com> Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com> Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com> Co-authored-by: Karol Kokoszka <karol@parity.io> Co-authored-by: Clara van Staden <claravanstaden64@gmail.com> Co-authored-by: PG Herveou <pgherveou@gmail.com> Co-authored-by: Alexander Theißen <alex.theissen@me.com> Co-authored-by: xermicus <cyrill@parity.io> Co-authored-by: 0xRVE <robertvaneerdewijk@gmail.com> Co-authored-by: Robert van Eerdewijk <robert@Roberts-MacBook-Pro.local> Co-authored-by: Sebastian Miasojed <s.miasojed@gmail.com> Co-authored-by: Cyrill Leutwiler <bigcyrill@hotmail.com> Co-authored-by: Rodrigo Quelhas <22591718+RomarQ@users.noreply.github.com> Co-authored-by: Javier Viola <363911+pepoviola@users.noreply.github.com> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Bastian Köcher <info@kchr.de> Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com> Co-authored-by: Ron <yrong1997@gmail.com> Co-authored-by: Lukasz Rubaszewski <117115317+lrubasze@users.noreply.github.com> Co-authored-by: Alexander Cyon <Sajjon@users.noreply.github.com> Co-authored-by: Alexander Cyon <alex.cyon@parity.com> Co-authored-by: Dmitry Sinyavin <dmitry.sinyavin@parity.io> Co-authored-by: s0me0ne-unkn0wn <48632512+s0me0ne-unkn0wn@users.noreply.github.com> Co-authored-by: Paolo La Camera <paolo@parity.io> Co-authored-by: Andrei Sandu <andrei-mihail@parity.io> Co-authored-by: Sebastian Kunert <skunert49@gmail.com> Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by: Sebastian Miasojed <sebastian.miasojed@parity.io> Co-authored-by: Egor_P <egor@parity.io> Co-authored-by: Bruno Devic <bruno.devic@parity.io> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com> Co-authored-by: Alin Dima <alin@parity.io> Co-authored-by: Klapeyron <11329616+Klapeyron@users.noreply.github.com> Co-authored-by: Branislav Kontur <bkontur@gmail.com> Co-authored-by: drskalman <35698397+drskalman@users.noreply.github.com> Co-authored-by: Davide Galassi <davxy@datawok.net> Co-authored-by: Michael Müller <mich@elmueller.net> Co-authored-by: Doordashcon <jesse.chejieh@gmail.com> Co-authored-by: Andrii <ndk@parity.io>
4009539
into
lexnv/minimal-poc-block-storage
|
All GitHub workflows were cancelled due to failure one of the required jobs. |
|
All GitHub workflows were cancelled due to failure one of the required jobs. |
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
…ons (#9764) This is a combination of: - #9538 - #9554 - Because I've merged origin/master into the 3 PR in the tree series, which led to reporting all in-between commits as part of the PRs For tracking purposes only. --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by: Lukasz Rubaszewski <117115317+lrubasze@users.noreply.github.com>
This PR implements the Ethereum 7702 transaction:
While at it, have added a few serialization tests to ensure our block decoding doesn't panic.
Builds opon: #9418
Closes: paritytech/contract-issues#146
Part of: paritytech/contract-issues#139