forked from bluealloy/revm
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: EOF (Ethereum Object Format) (bluealloy#1143)
* eof * feat(EOF): Header decoder * EofBody decode * disable eof deprecated opcodes * add eof instructions * temp tests * rjump instructions * eof rjump with tests * EOF bytecode * callf, retf, jumpf * tests for callf,retf,jumpf * small rename * add dataload, dataloadn and datacopy opcodes * refactor calls * blueprint for creates * eof create inputs * some wip * add eofcreate structs and exccall flow * wip eofcreate code flow and handlers * fix tests * eof creates * refactor eofcreate a little * some work on extcall * feat: refactor simplify CallInput, eof extcalls * feat: restructure OpCode and add stack input/output num * add flags for stack_io and not_eof * wip eof verification * wip validation * EOF Bytecode validity * insturction and jump validation seems good * merged eof validate function * EOP test runner, fex fixes * RETURNDATALOAD, fix call bugs, refactor gas warm/cold calc * debug session, rjumpv imm fix * fixing validation bugs, bytecode decoder for EOF in revme * pass most of validation tests * bounds check moved to decode * Fix merge compilation, fmt * TXCREATE work * remove training wheels, panic on eof * test fix and std * std * fix test * fix valgrind * fix tests * clippy * removed checked logic * small change * no std revm-test * check pending TODOs * build check no_std * doc * chore: move some files. cleanup comments * fix fmt,clippy and compile error
- Loading branch information
Showing
190 changed files
with
23,572 additions
and
1,101 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use revm::{ | ||
interpreter::opcode::eof_printer::print_eof_code, | ||
primitives::{Bytes, Eof}, | ||
}; | ||
use structopt::StructOpt; | ||
|
||
/// Statetest command | ||
#[derive(StructOpt, Debug)] | ||
pub struct Cmd { | ||
/// EOF bytecode in hex format. It bytes start with 0xFE it will be interpreted as a EOF. | ||
/// Otherwise, it will be interpreted as a EOF bytecode. | ||
#[structopt(required = true)] | ||
bytes: String, | ||
} | ||
|
||
impl Cmd { | ||
/// Run statetest command. | ||
pub fn run(&self) { | ||
let trimmed = self.bytes.trim_start_matches("0x"); | ||
let Ok(bytes) = hex::decode(trimmed) else { | ||
eprintln!("Invalid hex string"); | ||
return; | ||
}; | ||
let bytes: Bytes = bytes.into(); | ||
if bytes.is_empty() { | ||
eprintln!("Empty hex string"); | ||
return; | ||
} | ||
if bytes[0] == 0xEF { | ||
let Ok(eof) = Eof::decode(bytes) else { | ||
eprintln!("Invalid EOF bytecode"); | ||
return; | ||
}; | ||
println!("{:#?}", eof); | ||
} else { | ||
print_eof_code(&bytes) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.