Skip to content

Upgrade to polkadot-stable2412 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ keywords = { workspace = true }
description = "Ethereum Virtual Machine"

[dependencies]
primitive-types = { version = "0.12", default-features = false, features = ["rlp"] }
primitive-types = { version = "0.13", default-features = false, features = ["rlp"] }
sha3 = { version = "0.10", default-features = false }

evm-interpreter = { version = "1.0.0-dev", path = "interpreter", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ description = "The interpreter part of Ethereum Virtual Machine"
[dependencies]
auto_impl = "1.2"
paste = "1.0"
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 }
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 interpreter/src/error/trap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,7 @@ impl CallTrapData {
&retbuf[..],
) {
Ok(()) => {
let mut value = H256::default();
U256::one().to_big_endian(&mut value[..]);
let value = H256::from(U256::one().to_big_endian());
interpreter.machine_mut().stack.push(value)?;

Ok(())
Expand Down
3 changes: 1 addition & 2 deletions interpreter/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.stack.push(value) {
Ok(()) => (),
Err(e) => return Control::Exit(e.into()),
Expand Down
19 changes: 8 additions & 11 deletions interpreter/src/eval/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,13 @@ pub fn caller<S: AsRef<RuntimeState>, Tr>(machine: &mut Machine<S>) -> Control<T
}

pub fn callvalue<S: AsRef<RuntimeState>, Tr>(machine: &mut Machine<S>) -> Control<Tr> {
let mut ret = H256::default();
machine
let ret = machine
.state
.as_ref()
.context
.apparent_value
.to_big_endian(&mut ret[..]);
push!(machine, ret);
.to_big_endian();
push!(machine, H256::from(ret));

Control::Continue
}
Expand All @@ -101,14 +100,13 @@ pub fn gasprice<S: AsRef<RuntimeState>, H: RuntimeEnvironment + RuntimeBackend,
machine: &mut Machine<S>,
_handler: &H,
) -> Control<Tr> {
let mut ret = H256::default();
machine
let ret = machine
.state
.as_ref()
.transaction_context
.gas_price
.to_big_endian(&mut ret[..]);
push!(machine, ret);
.to_big_endian();
push!(machine, H256::from(ret));

Control::Continue
}
Expand All @@ -117,9 +115,8 @@ pub fn basefee<S: AsRef<RuntimeState>, H: RuntimeEnvironment + RuntimeBackend, T
machine: &mut Machine<S>,
handler: &H,
) -> Control<Tr> {
let mut ret = H256::default();
handler.block_base_fee_per_gas().to_big_endian(&mut ret[..]);
push!(machine, ret);
let ret = handler.block_base_fee_per_gas().to_big_endian();
push!(machine, H256::from(ret));

Control::Continue
}
Expand Down
4 changes: 1 addition & 3 deletions interpreter/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ use crate::error::{ExitError, ExitFatal};
/// Convert [U256] into [H256].
#[must_use]
pub fn u256_to_h256(v: U256) -> H256 {
let mut r = H256::default();
v.to_big_endian(&mut r[..]);
r
H256::from(v.to_big_endian())
}

/// Convert [H256] to [U256].
Expand Down
6 changes: 3 additions & 3 deletions jsontests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ keywords = { workspace = true }

[dependencies]
clap = { version = "4", features = ["derive"] }
ethereum = "0.15.0"
ethereum = { git = "https://github.com/OpenZeppelin/ethereum.git", branch = "master" }
evm = { path = ".." }
evm-precompile = { path = "../precompile" }
hex = { version = "0.4", features = ["serde"] }
primitive-types = { version = "0.12", features = ["rlp", "serde"] }
rlp = "0.5"
primitive-types = { version = "0.13", features = ["rlp", "serde"] }
rlp = "0.6"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
sha3 = "0.10"
Expand Down
2 changes: 1 addition & 1 deletion precompile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bn = { package = "substrate-bn", version = "0.6", default-features = false }
evm = { path = "..", default-features = false }
k256 = { version = "0.13", features = ["ecdsa"], default-features = false }
num = { version = "0.4", default-features = false, features = ["alloc"] }
primitive-types = { version = "0.12", default-features = false, features = ["rlp"] }
primitive-types = { version = "0.13", default-features = false, features = ["rlp"] }
ripemd = { version = "0.1", default-features = false }
sha2 = { version = "0.10", default-features = false }
sha3 = { version = "0.10", default-features = false }
Expand Down
3 changes: 1 addition & 2 deletions precompile/src/bn128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ impl<G: GasMutState> PurePrecompile<G> for Bn128Pairing {
}
};

let mut buf = [0u8; 32];
ret_val.to_big_endian(&mut buf);
let buf = ret_val.to_big_endian();

(ExitSucceed::Returned.into(), buf.to_vec())
}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "1.75.0"
channel = "1.81.0"
profile = "minimal"
components = [ "rustfmt", "clippy" ]
1 change: 1 addition & 0 deletions src/standard/invoker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub trait IntoCallCreateTrap {
type Interrupt;

/// Turn the current trap into either a call/create trap or an interrupt.
#[allow(dead_code)]
fn into_call_create_trap(self) -> Result<Opcode, Self::Interrupt>;
}

Expand Down