Skip to content

revive/types: Implement the ethereum 7702 transaction#9538

Merged
lexnv merged 15 commits intolexnv/minimal-poc-block-storagefrom
lexnv/eth-eip7702
Sep 17, 2025
Merged

revive/types: Implement the ethereum 7702 transaction#9538
lexnv merged 15 commits intolexnv/minimal-poc-block-storagefrom
lexnv/eth-eip7702

Conversation

@lexnv
Copy link
Copy Markdown
Contributor

@lexnv lexnv commented Aug 21, 2025

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

lexnv added 4 commits August 21, 2025 16:08
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>
@lexnv lexnv self-assigned this Aug 21, 2025
@lexnv lexnv added the T0-node This PR/Issue is related to the topic “node”. label Aug 21, 2025
@lexnv lexnv requested review from athei, lrubasze and pgherveou August 21, 2025 17:03
lexnv added 3 commits August 21, 2025 17:24
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>
@pgherveou
Copy link
Copy Markdown
Contributor

Ah i think I implemented here as well, both pr should be pretty similar I guess,
Will review and approve tomorrow

If you can pickup any differences with this one let me know

#9177

@pgherveou
Copy link
Copy Markdown
Contributor

will merge the diff in #9177

@pgherveou pgherveou closed this Aug 22, 2025
@pgherveou pgherveou reopened this Aug 22, 2025
@pgherveou
Copy link
Copy Markdown
Contributor

@lexnv re-opening here, but I think we should merge master and fix it up once the other PR mentioned above is merged

Comment on lines +217 to +219
s.append(&self.r);
s.append(&self.s);
s.append(&self.y_parity);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the order is wrong here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the catch! 🙏 Yep it looks to be:

authorization_list = [[chain_id, address, nonce, y_parity, r, s], ...]

lexnv added 4 commits August 22, 2025 11:40
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>
@athei
Copy link
Copy Markdown
Member

athei commented Aug 22, 2025

Is it a good idea to implement the tx type without the actual functionality? We are just ignoring those new fields?

@pgherveou
Copy link
Copy Markdown
Contributor

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

lexnv added 3 commits August 26, 2025 11:54
… 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>
Copy link
Copy Markdown
Contributor

@lrubasze lrubasze left a comment

Choose a reason for hiding this comment

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

LGTM

extra_data: self.extra_data.clone().0.into(),
mix_hash: self.mix_hash.0.into(),
nonce: self.nonce.0.into(),
// <<<<<<< HEAD
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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>
@lexnv lexnv requested review from a team as code owners September 17, 2025 12:49
@lexnv lexnv merged commit 4009539 into lexnv/minimal-poc-block-storage Sep 17, 2025
69 of 70 checks passed
@lexnv lexnv deleted the lexnv/eth-eip7702 branch September 17, 2025 12:50
@paritytech-workflow-stopper
Copy link
Copy Markdown

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/17798151508
Failed job name: cargo-clippy

@paritytech-workflow-stopper
Copy link
Copy Markdown

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/17798151547
Failed job name: test-linux-stable

lexnv added a commit that referenced this pull request Sep 17, 2025
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
lexnv added a commit that referenced this pull request Sep 17, 2025
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T0-node This PR/Issue is related to the topic “node”.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants