From 8c22748b484ea2eb19d5200cc81ba7a4c3d7f8c7 Mon Sep 17 00:00:00 2001 From: rakita Date: Sun, 29 Jan 2023 22:41:15 +0100 Subject: [PATCH] revm-precompiles to revm-precompile --- Cargo.lock | 4 ++-- README.md | 2 +- crates/{precompiles => precompile}/CHANGELOG.md | 0 crates/{precompiles => precompile}/Cargo.toml | 2 +- crates/{precompiles => precompile}/LICENSE | 0 crates/{precompiles => precompile}/README.md | 0 crates/{precompiles => precompile}/src/blake2.rs | 0 crates/{precompiles => precompile}/src/bn128.rs | 0 crates/{precompiles => precompile}/src/hash.rs | 0 crates/{precompiles => precompile}/src/identity.rs | 0 crates/{precompiles => precompile}/src/lib.rs | 0 crates/{precompiles => precompile}/src/modexp.rs | 0 crates/{precompiles => precompile}/src/secp256k1.rs | 0 crates/revm/CHANGELOG.md | 4 ++-- crates/revm/Cargo.toml | 4 ++-- crates/revm/src/evm.rs | 12 ++++++------ crates/revm/src/evm_impl.rs | 6 +++--- crates/revm/src/lib.rs | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) rename crates/{precompiles => precompile}/CHANGELOG.md (100%) rename crates/{precompiles => precompile}/Cargo.toml (98%) rename crates/{precompiles => precompile}/LICENSE (100%) rename crates/{precompiles => precompile}/README.md (100%) rename crates/{precompiles => precompile}/src/blake2.rs (100%) rename crates/{precompiles => precompile}/src/bn128.rs (100%) rename crates/{precompiles => precompile}/src/hash.rs (100%) rename crates/{precompiles => precompile}/src/identity.rs (100%) rename crates/{precompiles => precompile}/src/lib.rs (100%) rename crates/{precompiles => precompile}/src/modexp.rs (100%) rename crates/{precompiles => precompile}/src/secp256k1.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 2b81e4e5a0..2c466285bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1577,7 +1577,7 @@ dependencies = [ "futures", "hex-literal", "revm-interpreter", - "revm-precompiles", + "revm-precompile", "serde", "tokio", ] @@ -1597,7 +1597,7 @@ dependencies = [ ] [[package]] -name = "revm-precompiles" +name = "revm-precompile" version = "2.0.0" dependencies = [ "hex", diff --git a/README.md b/README.md index 60948e047d..76f5b0f1e3 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ structure: * revm -> main EVM library. * revm-primitives -> Primitive data types. * revm-interpreter -> Execution loop with instructions - * revm-precompiles -> EVM precompiles + * revm-precompile -> EVM precompiles * bins: * revme: cli binary, used for running state test json * revm-test: test binaries with contracts, used mostly to check performance diff --git a/crates/precompiles/CHANGELOG.md b/crates/precompile/CHANGELOG.md similarity index 100% rename from crates/precompiles/CHANGELOG.md rename to crates/precompile/CHANGELOG.md diff --git a/crates/precompiles/Cargo.toml b/crates/precompile/Cargo.toml similarity index 98% rename from crates/precompiles/Cargo.toml rename to crates/precompile/Cargo.toml index 19e5436a5b..cb1e268718 100644 --- a/crates/precompiles/Cargo.toml +++ b/crates/precompile/Cargo.toml @@ -4,7 +4,7 @@ description = "REVM Precompiles - Ethereum compatible precompiled contracts" edition = "2021" keywords = ["no_std", "ethereum", "evm", "revm", "precompiles"] license = "MIT" -name = "revm-precompiles" +name = "revm-precompile" repository = "https://github.com/bluealloy/revm" version = "2.0.0" diff --git a/crates/precompiles/LICENSE b/crates/precompile/LICENSE similarity index 100% rename from crates/precompiles/LICENSE rename to crates/precompile/LICENSE diff --git a/crates/precompiles/README.md b/crates/precompile/README.md similarity index 100% rename from crates/precompiles/README.md rename to crates/precompile/README.md diff --git a/crates/precompiles/src/blake2.rs b/crates/precompile/src/blake2.rs similarity index 100% rename from crates/precompiles/src/blake2.rs rename to crates/precompile/src/blake2.rs diff --git a/crates/precompiles/src/bn128.rs b/crates/precompile/src/bn128.rs similarity index 100% rename from crates/precompiles/src/bn128.rs rename to crates/precompile/src/bn128.rs diff --git a/crates/precompiles/src/hash.rs b/crates/precompile/src/hash.rs similarity index 100% rename from crates/precompiles/src/hash.rs rename to crates/precompile/src/hash.rs diff --git a/crates/precompiles/src/identity.rs b/crates/precompile/src/identity.rs similarity index 100% rename from crates/precompiles/src/identity.rs rename to crates/precompile/src/identity.rs diff --git a/crates/precompiles/src/lib.rs b/crates/precompile/src/lib.rs similarity index 100% rename from crates/precompiles/src/lib.rs rename to crates/precompile/src/lib.rs diff --git a/crates/precompiles/src/modexp.rs b/crates/precompile/src/modexp.rs similarity index 100% rename from crates/precompiles/src/modexp.rs rename to crates/precompile/src/modexp.rs diff --git a/crates/precompiles/src/secp256k1.rs b/crates/precompile/src/secp256k1.rs similarity index 100% rename from crates/precompiles/src/secp256k1.rs rename to crates/precompile/src/secp256k1.rs diff --git a/crates/revm/CHANGELOG.md b/crates/revm/CHANGELOG.md index ea342af5e7..4492bbf612 100644 --- a/crates/revm/CHANGELOG.md +++ b/crates/revm/CHANGELOG.md @@ -2,12 +2,12 @@ date 29.01.2022 This is big release that has core changes that breaks compatibility. In summary: -* Project is refactored into `revm-primitives`,`revm-precompiles`,`revm-interpreter` and `revm` to have more flexibility and separation of concerns. And include paths in revm reflect that. So try to find include as `revm::primitives` or `revm::interpreter` +* Project is refactored into `revm-primitives`,`revm-precompile`,`revm-interpreter` and `revm` to have more flexibility and separation of concerns. And include paths in revm reflect that. So try to find include as `revm::primitives` or `revm::interpreter` * Parity `primitive-types` was replaced with `ruint` for big numbers and subset of macros are used for native `B160`/`B256` types. * Interpreter instructions are unified and now all of them have same signature. * web3 db was replaces with ethers alternative. * revmjs lib was removed from crates. -* `revm_precompile` was renamed to `revm-precompile.` +* `revm_precompiles` was renamed to `revm-precompile.` * Return types are made to have more insight of what have happened inside revm. * Snailtracer benchmark got around 20% faster. diff --git a/crates/revm/Cargo.toml b/crates/revm/Cargo.toml index 1d428f5e5e..300e9d47ee 100644 --- a/crates/revm/Cargo.toml +++ b/crates/revm/Cargo.toml @@ -10,7 +10,7 @@ version = "3.0.0" readme = "../../README.md" [dependencies] -revm-precompiles = { path = "../precompiles", version = "2.0.0", default-features = false } +revm-precompile = { path = "../precompile", version = "2.0.0", default-features = false } revm-interpreter = { path = "../interpreter", version = "1.0.0", default-features = false } auto_impl = { version = "1.0", default-features = false } @@ -40,7 +40,7 @@ dev = [ "optional_eip3607", "optional_gas_refund", ] -secp256k1 = ["revm-precompiles/secp256k1"] +secp256k1 = ["revm-precompile/secp256k1"] memory_limit = ["revm-interpreter/memory_limit"] no_gas_measuring = ["revm-interpreter/no_gas_measuring"] optional_balance_check = ["revm-interpreter/optional_balance_check"] diff --git a/crates/revm/src/evm.rs b/crates/revm/src/evm.rs index 2a10d426b8..d140c822a4 100644 --- a/crates/revm/src/evm.rs +++ b/crates/revm/src/evm.rs @@ -7,7 +7,7 @@ use crate::{ }; use alloc::boxed::Box; use revm_interpreter::primitives::ResultAndState; -use revm_precompiles::Precompiles; +use revm_precompile::Precompiles; /// Struct that takes Database and enabled transact to update state directly to database. /// additionally it allows user to set all environment parameters. @@ -150,25 +150,25 @@ macro_rules! create_evm { }; } -pub fn to_precompile_id(spec_id: SpecId) -> revm_precompiles::SpecId { +pub fn to_precompile_id(spec_id: SpecId) -> revm_precompile::SpecId { match spec_id { SpecId::FRONTIER | SpecId::FRONTIER_THAWING | SpecId::HOMESTEAD | SpecId::DAO_FORK | SpecId::TANGERINE - | SpecId::SPURIOUS_DRAGON => revm_precompiles::SpecId::HOMESTEAD, + | SpecId::SPURIOUS_DRAGON => revm_precompile::SpecId::HOMESTEAD, SpecId::BYZANTIUM | SpecId::CONSTANTINOPLE | SpecId::PETERSBURG => { - revm_precompiles::SpecId::BYZANTIUM + revm_precompile::SpecId::BYZANTIUM } - SpecId::ISTANBUL | SpecId::MUIR_GLACIER => revm_precompiles::SpecId::ISTANBUL, + SpecId::ISTANBUL | SpecId::MUIR_GLACIER => revm_precompile::SpecId::ISTANBUL, SpecId::BERLIN | SpecId::LONDON | SpecId::ARROW_GLACIER | SpecId::GRAY_GLACIER | SpecId::MERGE | SpecId::MERGE_EOF - | SpecId::LATEST => revm_precompiles::SpecId::BERLIN, + | SpecId::LATEST => revm_precompile::SpecId::BERLIN, } } diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index 6c23e196ae..a65349800a 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -10,10 +10,10 @@ use crate::primitives::{ SpecId::{self, *}, TransactTo, B160, B256, KECCAK_EMPTY, U256, }; -use crate::{db::Database, journaled_state::JournaledState, precompiles, Inspector}; +use crate::{db::Database, journaled_state::JournaledState, precompile, Inspector}; use alloc::vec::Vec; use core::{cmp::min, marker::PhantomData}; -use revm_precompiles::{Precompile, Precompiles}; +use revm_precompile::{Precompile, Precompiles}; pub struct EVMData<'a, DB: Database> { pub env: &'a mut Env, @@ -701,7 +701,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, } } Err(e) => { - let ret = if let precompiles::Error::OutOfGas = e { + let ret = if let precompile::Error::OutOfGas = e { InstructionResult::OutOfGas } else { InstructionResult::PrecompileError diff --git a/crates/revm/src/lib.rs b/crates/revm/src/lib.rs index 2d45a526f6..c338bd251c 100644 --- a/crates/revm/src/lib.rs +++ b/crates/revm/src/lib.rs @@ -20,7 +20,7 @@ pub use journaled_state::{JournalEntry, JournaledState}; extern crate alloc; /// reexport `revm_precompiles` -pub use revm_precompiles as precompiles; +pub use revm_precompile as precompile; // reexport `revm_interpreter` pub use revm_interpreter as interpreter;