48 Commits

Author SHA1 Message Date
Daniel Lubarov
5a1cf8bff9 Move some constants 2022-10-03 12:08:29 -07:00
Daniel Lubarov
9e483528d3 MPT hashing logic, part 3 2022-10-02 09:11:39 -07:00
Daniel Lubarov
f2f05952ab MPT hashing logic, part 2 2022-10-01 20:02:42 -07:00
Daniel Lubarov
12247047ae MPT hashing logic, part 1 2022-09-30 17:02:25 -07:00
Nicholas Ward
faaaa0e0e2
Merge pull request #742 from mir-protocol/msize
MSIZE
2022-09-30 09:11:43 -07:00
Nicholas Ward
f6ff07840f fixes 2022-09-30 09:05:18 -07:00
Nicholas Ward
ea135341e8 MSIZE 2022-09-29 23:35:02 -07:00
BGluth
7e6844963a Few small changes related to switching to H256 2022-09-29 17:24:23 -06:00
Daniel Lubarov
5555085c4c MPT read for extension nodes 2022-09-27 21:41:22 -07:00
Daniel Lubarov
0e48d58147 Finish MPT read logic 2022-09-26 19:13:17 -07:00
Daniel Lubarov
c7b03cfe9a More MPT logic 2022-09-24 20:49:19 -07:00
Daniel Lubarov
37d92b55ac Basic MPT logic
For now this contains most of the basic framework/structure. Logic for things like insertions will come later.
2022-09-22 11:25:37 -07:00
Daniel Lubarov
9b259cb917 Feedback 2022-09-05 10:12:23 -07:00
Daniel Lubarov
539152d767 RLP encoding functions 2022-08-14 11:41:53 -07:00
Daniel Lubarov
cc61c7211c Core transaction processing logic
With lots of TODOs to fill in afterward; this is just a start.
2022-08-12 17:20:18 -07:00
Daniel Lubarov
ccc4202de3 Packing memory operations 2022-08-05 13:44:08 -04:00
Daniel Lubarov
215be25cf8 Feedback 2022-08-02 09:08:24 -07:00
Daniel Lubarov
3618793706 Test for parsing type 0 transactions
I made a couple related changes to `Interpreter`:
- Only enforce the `JUMPDEST` rule if we're in kernel mode.
- Convenience methods for dealing with the RLP and txn field segments of memory.
2022-08-01 11:03:05 -07:00
Daniel Lubarov
d6b5193c9b RLP decoding tests 2022-07-31 20:29:57 -07:00
wborgeaud
209dc26dc9 Remove stack and code in interpreter 2022-07-29 14:29:10 +02:00
wborgeaud
87640d7e98 PR feedback 2022-07-28 10:35:53 +02:00
wborgeaud
ce23d4377a Minor 2022-07-27 11:27:04 +02:00
wborgeaud
bb773e42b3 Merge branch 'main' into nondeterministic_ec_ops
# Conflicts:
#	evm/src/cpu/kernel/interpreter.rs
2022-07-27 11:24:22 +02:00
wborgeaud
e8ab92b115 PR feedback 2022-07-27 10:05:31 +02:00
wborgeaud
a0295f0079 Minor 2022-07-25 11:09:41 +02:00
wborgeaud
304299a007 Add assert to range check memory values 2022-07-25 10:39:51 +02:00
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
wborgeaud
927cad3acd Collect prover inputs 2022-07-23 13:03:43 +02:00
wborgeaud
cafae8b818 Add run_with_kernel fn 2022-07-23 12:36:03 +02:00
wborgeaud
19e6725cfa Working 2022-07-23 11:56:52 +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