27 Commits

Author SHA1 Message Date
Robin Salen
e10eaad09b
Combine all logic flags together 2023-08-11 10:17:45 -04:00
Robin Salen
ee9ce4c59d
Combine AND and OR flags in CpuStark 2023-08-09 16:05:24 -04:00
Jacqueline Nabaglo
cedeff5219 PUSH0 2023-06-13 13:29:30 -07:00
Jacqueline Nabaglo
b7220428b3 Error handling 2023-06-02 15:51:26 -07:00
Hamy Ratoanina
310107f218
Fix decode constraint 2023-04-07 17:06:57 -04:00
Jacqueline Nabaglo
f3946f75bf
Gas constraints (#880)
* Gas constraints

* Bugfix

* make test pass post rebase
2023-02-14 22:30:19 -08:00
Daniel Lubarov
526dc9bb77 Flush out operation list 2022-11-30 21:00:48 -08:00
Jacqueline Nabaglo
626c2583de
Combine all syscalls into one flag (#802)
* Combine all syscalls into one flag

* Minor: typo

* Daniel PR comments
2022-11-07 12:29:28 -08:00
Jacqueline Nabaglo
ec3391f9c4
Add Fp254 ops to the CPU table (#779)
* Add Fp254 ops to the CPU table

* Add forgotten file
2022-10-13 14:02:19 -07:00
Daniel Lubarov
9e483528d3 MPT hashing logic, part 3 2022-10-02 09:11:39 -07:00
Jacqueline Nabaglo
e978425b26
Connect stack to memory (#735)
* Connect stack to memory

* Daniel PR comment
2022-09-28 15:18:56 -07:00
Jacqueline Nabaglo
4c52d37546
Save columns by verifying invalid opcodes in software (#701)
* Save columns by verifying invalid opcodes in software

* Autogenerate invalid opcode bitfield (Daniel comment)

* Remove unnecessary panic label
2022-08-30 13:06:03 -07:00
Jacqueline Nabaglo
f1a5b7b2d1
Delete opcode column (#672) 2022-08-25 11:56:25 -05:00
Jacqueline Nabaglo
b98dd47820
Permission levels, jumps, traps (#653)
* Permission levels, jumps, traps

* Tests passing

* PR comments + documentation

* Docs + minor bugfixes

* Tests

* Use already-defined `stop` and `exception` (but renamed to `sys_stop`, `fault_exception`)

* Daniel comments
2022-08-16 09:46:10 -07:00
Jacqueline Nabaglo
24bb632358
Implement PANIC instruction (#644)
* Implement PANIC instruction

* Minor: comments
2022-07-29 12:04:42 -07: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
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
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
Jacqueline Nabaglo
bc9e618967
Structured wrapper over CPU table row (#589)
* Structured wrapper over CPU table row

* Lints

* minor style

* Minor cleanup
2022-06-29 16:23:44 -07:00
Daniel Lubarov
e73d01a037
packed_field -> packed (#584)
* `packed_field` -> `packed`

For cleaner imports; "field" is usually clear from context

* fix
2022-06-27 15:07:52 -07:00
Daniel Lubarov
3346d3f902
field_types -> types (#583)
* `field_types` -> `types`

Here too, I think "field" is usually clear from context, e.g. in `use plonky2::field::types::Field;`.

* fixes

* fmt
2022-06-27 12:24:09 -07:00
Daniel Lubarov
410e03349c
extension_field -> extension (#581)
It seems redundant in most contexts, e.g. `use plonky2::field::extension_field::Extendable;`. One could import `extension_field`, but it's not that common in Rust, and `field::extension` is now about as short.
2022-06-27 07:18:21 -07:00
Jacqueline Nabaglo
7cbce7bf6d
Remove redundant constraints (#568) 2022-06-15 11:27:40 -07:00
Jacqueline Nabaglo
1e44ee3681
EQ and ISZERO (#566) 2022-06-14 17:38:42 -07:00
Jacqueline Nabaglo
47efff834f
EVM decode (#553)
* EVM decode

* Style and docs

* Daniel PR comments

* Minor style

* Work on tests

* Tests passing!

* Minor: fix comment

* William comments
2022-06-03 19:24:47 -07:00