Skip to content

Issues injecting CALLDATA and getting a return value out of it.  #263

Open
@Roaring30s

Description

@Roaring30s

New user to repo today, and just need some clarity.

const TEMP_CODE: &str = "608060405234801561000f575f80fd5b506101438061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610034575f3560e01c80632e64cec1146100385780636057361d14610056575b5f80fd5b610040610072565b60405161004d919061009b565b60405180910390f35b610070600480360381019061006b91906100e2565b61007a565b005b5f8054905090565b805f8190555050565b5f819050919050565b61009581610083565b82525050565b5f6020820190506100ae5f83018461008c565b92915050565b5f80fd5b6100c181610083565b81146100cb575f80fd5b50565b5f813590506100dc816100b8565b92915050565b5f602082840312156100f7576100f66100b4565b5b5f610104848285016100ce565b9150509291505056fea26469706673582212207ca8a77a375aff548bc76892f6b2093ea5bec72e34f6638bcd6bc43f620679bc64736f6c63430008160033";

const ERCDATA: &str = "2e64cec1"

let code = hex::decode(TEMP_CODE).unwrap();
let data = hex::decode(ERCDATA).unwrap();
let mut handler = UnimplementedHandler;

let machine = Machine::new(
Rc::new(code),
Rc::new(data),
1024,
10000,
RuntimeState {
	context: Context {
		address: H160::default(),
		caller: H160::default(),
		apparent_value: U256::default(),
	},
	transaction_context: TransactionContext {
		gas_price: U256::default(),
		origin: H160::default(),
	}
	.into(),
	retbuf: Vec::new(),
},
);
let mut vm = EtableInterpreter::new(machine, &RUNTIME_ETABLE);
let res = vm.run(&mut handler).exit().unwrap();

I have fed the machine the bytecode and data variables. So far it is successfully returning the bytecode from the deployment bytecode. But now I dont know where to make subsequent CALLDATA calls to the stateful machine.

If I could get clarification on this I would appreciate it.

Also, where does one extract the storage slots of the Machine after it runs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions