Skip to content
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

chore(deps): bump revm 18 #65

Merged
merged 2 commits into from
Nov 21, 2024
Merged
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
672 changes: 328 additions & 344 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ revmc-cranelift = { version = "0.1.0", path = "crates/revmc-cranelift", default-
revmc-llvm = { version = "0.1.0", path = "crates/revmc-llvm", default-features = false }

alloy-primitives = { version = "0.8", default-features = false }
revm = { version = "14.0", default-features = false }
revm-primitives = { version = "9.0", default-features = false }
revm-interpreter = { version = "10.0", default-features = false }
revm = { version = "18.0", default-features = false }
revm-primitives = { version = "14.0", default-features = false }
revm-interpreter = { version = "14.0", default-features = false }
ruint = { version = "1.12", default-features = false }

color-eyre = "0.6"
Expand Down
2 changes: 1 addition & 1 deletion crates/revmc-cli/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use revmc::{llvm, EvmCompiler, EvmCompilerFn, EvmContext, EvmLlvmBackend, EvmSta
use revmc_cli::Bench;
use std::time::Duration;

const SPEC_ID: SpecId = SpecId::PRAGUE_EOF;
const SPEC_ID: SpecId = SpecId::OSAKA;

fn bench(c: &mut Criterion) {
for bench in &revmc_cli::get_benches() {
Expand Down
4 changes: 2 additions & 2 deletions crates/revmc-cli/benches/iai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn setup_group(group: &mut BinaryBenchmarkGroup) {
args.push("1");
// args.extend(["1", "--shared-library", so.to_str().unwrap()]);
}
let mut bench = Bench::new(name);
let mut bench = Bench::new(name.replace('-', "_"));
bench.command(Command::new(CMD).args(&args)).config(BinaryBenchmarkConfig::default());

if !is_ct {
Expand Down Expand Up @@ -53,7 +53,7 @@ fn setup_group(group: &mut BinaryBenchmarkGroup) {
("fibonacci", true),
("counter", true),
("hash_10k", true),
("hash_10k-eof", true),
// ("hash_10k-eof", true),
("bswap64", true),
("usdc_proxy", false),
("weth", false),
Expand Down
10 changes: 5 additions & 5 deletions crates/revmc-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ struct Cli {
out_dir: Option<PathBuf>,
#[arg(short = 'O', long, default_value = "3")]
opt_level: OptimizationLevel,
#[arg(long, value_enum, default_value = "pragueeof")]
#[arg(long, value_enum, default_value = "osaka")]
spec_id: SpecIdValueEnum,
/// Short-hand for `--spec-id pragueeof`.
/// Short-hand for `--spec-id osaka`.
#[arg(long, conflicts_with = "spec_id")]
eof: bool,
/// Skip validating EOF code.
Expand Down Expand Up @@ -155,7 +155,7 @@ fn main() -> Result<()> {

let bytecode = contract.bytecode.original_byte_slice();

let spec_id = if cli.eof { SpecId::PRAGUE_EOF } else { cli.spec_id.into() };
let spec_id = if cli.eof { SpecId::OSAKA } else { cli.spec_id.into() };
if !stack_input.is_empty() {
compiler.inspect_stack_length(true);
}
Expand Down Expand Up @@ -300,7 +300,7 @@ pub enum SpecIdValueEnum {
SHANGHAI,
CANCUN,
PRAGUE,
PRAGUE_EOF,
OSAKA,
LATEST,
}

Expand All @@ -326,7 +326,7 @@ impl From<SpecIdValueEnum> for SpecId {
SpecIdValueEnum::SHANGHAI => Self::SHANGHAI,
SpecIdValueEnum::CANCUN => Self::CANCUN,
SpecIdValueEnum::PRAGUE => Self::PRAGUE,
SpecIdValueEnum::PRAGUE_EOF => Self::PRAGUE_EOF,
SpecIdValueEnum::OSAKA => Self::OSAKA,
SpecIdValueEnum::LATEST => Self::LATEST,
}
}
Expand Down
10 changes: 5 additions & 5 deletions crates/revmc-cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ workspace = true
[dependencies]
revmc-backend.workspace = true

cranelift = "0.109"
cranelift-jit = "0.109"
cranelift-module = "0.109"
cranelift-native = "0.109"
cranelift-object = "0.109"
cranelift = "0.114"
cranelift-jit = "0.114"
cranelift-module = "0.114"
cranelift-native = "0.114"
cranelift-object = "0.114"
6 changes: 3 additions & 3 deletions crates/revmc-cranelift/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,15 @@ pub struct EvmCraneliftBuilder<'a> {
symbols: Symbols,
}

impl<'a> BackendTypes for EvmCraneliftBuilder<'a> {
impl BackendTypes for EvmCraneliftBuilder<'_> {
type Type = <EvmCraneliftBackend as BackendTypes>::Type;
type Value = <EvmCraneliftBackend as BackendTypes>::Value;
type StackSlot = <EvmCraneliftBackend as BackendTypes>::StackSlot;
type BasicBlock = <EvmCraneliftBackend as BackendTypes>::BasicBlock;
type Function = <EvmCraneliftBackend as BackendTypes>::Function;
}

impl<'a> TypeMethods for EvmCraneliftBuilder<'a> {
impl TypeMethods for EvmCraneliftBuilder<'_> {
fn type_ptr(&self) -> Self::Type {
self.ptr_type
}
Expand Down Expand Up @@ -736,7 +736,7 @@ impl<'a> Builder for EvmCraneliftBuilder<'a> {
}

fn unreachable(&mut self) {
self.bcx.ins().trap(TrapCode::UnreachableCodeReached);
self.bcx.ins().trap(TrapCode::user(0).unwrap());
}

fn get_or_build_function(
Expand Down
19 changes: 11 additions & 8 deletions crates/revmc-llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ impl<'ctx> BackendTypes for EvmLlvmBackend<'ctx> {
type Function = FunctionValue<'ctx>;
}

impl<'ctx> TypeMethods for EvmLlvmBackend<'ctx> {
impl TypeMethods for EvmLlvmBackend<'_> {
fn type_ptr(&self) -> Self::Type {
self.ty_ptr.into()
}
Expand Down Expand Up @@ -251,7 +251,10 @@ impl<'ctx> TypeMethods for EvmLlvmBackend<'ctx> {
}

impl<'ctx> Backend for EvmLlvmBackend<'ctx> {
type Builder<'a> = EvmLlvmBuilder<'a, 'ctx> where Self: 'a;
type Builder<'a>
= EvmLlvmBuilder<'a, 'ctx>
where
Self: 'a;
type FuncId = u32;

fn ir_extension(&self) -> &'static str {
Expand Down Expand Up @@ -443,7 +446,7 @@ pub struct EvmLlvmBuilder<'a, 'ctx> {
function: FunctionValue<'ctx>,
}

impl<'a, 'ctx> std::ops::Deref for EvmLlvmBuilder<'a, 'ctx> {
impl<'ctx> std::ops::Deref for EvmLlvmBuilder<'_, 'ctx> {
type Target = EvmLlvmBackend<'ctx>;

#[inline]
Expand All @@ -452,14 +455,14 @@ impl<'a, 'ctx> std::ops::Deref for EvmLlvmBuilder<'a, 'ctx> {
}
}

impl<'a, 'ctx> std::ops::DerefMut for EvmLlvmBuilder<'a, 'ctx> {
impl std::ops::DerefMut for EvmLlvmBuilder<'_, '_> {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
self.backend
}
}

impl<'a, 'ctx> EvmLlvmBuilder<'a, 'ctx> {
impl<'ctx> EvmLlvmBuilder<'_, 'ctx> {
#[allow(dead_code)]
fn extract_value(
&mut self,
Expand Down Expand Up @@ -561,15 +564,15 @@ impl<'a, 'ctx> EvmLlvmBuilder<'a, 'ctx> {
}
}

impl<'a, 'ctx> BackendTypes for EvmLlvmBuilder<'a, 'ctx> {
impl<'ctx> BackendTypes for EvmLlvmBuilder<'_, 'ctx> {
type Type = <EvmLlvmBackend<'ctx> as BackendTypes>::Type;
type Value = <EvmLlvmBackend<'ctx> as BackendTypes>::Value;
type StackSlot = <EvmLlvmBackend<'ctx> as BackendTypes>::StackSlot;
type BasicBlock = <EvmLlvmBackend<'ctx> as BackendTypes>::BasicBlock;
type Function = <EvmLlvmBackend<'ctx> as BackendTypes>::Function;
}

impl<'a, 'ctx> TypeMethods for EvmLlvmBuilder<'a, 'ctx> {
impl TypeMethods for EvmLlvmBuilder<'_, '_> {
fn type_ptr(&self) -> Self::Type {
self.backend.type_ptr()
}
Expand All @@ -591,7 +594,7 @@ impl<'a, 'ctx> TypeMethods for EvmLlvmBuilder<'a, 'ctx> {
}
}

impl<'a, 'ctx> Builder for EvmLlvmBuilder<'a, 'ctx> {
impl Builder for EvmLlvmBuilder<'_, '_> {
fn create_block(&mut self, name: &str) -> Self::BasicBlock {
self.cx.append_basic_block(self.function, name)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/revmc-llvm/src/orc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ pub struct ExecutionSessionRef<'ee> {
_marker: PhantomData<&'ee ()>,
}

impl<'ee> ExecutionSessionRef<'ee> {
impl ExecutionSessionRef<'_> {
/// Wraps a raw pointer.
pub unsafe fn from_inner(es: LLVMOrcExecutionSessionRef) -> Self {
Self { es, _marker: PhantomData }
Expand Down
38 changes: 19 additions & 19 deletions crates/revmc/src/bytecode/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,10 @@ const fn make_map(spec_id: SpecId) -> [OpcodeInfo; 256] {
// 0xCD
// 0xCE
// 0xCF
DATALOAD = 4 | EOF, if PRAGUE_EOF;
DATALOADN = 3 | EOF, if PRAGUE_EOF;
DATASIZE = 2 | EOF, if PRAGUE_EOF;
DATACOPY = 3 | DYNAMIC | EOF, if PRAGUE_EOF; // [2]
DATALOAD = 4 | EOF, if OSAKA;
DATALOADN = 3 | EOF, if OSAKA;
DATASIZE = 2 | EOF, if OSAKA;
DATACOPY = 3 | DYNAMIC | EOF, if OSAKA; // [2]
// 0xD4
// 0xD5
// 0xD6
Expand All @@ -353,21 +353,21 @@ const fn make_map(spec_id: SpecId) -> [OpcodeInfo; 256] {
// 0xDD
// 0xDE
// 0xDF
RJUMP = 2 | EOF, if PRAGUE_EOF;
RJUMPI = 4 | EOF, if PRAGUE_EOF;
RJUMPV = 4 | EOF, if PRAGUE_EOF;
CALLF = 5 | EOF, if PRAGUE_EOF;
RETF = 3 | EOF, if PRAGUE_EOF;
JUMPF = 5 | EOF, if PRAGUE_EOF;
DUPN = 3 | EOF, if PRAGUE_EOF;
SWAPN = 3 | EOF, if PRAGUE_EOF;
EXCHANGE = 3 | EOF, if PRAGUE_EOF;
RJUMP = 2 | EOF, if OSAKA;
RJUMPI = 4 | EOF, if OSAKA;
RJUMPV = 4 | EOF, if OSAKA;
CALLF = 5 | EOF, if OSAKA;
RETF = 3 | EOF, if OSAKA;
JUMPF = 5 | EOF, if OSAKA;
DUPN = 3 | EOF, if OSAKA;
SWAPN = 3 | EOF, if OSAKA;
EXCHANGE = 3 | EOF, if OSAKA;
// 0xE9
// 0xEA
// 0xEB
EOFCREATE = DYNAMIC | EOF, if PRAGUE_EOF; // TODO: EOF_CREATE_GAS | DYNAMIC is too big
EOFCREATE = DYNAMIC | EOF, if OSAKA; // TODO: EOF_CREATE_GAS | DYNAMIC is too big
// 0xED
RETURNCONTRACT = DYNAMIC | EOF, if PRAGUE_EOF;
RETURNCONTRACT = DYNAMIC | EOF, if OSAKA;
// 0xEF
CREATE = DYNAMIC;
CALL = DYNAMIC;
Expand All @@ -376,11 +376,11 @@ const fn make_map(spec_id: SpecId) -> [OpcodeInfo; 256] {
DELEGATECALL = DYNAMIC, if HOMESTEAD;
CREATE2 = DYNAMIC, if PETERSBURG;
// 0xF6
RETURNDATALOAD = 3 | EOF, if PRAGUE_EOF;
EXTCALL = DYNAMIC | EOF, if PRAGUE_EOF;
EXTDELEGATECALL = DYNAMIC | EOF, if PRAGUE_EOF;
RETURNDATALOAD = 3 | EOF, if OSAKA;
EXTCALL = DYNAMIC | EOF, if OSAKA;
EXTDELEGATECALL = DYNAMIC | EOF, if OSAKA;
STATICCALL = DYNAMIC, if BYZANTIUM;
EXTSTATICCALL = DYNAMIC | EOF, if PRAGUE_EOF;
EXTSTATICCALL = DYNAMIC | EOF, if OSAKA;
// 0xFC
REVERT = DYNAMIC, if BYZANTIUM;
INVALID = 0;
Expand Down
2 changes: 1 addition & 1 deletion crates/revmc/src/bytecode/opcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ pub fn format_bytecode_to<W: fmt::Write + ?Sized>(
spec_id: SpecId,
w: &mut W,
) -> fmt::Result {
if spec_id.is_enabled_in(SpecId::PRAGUE_EOF) && bytecode.starts_with(&EOF_MAGIC_BYTES) {
if spec_id.is_enabled_in(SpecId::OSAKA) && bytecode.starts_with(&EOF_MAGIC_BYTES) {
write!(w, "{:#?}", Eof::decode(Bytes::copy_from_slice(bytecode)))
} else {
write!(w, "{}", OpcodesIter::new(bytecode, spec_id))
Expand Down
2 changes: 1 addition & 1 deletion crates/revmc/src/compiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ impl<B: Backend> EvmCompiler<B> {
match input {
EvmCompilerInput::Code(code) => {
bytecode = code;
if spec_id.is_enabled_in(SpecId::PRAGUE_EOF) && code.starts_with(&EOF_MAGIC_BYTES) {
if spec_id.is_enabled_in(SpecId::OSAKA) && code.starts_with(&EOF_MAGIC_BYTES) {
eof = Some(Cow::Owned(Eof::decode(Bytes::copy_from_slice(code))?));
} else {
eof = None;
Expand Down
4 changes: 2 additions & 2 deletions crates/revmc/src/compiler/translate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ impl<'a, B: Backend> FunctionCx<'a, B> {
self.bcx.switch_to_block(entry_block);

let is_eof = self.bytecode.is_eof();
let is_eof_enabled = self.bytecode.spec_id.is_enabled_in(SpecId::PRAGUE_EOF);
let is_eof_enabled = self.bytecode.spec_id.is_enabled_in(SpecId::OSAKA);
if is_eof {
ensure!(is_eof_enabled, "EOF bytecode in non-EOF spec");
}
Expand Down Expand Up @@ -1752,7 +1752,7 @@ impl<'a, B: Backend> FunctionCx<'a, B> {
}

/// IR builtins.
impl<'a, B: Backend> FunctionCx<'a, B> {
impl<B: Backend> FunctionCx<'_, B> {
fn call_byte(&mut self, index: B::Value, value: B::Value) -> B::Value {
self.call_ir_binop_builtin("byte", index, value, Self::build_byte)
}
Expand Down
Loading
Loading