Skip to content

Commit 21bba33

Browse files
committed
Resolve env conflicts
2 parents f2d59b9 + f6c9c7f commit 21bba33

File tree

21 files changed

+681
-277
lines changed

21 files changed

+681
-277
lines changed

.github/workflows/book.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,26 +73,26 @@ jobs:
7373
echo `pwd`/mdbook-template >> $GITHUB_PATH
7474
7575
- name: Build book
76-
run: mdbook build
76+
run: mdbook build documentation
7777

7878
- name: Build docs
7979
run: RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo +nightly doc --all --no-deps
8080

8181
- name: Move docs to book folder
8282
run: |
8383
mkdir -p target/book/docs
84-
mv target/doc target/book/docs
84+
mv target/doc documentation/book/docs
8585
8686
- name: Archive artifact
8787
shell: sh
8888
run: |
89-
chmod -c -R +rX "target/book" |
89+
chmod -c -R +rX "documentation/book" |
9090
while read line; do
9191
echo "::warning title=Invalid file permissions automatically fixed::$line"
9292
done
9393
tar \
9494
--dereference --hard-dereference \
95-
--directory "target/book" \
95+
--directory "documentation/book" \
9696
-cvf "$RUNNER_TEMP/artifact.tar" \
9797
--exclude=.git \
9898
--exclude=.github \

Cargo.lock

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bins/revme/src/statetest/runner.rs

+2
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ pub fn execute_test_suit(
257257
));
258258
let mut state = revm::db::StateBuilder::default()
259259
.with_cached_prestate(cache)
260+
.with_bundle_update()
260261
.build();
261262
let mut evm = revm::new();
262263
evm.database(&mut state);
@@ -294,6 +295,7 @@ pub fn execute_test_suit(
294295
));
295296
let mut state = revm::db::StateBuilder::default()
296297
.with_cached_prestate(cache)
298+
.with_bundle_update()
297299
.build();
298300
evm.database(&mut state);
299301
let _ =

crates/interpreter/src/gas.rs

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ impl Gas {
7979

8080
/// Records an explicit cost.
8181
///
82+
/// Returns `false` if the gas limit is exceeded.
83+
///
8284
/// This function is called on every instruction in the interpreter if the feature
8385
/// `no_gas_measuring` is not enabled.
8486
#[inline(always)]

crates/primitives/src/bytecode.rs

-13
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,6 @@ impl Bytecode {
101101
}
102102
}
103103

104-
/// Creates a new raw Bytecode with the given hash.
105-
///
106-
/// # Safety
107-
///
108-
/// The given `hash` has to be equal to the [`keccak256`] hash of the given `bytecode`.
109-
#[inline]
110-
pub unsafe fn new_raw_with_hash(bytecode: Bytes) -> Self {
111-
Self {
112-
bytecode,
113-
state: BytecodeState::Raw,
114-
}
115-
}
116-
117104
/// Create new checked bytecode
118105
///
119106
/// # Safety

crates/primitives/src/db.rs

+19-10
Original file line numberDiff line numberDiff line change
@@ -74,32 +74,41 @@ impl<T: DatabaseRef> Database for WrapDatabaseRef<T> {
7474
}
7575
}
7676

77-
pub struct RefDBWrapper<'a, Error> {
78-
pub db: &'a dyn DatabaseRef<Error = Error>,
77+
/// Wraps a `dyn DatabaseRef` to provide a [`Database`] implementation.
78+
#[doc(hidden)]
79+
#[deprecated = "use `WrapDatabaseRef` instead"]
80+
pub struct RefDBWrapper<'a, E> {
81+
pub db: &'a dyn DatabaseRef<Error = E>,
7982
}
8083

81-
impl<'a, Error> RefDBWrapper<'a, Error> {
82-
pub fn new(db: &'a dyn DatabaseRef<Error = Error>) -> Self {
84+
#[allow(deprecated)]
85+
impl<'a, E> RefDBWrapper<'a, E> {
86+
#[inline]
87+
pub fn new(db: &'a dyn DatabaseRef<Error = E>) -> Self {
8388
Self { db }
8489
}
8590
}
8691

87-
impl<'a, Error> Database for RefDBWrapper<'a, Error> {
88-
type Error = Error;
89-
/// Get basic account information.
92+
#[allow(deprecated)]
93+
impl<'a, E> Database for RefDBWrapper<'a, E> {
94+
type Error = E;
95+
96+
#[inline]
9097
fn basic(&mut self, address: B160) -> Result<Option<AccountInfo>, Self::Error> {
9198
self.db.basic(address)
9299
}
93-
/// Get account code by its hash
100+
101+
#[inline]
94102
fn code_by_hash(&mut self, code_hash: B256) -> Result<Bytecode, Self::Error> {
95103
self.db.code_by_hash(code_hash)
96104
}
97-
/// Get storage value of address at index.
105+
106+
#[inline]
98107
fn storage(&mut self, address: B160, index: U256) -> Result<U256, Self::Error> {
99108
self.db.storage(address, index)
100109
}
101110

102-
// History related
111+
#[inline]
103112
fn block_hash(&mut self, number: U256) -> Result<B256, Self::Error> {
104113
self.db.block_hash(number)
105114
}

crates/primitives/src/env.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ use crate::{
55
use bytes::Bytes;
66
use core::cmp::{min, Ordering};
77

8-
#[derive(Clone, Debug, Default)]
8+
#[derive(Clone, Debug, Default, PartialEq, Eq)]
99
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1010
pub struct Env {
1111
pub cfg: CfgEnv,
1212
pub block: BlockEnv,
1313
pub tx: TxEnv,
1414
}
15-
#[derive(Clone, Debug, Eq, PartialEq)]
15+
#[derive(Clone, Debug, PartialEq, Eq)]
1616
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1717
pub struct BlockEnv {
1818
pub number: U256,
@@ -30,7 +30,7 @@ pub struct BlockEnv {
3030
pub gas_limit: U256,
3131
}
3232
#[cfg(feature = "optimism")]
33-
#[derive(Clone, Debug, Default)]
33+
#[derive(Clone, Debug, Default, PartialEq, Eq)]
3434
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3535
pub struct OptimismFields {
3636
pub source_hash: Option<B256>,
@@ -39,7 +39,7 @@ pub struct OptimismFields {
3939
pub l1_cost: Option<U256>,
4040
}
4141

42-
#[derive(Clone, Debug)]
42+
#[derive(Clone, Debug, PartialEq, Eq)]
4343
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4444
pub struct TxEnv {
4545
/// Caller or Author or tx signer
@@ -59,7 +59,7 @@ pub struct TxEnv {
5959
pub optimism: OptimismFields,
6060
}
6161

62-
#[derive(Clone, Debug)]
62+
#[derive(Clone, Debug, PartialEq, Eq)]
6363
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
6464
pub enum TransactTo {
6565
Call(B160),

crates/revm/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ version = "3.3.0"
1010
readme = "../../README.md"
1111

1212
[dependencies]
13-
revm-precompile = { path = "../precompile", version = "2.0.2", default-features = false }
1413
revm-interpreter = { path = "../interpreter", version = "1.1.2", default-features = false }
14+
revm-precompile = { path = "../precompile", version = "2.0.2", default-features = false }
1515

1616
#misc
1717
auto_impl = { version = "1.1", default-features = false }

crates/revm/src/db.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub mod states;
1212
#[cfg(feature = "std")]
1313
pub use states::{
1414
AccountRevert, AccountStatus, BundleAccount, BundleState, CacheState, PlainAccount,
15-
RevertToSlot, State, StateBuilder, StorageWithOriginalValues, TransitionAccount,
15+
RevertToSlot, State, StateBuilder, StateDBBox, StorageWithOriginalValues, TransitionAccount,
1616
TransitionState,
1717
};
1818

crates/revm/src/db/states.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ pub use bundle_account::BundleAccount;
1717
pub use bundle_state::BundleState;
1818
pub use cache::CacheState;
1919
pub use cache_account::CacheAccount;
20-
pub use changes::{StateChangeset, StateReverts};
20+
pub use changes::{PlainStateReverts, PlainStorageChangeset, PlainStorageRevert, StateChangeset};
2121
pub use plain_account::{PlainAccount, StorageWithOriginalValues};
2222
pub use reverts::{AccountRevert, RevertToSlot};
23-
pub use state::State;
23+
pub use state::{State, StateDBBox};
2424
pub use state_builder::StateBuilder;
2525
pub use transition_account::TransitionAccount;
2626
pub use transition_state::TransitionState;

0 commit comments

Comments
 (0)