Skip to content

Commit 0052b3b

Browse files
committed
impl ORIGIN
1 parent 8d57942 commit 0052b3b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bus-mapping/src/evm/opcodes/origin.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{
44
operation::CallContextField,
55
Error,
66
};
7-
use eth_types::GethExecStep;
7+
use eth_types::{GethExecStep, ToWord};
88

99
#[derive(Debug, Copy, Clone)]
1010
pub(crate) struct Origin;
@@ -17,7 +17,7 @@ impl Opcode for Origin {
1717
let geth_step = &geth_steps[0];
1818
let mut exec_step = state.new_step(geth_step)?;
1919
// TODO: Get origin result
20-
let value = geth_steps[1].stack.last()?;
20+
let value = state.tx.from.to_word();
2121
let tx_id = state.tx_ctx.id();
2222

2323
// CallContext read of the TxId
@@ -29,6 +29,8 @@ impl Opcode for Origin {
2929
)?;
3030

3131
// Stack write of the origin address value
32+
#[cfg(feature = "stack-check")]
33+
assert_eq!(value, geth_steps[1].stack.last()?);
3234
state.stack_push(&mut exec_step, value)?;
3335

3436
Ok(vec![exec_step])

0 commit comments

Comments
 (0)