Skip to content

Commit

Permalink
chore: upgrade the versions of primitive-types to 0.13 and rlp
Browse files Browse the repository at this point in the history
…to `0.6`
  • Loading branch information
0xbillw committed Jan 18, 2025
1 parent f45fcb7 commit d91e5b3
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 24 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ edition = "2018"

[dependencies]
auto_impl = "1.0"
ethereum = { version = "0.15", default-features = false }
ethereum = { git = "https://github.com/rust-ethereum/ethereum.git", rev = "3be0d8f", default-features = false }
log = { version = "0.4", default-features = false }
primitive-types = { version = "0.12", default-features = false, features = ["rlp"] }
rlp = { version = "0.5", default-features = false }
primitive-types = { version = "0.13", default-features = false, features = ["rlp"] }
rlp = { version = "0.6", default-features = false }
sha3 = { version = "0.10", default-features = false }

# Optional dependencies
Expand Down Expand Up @@ -55,7 +55,7 @@ with-codec = [
"scale-info",
"primitive-types/codec",
"primitive-types/scale-info",
"ethereum/with-codec",
"ethereum/with-scale",
"evm-core/with-codec",
]
with-serde = [
Expand Down
4 changes: 2 additions & 2 deletions benches/loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ fn run_loop_contract() {
},
);

let backend = MemoryBackend::new(&vicinity, state);
let mut backend = MemoryBackend::new(&vicinity, state);
let metadata = StackSubstateMetadata::new(u64::MAX, &config);
let state = MemoryStackState::new(metadata, &backend);
let state = MemoryStackState::new(metadata, &mut backend);
let precompiles = BTreeMap::new();
let mut executor = StackExecutor::new_with_precompiles(state, &config, &precompiles);

Expand Down
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ edition = "2018"

[dependencies]
log = { version = "0.4", optional = true }
primitive-types = { version = "0.12", default-features = false }
primitive-types = { version = "0.13", default-features = false }
scale-codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive", "full"], optional = true }
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
Expand Down
3 changes: 1 addition & 2 deletions core/src/eval/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ macro_rules! push {
macro_rules! push_u256 {
( $machine:expr, $( $x:expr ),* ) => (
$(
let mut value = H256::default();
$x.to_big_endian(&mut value[..]);
let value = H256::from($x.to_big_endian());
match $machine.stack.push(value) {
Ok(()) => (),
Err(e) => return Control::Exit(e.into()),
Expand Down
2 changes: 1 addition & 1 deletion gasometer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ edition = "2018"
[dependencies]
environmental = { version = "1.1.2", default-features = false, optional = true }
log = { version = "0.4", optional = true }
primitive-types = { version = "0.12", default-features = false }
primitive-types = { version = "0.13", default-features = false }

evm-core = { version = "0.42", path = "../core", default-features = false }
evm-runtime = { version = "0.42", path = "../runtime", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ edition = "2018"
[dependencies]
auto_impl = "1.0"
environmental = { version = "1.1.2", default-features = false, optional = true }
primitive-types = { version = "0.12", default-features = false }
primitive-types = { version = "0.13", default-features = false }
sha3 = { version = "0.10", default-features = false }

evm-core = { version = "0.42", path = "../core", default-features = false }
Expand Down
3 changes: 1 addition & 2 deletions runtime/src/eval/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ macro_rules! push {
macro_rules! push_u256 {
( $machine:expr, $( $x:expr ),* ) => (
$(
let mut value = H256::default();
$x.to_big_endian(&mut value[..]);
let value = H256::from($x.to_big_endian());
match $machine.machine.stack_mut().push(value) {
Ok(()) => (),
Err(e) => return Control::Exit(e.into()),
Expand Down
3 changes: 1 addition & 2 deletions runtime/src/eval/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ pub fn finish_call(
&runtime.return_data_buffer[..],
) {
Ok(()) => {
let mut value = H256::default();
U256::one().to_big_endian(&mut value[..]);
let value = H256::from(U256::one().to_big_endian());
runtime.machine.stack_mut().push(value)?;
Ok(())
}
Expand Down
15 changes: 6 additions & 9 deletions runtime/src/eval/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,22 @@ pub fn caller<H: Handler>(runtime: &mut Runtime) -> Control<H> {
}

pub fn callvalue<H: Handler>(runtime: &mut Runtime) -> Control<H> {
let mut ret = H256::default();
runtime.context.apparent_value.to_big_endian(&mut ret[..]);
push!(runtime, ret);
let ret = runtime.context.apparent_value.to_big_endian();
push!(runtime, H256::from(ret));

Control::Continue
}

pub fn gasprice<H: Handler>(runtime: &mut Runtime, handler: &H) -> Control<H> {
let mut ret = H256::default();
handler.gas_price().to_big_endian(&mut ret[..]);
push!(runtime, ret);
let ret = handler.gas_price().to_big_endian();
push!(runtime, H256::from(ret));

Control::Continue
}

pub fn base_fee<H: Handler>(runtime: &mut Runtime, handler: &H) -> Control<H> {
let mut ret = H256::default();
handler.block_base_fee_per_gas().to_big_endian(&mut ret[..]);
push!(runtime, ret);
let ret = handler.block_base_fee_per_gas().to_big_endian();
push!(runtime, H256::from(ret));

Control::Continue
}
Expand Down

0 comments on commit d91e5b3

Please sign in to comment.