Skip to content

Conversation

@rakita
Copy link
Member

@rakita rakita commented Oct 9, 2025

Implementation of EIP-7928

This breaks the EvmState serde as it introduces an additional field for Account an original_info. Original info is used to calculate BAL. Discussion pending, maybe it is fine, but adding custom serde serialisation could work here.

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 9, 2025

CodSpeed Performance Report

Merging #3070 will degrade performances by 17.18%

Comparing rakita/bal (0d6607e) with main (a1fdb9d)

Summary

❌ 123 regressions
✅ 50 untouched

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
ADDRESS_50 18.8 µs 19.7 µs -4.28%
ADD_50 23.6 µs 24.5 µs -3.68%
AND_50 23.5 µs 24.5 µs -4.04%
BYTE_50 23.8 µs 24.8 µs -3.76%
CALLDATASIZE_50 18.6 µs 19.6 µs -5.05%
CALLER_50 18.8 µs 19.7 µs -4.57%
CALLVALUE_50 18.7 µs 19.6 µs -4.75%
CHAINID_50 18.5 µs 19.6 µs -5.63%
CLZ_50 23.3 µs 24.2 µs -3.59%
CODESIZE_50 18.7 µs 19.7 µs -5.45%
COINBASE_50 18.8 µs 19.6 µs -4.15%
DELEGATECALL_50 98.7 µs 102.7 µs -3.86%
DIFFICULTY_50 19 µs 20 µs -4.8%
DIV_50 26 µs 26.8 µs -3.03%
DUP10_50 23.5 µs 24.4 µs -3.82%
DUP11_50 23.7 µs 24.6 µs -3.55%
DUP12_50 23.4 µs 24.5 µs -4.28%
DUP13_50 23.5 µs 24.4 µs -3.69%
DUP14_50 23.5 µs 24.5 µs -4.27%
DUP15_50 23.5 µs 24.4 µs -3.82%
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

@rakita rakita changed the title WIP BAL WIP BAL EIP-7928 Oct 9, 2025
@rakita rakita force-pushed the rakita/bal branch 2 times, most recently from 8317dff to a2d66df Compare October 16, 2025 20:30
@rakita rakita changed the title WIP BAL EIP-7928 feat: BAL EIP-7928 Oct 20, 2025
@rakita rakita marked this pull request as ready for review October 29, 2025 14:53
* fix: bal binary search cases

* nit(test): generalize BAL binary search test for any threshold

* code cleanup

---------

Co-authored-by: rakita <[email protected]>

impl<DB: Database> Database for State<DB> {
type Error = DB::Error;
type Error = BalDatabaseError<DB::Error>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm I think it's undesired that we break API like that

Copy link
Member Author

Choose a reason for hiding this comment

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

We are going back and forth on this. It should be fine as this error is again wrapped in main EVMError as result of transact.

cc @mattsse

Comment on lines +312 to +316
// will populate account code if there was a bal change to it. If there is no change
// it will be fetched in code_by_hash.
self.bal_state
.basic(address, basic)
.map_err(Self::Error::from)
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure I understand what we're doing here

does this overlay BAL on top of the state? why don't we query the BAL first then? what do errors represent?

Comment on lines +20 to +21
/// Storage id.
pub storage_id: Option<usize>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we document what this is and what it's used for?

Comment on lines +67 to +79
/// Gets storage value of account by its id.
///
/// Default implementation is to call [`Database::storage`] method.
#[inline]
fn storage_by_account_id(
&mut self,
address: Address,
account_id: usize,
storage_key: StorageKey,
) -> Result<StorageValue, Self::Error> {
let _ = account_id;
self.storage(address, storage_key)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

also worth documenting what is account_id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants