Input not valid in compiler example
Closed this issue · 2 comments
pythonberg1997 commented
I'm trying to do some test, and I added these line to the end of examples/compiler/src/main.rs:
// let mut host = DummyHost::default();
let mut env = Env::default();
let actual_num = U256::from(100).saturating_sub(U256::from(1));
env.tx.data = actual_num.to_be_bytes_vec().into();
let mut host = DummyHost::new(env);
Then I run the compiler with cargo run --package revmc-examples-compiler --bin revmc-examples-compiler -- --code "0x5f355f60015b8215601a578181019150909160019003916005565b9150505f5260205ff3"
The code here is the FIBONACCI_CODE
. However, no matter how I change the input num, the output is always:
Return {
result: InterpreterResult {
result: Return,
output: 0x0000000000000000000000000000000000000000000000000000000000000001,
gas: Gas {
limit: 1000000,
remaining: 999949,
refunded: 0,
},
},
}
which is the result of empty input.
DaniPopes commented
Input is taken from interpreter.contract.input
so you need to build Contract
using the env with Contract::new_env
pythonberg1997 commented
I see. Thx!