mirror of
https://github.com/arnaucube/evm-rs.git
synced 2026-02-02 17:06:40 +01:00
Add boolean opcodes & other
- Add boolean opcodes - Add jump_dest validity check - Add tests for opcode exceptions - Update calldataload opcode logic - Add stack.peek()
This commit is contained in:
@@ -215,9 +215,29 @@ fn execute_opcodes_9() {
|
||||
let mut s = Stack::new();
|
||||
s.execute(&code, &calldata, false).unwrap();
|
||||
|
||||
assert_eq!(s.gas, 9999974988);
|
||||
// assert_eq!(s.gas, 9999977788); // TODO WIP geth reported gas
|
||||
assert_eq!(s.gas, 9999974988);
|
||||
assert_eq!(s.pc, 10);
|
||||
assert_eq!(s.stack.len(), 0);
|
||||
assert_eq!(s.storage.len(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn execute_opcodes_10() {
|
||||
let code = hex::decode(
|
||||
"606060405260e060020a6000350463a5f3c23b8114601a575b005b60243560043501600055601856",
|
||||
)
|
||||
.unwrap();
|
||||
let calldata = hex::decode("a5f3c23b00000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000004").unwrap();
|
||||
|
||||
println!("LEN {:?}", calldata.len());
|
||||
|
||||
let mut s = Stack::new();
|
||||
s.execute(&code, &calldata, true).unwrap();
|
||||
|
||||
// assert_eq!(s.gas, 9999977752); // WIP correct sstore gas computation
|
||||
assert_eq!(s.gas, 9999979852);
|
||||
assert_eq!(s.pc, 25);
|
||||
assert_eq!(s.stack.len(), 1);
|
||||
assert_eq!(s.storage.len(), 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user