19 Commits

Author SHA1 Message Date
wborgeaud
715c350ee8 Implement mload/store_general 2022-07-25 10:34:18 +02:00
wborgeaud
ee979428f4 Start implementing context and segments in interpreter 2022-07-23 15:35:48 +02:00
Daniel Lubarov
63a86a36f5 Merge branch 'main' into prover_input_instruction 2022-07-20 11:46:18 -07:00
Daniel Lubarov
b9b3c24cf9 PROVER_INPUT instruction 2022-07-19 06:55:23 -07:00
wborgeaud
a8ce2a6073 Import fix 2022-07-19 15:27:51 +02:00
wborgeaud
54629a0ef9 Merge branch 'main' into sha3_interpreter_ecrecover
# Conflicts:
#	evm/src/cpu/kernel/interpreter.rs
#	evm/src/cpu/kernel/tests/ecrecover.rs
2022-07-19 15:24:28 +02:00
wborgeaud
e7dbba8d7b s/sha3/keccak256 2022-07-19 15:21:44 +02:00
Daniel Lubarov
799d333a90 fix 2022-07-18 10:40:02 -07:00
Daniel Lubarov
0b7e3eca67 PANIC returns error 2022-07-18 08:58:11 -07:00
Daniel Lubarov
d53804c66f Merge branch 'main' into add_priviledged_opcodes 2022-07-18 08:47:15 -07:00
wborgeaud
14a58439e5 SHA3 in interpreter 2022-07-18 16:24:47 +02:00
Daniel Lubarov
925483ed1e Add custom opcodes
- `GET_STATE_ROOT` and `SET_STATE_ROOT` deal with the root of the state trie, and will be called from storage routines. Similarly `GET_RECEIPT_ROOT` and `SET_RECEIPT_ROOT` deal with the root of the receipt trie.
- `PANIC` enables an unsatisfiable constraint, so no proof can be generated.
- `GET_CONTEXT` and `SET_CONTEXT`, used when calling and returning
- `CONSUME_GAS` charges the sender gas; useful for cases where gas calculations are nontrivial and best implemented in assembly.
- `EXIT_KERNEL` simply clears the CPU flag indicating that we're in kernel mode; it would be used just before a jump to return to the (userspace) caller.
- `MLOAD_GENERAL` and `MSTORE_GENERAL` are for reading and writing memory, but they're not limited to the main memory segment of the current context; they can access any context and any segment. I added a couple macros to show how the they would typically be used.

There may be more later, but these are the ones I think we need for now.  I tried to fill in smaller invalid sections of the decoder's tree, as Jacqui suggested, while keeping related opcodes together. We can fine tune it when the opcode list is more stable.

These are all intended to be priviledged, i.e. they will be treated as invalid if used from userspace, for compatibility as well as (in some cases) security reasons.
2022-07-17 15:43:49 -07:00
wborgeaud
292bb4a024 Implement memory for the interpreter 2022-07-15 11:10:10 +02:00
wborgeaud
b1bc48197c Fix jumpdest check 2022-07-13 10:51:49 +02:00
wborgeaud
12ca084620 PR feedback 2022-07-08 09:58:52 +02:00
wborgeaud
7bf5118f69 Test exp kernel function 2022-07-07 18:46:20 +02:00
wborgeaud
f8987b7e80 Minor 2022-07-07 18:27:15 +02:00
wborgeaud
9c4947e0f0 EC ops test 2022-07-07 18:06:24 +02:00
wborgeaud
3ec2d307e5 EVM interpreter 2022-07-07 16:53:06 +02:00