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

Merge branch 'main' into reintroduce-alloy-rebased #4

Merged
merged 12 commits into from
Sep 29, 2023
Merged
5 changes: 5 additions & 0 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
name: book

concurrency:
cancel-in-progress: true
group: ${{github.workflow}}-${{github.ref}}

on:
push:
branches: [main]
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Tests

concurrency:
cancel-in-progress: true
group: ${{github.workflow}}-${{github.ref}}

on:
push:
branches: [main, "release/**"]
Expand All @@ -25,6 +29,9 @@ jobs:
cache-on-failure: true

- name: cargo test
run: cargo test --workspace

- name: cargo test all features
run: cargo test --workspace --all-features

- name: cargo check no_std
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/ethereum-tests.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
name: Ethereum Tests

concurrency:
cancel-in-progress: true
group: ${{github.workflow}}-${{github.ref}}

on:
push:
branches: [main, "release/**"]
pull_request:
branches: [main, "release/**"]

name: Ethereum Tests

jobs:
tests-stable:
Expand Down
17 changes: 9 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
# revm - Rust Ethereum Virtual Machine
<img src="./assets/logo.png" height="200">
# revm

Is EVM written in the Rust that is focused on **speed** and **simplicity**. It has fast and flexible implementation with simple interface and embedded Host. It is passing all `ethereum/tests` test suits
[![CI](https://github.com/bluealloy/revm/actions/workflows/ci.yml/badge.svg)][gh-ci]
[![License](https://img.shields.io/badge/License-MIT-orange.svg)][mit-license]
[![Chat][tg-badge]][tg-url]

Here is a list of things that I would like to use as guide in this project:
[mit-license]: https://opensource.org/license/mit/
[gh-ci]: https://github.com/bluealloy/revm/actions/workflows/ci.yml
[tg-url]: https://t.me/+Ig4WDWOzikA3MzA0
[tg-badge]: https://img.shields.io/badge/chat-telegram-blue

**Rust Ethereum Virtual Machine**

![](./assets/revm-banner.png)

Revm is an EVM written in Rust that is focused on **speed** and **simplicity**.
It has a fast and flexible implementation with a simple interface and embedded Host.
It passes all `ethereum/tests` test suites.

Here is a list of guiding principles that Revm follows.
- **EVM compatibility and stability** - this goes without saying but it is nice to put it here. In the blockchain industry, stability is the most desired attribute of any system.
- **Speed** - is one of the most important things and most decisions are made to complement this.
- **Simplicity** - simplification of internals so that it can be easily understood and extended, and interface that can be easily used or integrated into other projects.
Expand Down
Binary file added assets/revm-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions crates/interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ std = ["revm-primitives/std"]
serde = ["dep:serde", "revm-primitives/serde"]
arbitrary = ["std", "revm-primitives/arbitrary"]

optimism = ["revm-primitives/optimism"]

dev = [
"memory_limit",
"optional_balance_check",
Expand Down
2 changes: 1 addition & 1 deletion crates/interpreter/src/gas/calc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ pub fn call_cost<SPEC: Spec>(
}

#[inline]
pub fn hot_cold_cost<SPEC: Spec>(is_cold: bool, regular_value: u64) -> u64 {
pub fn warm_cold_cost<SPEC: Spec>(is_cold: bool, regular_value: u64) -> u64 {
if SPEC::enabled(BERLIN) {
if is_cold {
COLD_ACCOUNT_ACCESS_COST
Expand Down
2 changes: 1 addition & 1 deletion crates/interpreter/src/host/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl Host for DummyHost {
fn tload(&mut self, _address: Address, index: U256) -> U256 {
self.transient_storage
.get(&index)
.cloned()
.copied()
.unwrap_or_default()
}

Expand Down
16 changes: 14 additions & 2 deletions crates/interpreter/src/instructions/opcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -834,12 +834,24 @@ const fn make_gas_table(spec: SpecId) -> [OpInfo; 256] {
pub const fn spec_opcode_gas(spec_id: SpecId) -> &'static [OpInfo; 256] {
macro_rules! gas_maps {
($($id:ident),* $(,)?) => {
match spec_id {$(
match spec_id {
$(
SpecId::$id => {
const TABLE: &[OpInfo; 256] = &make_gas_table(SpecId::$id);
TABLE
}
)*}
)*
#[cfg(feature = "optimism")]
SpecId::BEDROCK => {
const TABLE: &[OpInfo;256] = &make_gas_table(SpecId::BEDROCK);
TABLE
}
#[cfg(feature = "optimism")]
SpecId::REGOLITH => {
const TABLE: &[OpInfo;256] = &make_gas_table(SpecId::REGOLITH);
TABLE
}
}
};
}

Expand Down
4 changes: 3 additions & 1 deletion crates/precompile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ripemd = { version = "0.1", default-features = false }
sha2 = { version = "0.10", default-features = false }

# Optional KZG point evaluation precompile
c-kzg = { git = "https://github.com/ethereum/c-kzg-4844", default-features = false, optional = true }
c-kzg = { version = "0.1.1", default-features = false, optional = true }

# ecRecover precompile
k256 = { version = "0.13", default-features = false, features = ["ecdsa"] }
Expand All @@ -42,6 +42,8 @@ std = [
"secp256k1?/std",
]

optimism = ["revm-primitives/optimism"]

# * Enables the KZG point evaluation precompile.
c-kzg = ["dep:c-kzg", "revm-primitives/c-kzg"]

Expand Down
2 changes: 2 additions & 0 deletions crates/precompile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ impl SpecId {
BERLIN | LONDON | ARROW_GLACIER | GRAY_GLACIER | MERGE | SHANGHAI => Self::BERLIN,
CANCUN => Self::CANCUN,
LATEST => Self::LATEST,
#[cfg(feature = "optimism")]
BEDROCK | REGOLITH => Self::BERLIN,
}
}

Expand Down
4 changes: 3 additions & 1 deletion crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bitvec = { version = "1", default-features = false, features = ["alloc"] }
bitflags = { version = "2.4.0", default-features = false }

# For setting the CfgEnv KZGSettings. Enabled by std flag.
c-kzg = { git = "https://github.com/ethereum/c-kzg-4844", default-features = false, optional = true }
c-kzg = { version = "0.1.1", default-features = false, optional = true }

# utility
enumn = "0.1"
Expand All @@ -46,6 +46,8 @@ serde = [
]
arbitrary = ["std", "alloy-primitives/arbitrary", "bitflags/arbitrary"]

optimism = []

dev = [
"memory_limit",
"optional_balance_check",
Expand Down
Loading