Skip to content

Commit

Permalink
docs, test meta dat
Browse files Browse the repository at this point in the history
  • Loading branch information
rakita committed Aug 29, 2024
1 parent 9db723e commit 4add28b
Show file tree
Hide file tree
Showing 6 changed files with 16,217 additions and 11 deletions.
7 changes: 4 additions & 3 deletions crates/primitives/src/bytecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ impl Bytecode {
}
}

/// Return true if bytecode is EOF.
/// Returns true if bytecode is EOF.
#[inline]
pub const fn is_eof(&self) -> bool {
matches!(self, Self::Eof(_))
}

/// Returns true if bytecode is EIP-7702.
pub const fn is_eip7702(&self) -> bool {
matches!(self, Self::Eip7702(_))
}
Expand All @@ -89,7 +90,7 @@ impl Bytecode {
///
/// # Panics
///
/// Panics if bytecode is EOF and has incorrect format.
/// Panics if bytecode is in incorrect format.
#[inline]
pub fn new_raw(bytecode: Bytes) -> Self {
Self::new_raw_checked(bytecode).expect("Expect correct EOF bytecode")
Expand All @@ -103,7 +104,7 @@ impl Bytecode {

/// Creates a new raw [`Bytecode`].
///
/// Returns an error on incorrect EOF format.
/// Returns an error on incorrect Bytecode format.
#[inline]
pub fn new_raw_checked(bytecode: Bytes) -> Result<Self, BytecodeDecodeError> {
let prefix = bytecode.get(..2);
Expand Down
3 changes: 1 addition & 2 deletions crates/revm/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,12 @@ impl<EXT, DB: Database> Evm<'_, EXT, DB> {
.last_frame_return(ctx, &mut result)?;

let post_exec = self.handler.post_execution();
// calculate refund for EIP-7702
// calculate final refund and add EIP-7702 refund to gas.
post_exec.refund(ctx, result.gas_mut(), eip7702_gas_refund);
// Reimburse the caller
post_exec.reimburse_caller(ctx, result.gas())?;
// Reward beneficiary
post_exec.reward_beneficiary(ctx, result.gas())?;

// Returns output of transaction.
post_exec.output(ctx, result)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/handler/handle_types/pre_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl<'a, EXT, DB: Database> PreExecutionHandler<'a, EXT, DB> {
(self.load_accounts)(context)
}

/// Apply EIP-7702 auth list and return number of created accounts.
/// Apply EIP-7702 auth list and return gas refund on account that were already present.
pub fn apply_eip7702_auth_list(
&self,
context: &mut Context<EXT, DB>,
Expand Down
19 changes: 14 additions & 5 deletions documentation/src/crates/revm/handler.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,18 @@ They are called in the following order:

Consists of functions that are called before execution.
They are called in the following order:

* `load`:
Loads access list and beneficiary from `Database`. Cold load is done here.
Loads access list and beneficiary from `Database`. Cold load is done here.

* `load_precompiles`:
Retrieves the precompiles for the given spec ID.
More info: [precompile](../precompile.md).
Retrieves the precompiles for the given spec ID. More info: [precompile](../precompile.md).

* `apply_eip7702_auth_list`
Applies the EIP-7702 authorization list to the accounts. Return gas refund of already created accounts.

* `deduct_caller`:
Deducts values from the caller to calculate the maximum amount of gas that can be spent on the transaction.
Deducts values from the caller to calculate the maximum amount of gas that can be spent on the transaction.
This loads the caller account from the `Database`.

### ExecutionHandler
Expand Down Expand Up @@ -94,6 +99,10 @@ Look at the Interpreter documentation for more information.

Is a list of functions that are called after the execution. They are called in the following order:

* `refund`
Add EIP-7702 refund for already created accounts and calculates final gas refund that can
be a maximum of 1/5 (1/2 before London hardfork) of spent gas.

* `reimburse_caller`:
Reimburse the caller with gas that was not spent during the execution of the transaction.
Or balance of gas that needs to be refunded.
Expand All @@ -105,7 +114,7 @@ Is a list of functions that are called after the execution. They are called in t
Returns the state changes and the result of the execution.

* `end`:
Always called after transaction. End handler will not be called if validation fails.
Called after transaction. End handler will not be called if validation fails.

* `clear`:
Clears journal state and error and it is always called for the cleanup.
27 changes: 27 additions & 0 deletions tests/prague_suite/meta_prague/fixtures.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
; This file describes fixture build properties

[fixtures]
timestamp = 2024-08-28T17:42:15.994491
build = pectra-devnet-3
ref = refs/tags/[email protected]
commit = 6b893da2ec2d0bb8da2a038181ca712cba253e3b
command_line_args = fill --session-temp-folder=/tmp/tmpp115lb8u --index -n auto --evm-bin=ethereumjs-t8ntool.sh --fork=Prague -k "not slow and not many_deposits" ./tests/prague/ --output=fixtures_pectra-devnet-3.tar.gz --build-name pectra-devnet-3

[packages]
pytest = 7.4.4
pluggy = 1.5.0

[plugins]
metadata = 3.1.1
html = 4.1.1
xdist = 3.6.1

[tools]
t8n = ethereumjs t8n v1
solc = 0.8.21+commit.d9974bed.Linux.gpp

[environment]
python = 3.11.9
platform = Linux-6.5.0-1025-azure-x86_64-with-glibc2.35
ci = true

Loading

0 comments on commit 4add28b

Please sign in to comment.