Skip to content

Commit

Permalink
Bump versions, Changelogs, fmt, revm readme, clippy.
Browse files Browse the repository at this point in the history
  • Loading branch information
rakita committed Dec 18, 2021
1 parent a43e652 commit b718a54
Show file tree
Hide file tree
Showing 32 changed files with 159 additions and 594 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
Because this is workspace with multi libraries tags will be simplified, and with this document you can match version of project with git tag.

# v3 tag
revm: v1.0.0
revme: v0.1.0

# v2 tag
revm: v0.5.0
revm_precomiles: v0.3.0
# v1 tag

# v1 tag
revm: v0.4.0
revm_precompiles: v0.2.0
revmjs: v0.1.0
67 changes: 53 additions & 14 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion bins/revm-merkle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ rlp = { version = "0.5", default-features = false }
triehash = "0.8"
hash-db = "0.15"
plain_hasher = "0.2"
sha3 = { version = "0.9", default-features = false}
sha3 = { version = "0.10", default-features = false}
2 changes: 0 additions & 2 deletions bins/revm-merkle/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ use serde::{

use std::collections::HashMap;

use serde_derive::*;

#[derive(Clone, Debug, PartialEq, Deserialize)]
#[serde(deny_unknown_fields)]
#[serde(rename_all = "camelCase")]
Expand Down
6 changes: 3 additions & 3 deletions bins/revm-test/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::{str::FromStr, time::Instant};

use bytes::Bytes;
use primitive_types::{H160, U256};
use primitive_types::H160;
use revm::{
db::{BenchmarkDB, EmptyDB},
AccountInfo, InMemoryDB, TransactTo, KECCAK_EMPTY,
db::{BenchmarkDB},
TransactTo,
};

extern crate alloc;
Expand Down
4 changes: 4 additions & 0 deletions bins/revme/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# v0.1.0
date: 18.12.2021

Initial release. statetest are done, other things I have just started working on.
9 changes: 6 additions & 3 deletions bins/revme/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[package]
authors = ["Dragan Rakita <[email protected]>"]
edition = "2018"
name = "revme"

keywords = ["ethereum", "evm"]
license = "MIT"
repository = "https://github.com/bluealloy/revm"
description = "Rust Ethereum Virtual Machine Executable"
version = "0.1.0"

Expand All @@ -15,12 +18,12 @@ indicatif = "0.16"
plain_hasher = "0.2"
primitive-types = {version = "0.10", features = ["rlp", "serde"]}

revm = {path="../../crates/revm", features = ["web3db"]}
revm = {path="../../crates/revm", version="1.0", features = ["web3db"]}
rlp = {version = "0.5", default-features = false}
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
sha3 = {version = "0.9", default-features = false}
sha3 = {version = "0.10", default-features = false}
thiserror = "1.0"
triehash = "0.8"
walkdir = "2.3"
Expand Down
21 changes: 21 additions & 0 deletions bins/revme/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 draganrakita

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 5 additions & 6 deletions bins/revme/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
# Rust EVM executor or short REVME

It is still work in progress and it is published for only reason to take cargo name.

This is binary crate that executed evm multiple ways. Currently there are three parts:
* statetest: takes path to folder where ethereum statetest json can be found. It recursivly search for all json files and execute them. This is how i run all https://github.com/ethereum/tests to check if revm is compliant. Example `revme statests test/GenericEvmTest/`
* debug (WIP):
* (WIP) Interactive debugger with ability to change any parametar of EVM in runtime, specify breakpoints and do everything what you expect from debugger.
* Allow inserting accounts,balances,storages.
* (WIP) Allow inserting accounts,balances,storages.
* Specify web3 interface to bind database, for example use infura with option `--web infura_link`.
* (WIP) revert opcode implemented in EVM we can enable `rewind` of contract call so that you can go to start of contract call and start debugging again. We could even add `rewind opcode` besically rewind call and rerun it until program counter matches.
* (TODO) Specify EVM environment from file or from cli.
* run (TODO): Intention is to be able to specify contract bytes and input and run it. It is useful for testing and benchmarks


This can be very interesting, it gives you ability to step, modify stack/memory, set breakpoints and do everything what you would expect from standard debugger, with addition of rewinding step and contract calls. You can connect to exteranl web3 supported API and fetch for example live state from mainnet via infura, or you can set data local manupulation, either way this should be useful.
It is still WIP,but debugger can be very interesting, it gives you ability to step, modify stack/memory, set breakpoints and do everything what you would expect from standard debugger, with addition of rewinding step and contract calls. You can connect to exteranl web3 supported API and fetch for example live state from mainnet via infura, or you can set data local manupulation, either way this should be useful.

This binary will be console based and interaction will be done via console inputs, this is great showcase this is first step.

commands:
Example of commands WIP:
* `help` :)
* `step`
* `continue`
Expand All @@ -39,6 +40,4 @@ commands:
* `account <address> nonce <new_nonce>`
* `storage <index>`
* `storage set <index> <value>`
* `...`

what to do with cold/hot access, do we add clear hot command?
* `...`
2 changes: 1 addition & 1 deletion bins/revme/src/statetest/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn find_all_json_tests(path: &PathBuf) -> Vec<PathBuf> {
}

pub fn execute_test_suit(path: &PathBuf, elapsed: &Arc<Mutex<Duration>>) -> Result<(), TestError> {
// funky test with bigint value in json :)
// funky test with bigint value in json :)
if path.file_name() == Some(OsStr::new("ValueOverflow.json")) {
return Ok(());
}
Expand Down
16 changes: 16 additions & 0 deletions crates/revm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
# v1.0.0
date: 18.12.2021

It feel's like that the lib is in the state that is okay to promote it to the v1 version. Other that that, a lot of optimizations are done and the inspector trait was rewritten.

Changes:
* web3 db
* precalculated gas blocks. Optimization
* PC opcode as pointer. Optimization
* U256 div_rem optimization
* Inspector refactored and it is now closer to Host interface.

Optimization thread: https://github.com/bluealloy/revm/issues/7


# v0.5.0
date: 17.11.2021

A lot of optimization on machine(interpreter) part, it is now at least 3x faster. On interface side, Error enum was renamed to Return and it is simplified. Additionally if needed gas measuring can be removed with rust feature.

Changes:
* push instruction optimized.
* mload/mstore and memory optimized
* Gas calculation optimized
Expand Down
4 changes: 2 additions & 2 deletions crates/revm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ keywords = ["no_std", "ethereum", "evm"]
license = "MIT"
name = "revm"
repository = "https://github.com/bluealloy/revm"
version = "0.5.0"
version = "1.0.0"

[dependencies]
auto_impl = {version = "0.5", default-features = false}
Expand All @@ -16,7 +16,7 @@ num_enum = {version = "0.5", default-features = false}#used for SpecId from u8 c
primitive-types = {version = "0.10", default-features = false, features = ["rlp"]}
revm_precompiles = {path = "../revm_precompiles", version = "0.3", default-features = false}
rlp = {version = "0.5", default-features = false}#used for create2 address calculation
sha3 = {version = "0.9", default-features = false}
sha3 = {version = "0.10", default-features = false}
arrayref = "0.3"
#crypto-bigint = "0.3"
zkp-u256 = "0.2.1"
Expand Down
4 changes: 2 additions & 2 deletions crates/revm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ I just started this project as a hobby to kill some time. Presenty it has good s

The structure of the project is getting crystallized and we can see few parts that are worthy to write about:
- `Spec` contains a specification of Ethereum standard. It is made as a trait so that it can be optimized away by the compiler
- `opcodes` have one main function `eval` and takes `Machine`, `EVM Host`, `Spec` and `opcode` and depending on opcode it does calculation or for various opcodes it call `Host` for subroutine handling. This is where execution happens and where we cancluate gas consumption.
- `instructions` have one main function `eval` and takes `Machine`, `EVM Host`, `Spec` and `opcode` and depending on opcode it does calculation or for various opcodes it call `Host` for subroutine handling. This is where execution happens and where we cancluate gas consumption.
- `machine` contains memory and execution stack of smart contracts. It calls opcode for execution and contains `step` function. It reads the contract, extracts opcodes and handles memory.
- `subroutine` for various calls/creates we need to have separate `machine` and separate accessed locations. This is place where all of this is done, additionaly, it contains all caches of accessed accounts/slots/code. EIP2929 related access is integrated into state memory. Getting inside new call `subroutine` creates checkpoint that contain needed information that can revert state if subcall reverts or needs to be discardet. Changeset is made so it is optimistic that means that we dont do any work if call is finished successfully and only do something when it fials.
- `EVM`- Is main entry to the lib,it implements `Host` and connects `subroutine` and `machine` and does `subroutine checkpoint` switches.
- `EVMImpl`- Is main entry to the lib,it implements `Host` and connects `subroutine` and `machine` and does `subroutine checkpoint` switches.


### Subroutine
Expand Down
Loading

0 comments on commit b718a54

Please sign in to comment.