1625 Commits

Author SHA1 Message Date
Hamy Ratoanina
1d60431992
Store top of the stack in memory channel 0 (#1215)
* Store top of the stack in memory channel 0

* Fix interpreter

* Apply comments

* Remove debugging code

* Merge commit

* Remove debugging comments

* Apply comments

* Fix witness generation for exceptions

* Fix witness generation for exceptions (again)

* Fix modfp254 constraint
2023-10-11 16:28:49 -04:00
wborgeaud
762e6f07b8
Fix hash node case in mpt_delete_branch (#1278)
* Fix

* Add test

* Fix test

* Clippy
2023-10-11 18:57:17 +02:00
Linda Guiga
d7990ee137
Add journal entry for logs (#1286)
* Add journal entry for logs

* Move journal labels to another file.

* Minor cleanup
2023-10-11 10:36:23 -04:00
wborgeaud
9fd0425f67
Fix journal order in sys_selfdestruct (#1287)
* Fix

* Minor
2023-10-11 16:24:00 +02:00
Hamy Ratoanina
49ca63ee0f
Fix sys_blockhash (#1285) 2023-10-11 10:23:09 -04:00
Linda Guiga
2aeecc3dd8
Fix failed receipt. (#1284) 2023-10-11 10:02:24 -04:00
Robin Salen
b4203c3d47
Make sure success is 0 in contract failure (#1283) 2023-10-10 06:23:20 -04:00
Robin Salen
41a29f069b
Remove some dead_code in EVM crate (#1281)
* Remove unnecessary CpuArithmeticView.

* Remove AllChallengerState

* Remove RecursiveAllProof

* Remove unused generate methods

* Remove dead_code from cpu/columns

* Remove todo

---------

Co-authored-by: Linda Guiga <lindaguiga3@gmail.com>
2023-10-09 09:07:01 -04:00
Robin Salen
8a5eed9d1c
Fix shift constraint (#1280) 2023-10-09 07:41:30 -04:00
Linda Guiga
0de6f94962
Remove extra SHL/SHR CTL. (#1270)
* Remove extra shift CTL.

* Change order of inputs for the arithmetic shift operations. Add SHR test. Fix max number of bit shifts. Cleanup.

* Fix SHR in the case shift >= 256

* Limit visibility of helper functions
2023-10-05 09:56:56 -04:00
Robin Salen
0f19cd0dbc
Make gas fit in 2 limbs (#1261)
* Make gas fit in 2 limbs

* Fix recursive challenger

* Fix indices

* Add clarifying comments on ranges supported

* Add mention to revert before production
2023-09-29 14:47:23 -04:00
Alonso González
f49fbc8e9b
Transactions trie support (#1232)
* Implement transactions.

* Fix receipts and transactions

* Add some fixes

* Update tests

* Remove changes added for debugging purposes only

* Clippy

* Remove additional debug changes

* Remove unused

* Apply comments

---------

Co-authored-by: Linda Guiga <lindaguiga3@gmail.com>
Co-authored-by: Robin Salen <salenrobin@gmail.com>
2023-09-27 10:00:16 -04:00
Robin Salen
03a9558198
Handle additional panics (#1250)
* Remove some panic risks

* Remove more panics

* Handle jump with empty stack

* Handle last expect

* More panics

* Handle from_big_endian

* Handle from_little_endian

* Remove remaining risky as_usize()

* Remove explicit panic

* Clippy

* Handle unwrap

* Make error messages more explicit

* Simplify u256 to usize conversion
2023-09-26 11:13:57 -04:00
wborgeaud
8c78271f5c
Add random value to block metadata and fix sys_prevrandao (#1207)
* Add random to block metadata and fix `sys_prevrandao`

* Minor

* Observe block_random

* Write block_random

* cargo fmt

* block_random: H256

* Move sys_prevrandao to metadata.asm and delete syscall_stubs.asm

* Set block_random in set_block_metadata_target

* Minor

* Minor
2023-09-25 18:20:22 +02:00
Robin Salen
0abc3b9210
Apply comments (#1248) 2023-09-22 10:14:47 -04:00
Robin Salen
d6be2b987b
Remove generic_const_exprs feature from EVM crate (#1246)
* Remove const_generic_exprs feature from EVM crate

* Get a generic impl of StarkFrame
2023-09-22 09:19:13 -04:00
Robin Salen
053553d4d7
Reuse new packing instructions for MLOAD and MSTORE 2023-09-18 16:31:46 -04:00
Robin Salen
f3ea95cacc
Merge branch 'main' into error_vs_panic 2023-09-18 09:59:52 -04:00
Robin Salen
8903aec129
Change padding rule for CPU (#1234)
* Change padding rule for CPU

* Disable memory channels for padding rows

* Apply some of Jacqueline's comments

* Update halt routine

* Add clarifying comment

* Redundant constraints and padding bug

* Revert "Remove is_bootstrap_kernel column"

This reverts commit 49d92cb8f1b0ae9de76872f76af4429699ff692f.

* Make halt_state implicit

* Move halting logic constraints to dedicated module

* Include new module

* Update some comments
2023-09-15 17:46:58 -04:00
Linda Guiga
d4a8026bf9
Combine mstore_general and mload_general into one flag (#1188)
* Combine mstore_general and mload_general into one flag

* Add comments and make stack constraints cleaner.

* Fix number of native instructions

* Ordering

* Cleanup

* Update calls to stack eval from latest main

---------

Co-authored-by: Robin Salen <salenrobin@gmail.com>
2023-09-14 19:51:02 -04:00
Hamy Ratoanina
0b5ac312c0
Merge pull request #1203 from topos-protocol/constrain_nv_stack_len
Constrain next row's stack length
2023-09-14 22:42:32 +02:00
Robin Salen
06bc73f7ea
Combine arithmetic flags on the CPU side (#1187)
* Combine FP254 flags

* Combine basic binary ops together and do CTL with opcode value

* Combine ternary ops together

* Combine MUL DIV and MOD

* Combine shift operations

* Combine byte with other binary ops

* Fix tests

* Clean leftover comment

* Update from latest main

* Put the 'is_simulated' flag inside the Operation enum

* Cleaner way to handle "simulated" operations SHL and SHR.

* Fix comments.

* Minor: suggestion for re-expressing `combined_ops`.

* Update comment

---------

Co-authored-by: Hamish Ivey-Law <hamish@ivey-law.name>
2023-09-14 10:36:48 -04:00
Robin Salen
7ebbb47fcd
Swap ordering in stack macro (#1230)
* Swap ordering in stack macro

* Update comment
2023-09-13 08:39:01 -04:00
Robin Salen
5a1b05acfb
Remove risks of panic 2023-09-12 19:23:16 -04:00
Robin Salen
9508b49090
Move byte packing / unpacking to a distinct table (#1212)
* Duplicate Memory trace into BytePacking one

* Add mload_32bytes instruction

* Use dedicated ops for byte packing trace

* Change witness generation to reduce memory reads for MLOAD_32BYTES

* Remove segments

* Fix stack

* Fix extra product when fixing CTL for byte_packing

* Write output value in trace

* Add constraints for BYTE_PACKING table

* Add recursive constraints for BYTE_PACKING table

* Fix constraints

* Add address in trace and constraints

* Add timestamp and batch inputs into BytePackingOp struct

* Add extra column

* Fix BytePackingStark CTL

* Tiny fix in witness generation

* Fix the Memory CTL

* Add constraints for the new columns

* Remove 1 column

* Remove limb columns

* Fix

* Fix recursive circuit of BytePackingTable

* Fix constraints

* Fix endianness

* Add MSTORE_32BYTES instruction and move decomposition to packing table

* Add missing constraint

* Add range-check for all bytes

* Add extra constraint

* Cleanup

* Remove REMAINING_LEN column

* Add corresponding implementations in interpreter

* Fix recursive version

* Remove debug assertion because of CI

* Remove FILTER column

* Update new test from rebasing

* Reorder STARK modules to match TraceCheckPoint ordering

* Address comments

* Pacify clippy

* Add documentation to the packing module

* Fix doctest
2023-09-13 04:45:37 +10:00
Nicholas Ward
9a8a769dc4 more clippy suggestions 2023-09-08 10:44:45 -07:00
Nicholas Ward
a4e6c6ae90 clippy suggestions 2023-09-08 10:41:01 -07:00
Nicholas Ward
8af3b0feb4 clippy suggestions 2023-09-08 10:40:17 -07:00
Nicholas Ward
ed8bcf9d74 clippy suggestions 2023-09-08 10:34:37 -07:00
Nicholas Ward
2f1ed95154
Merge pull request #1220 from mir-protocol/latest_nightly_fix
Latest nightly fix
2023-09-08 10:04:09 -07:00
BGluth
6d3d2cb283 Now builds on the latest nightly 2023-09-07 13:32:07 -06:00
Linda Guiga
1c01d682aa
Fix overflow check and test. Remove [..8] when using h256_limbs. 2023-09-07 09:44:00 +01:00
Linda Guiga
4e0fe74a74
Apply comments 2023-09-07 09:43:59 +01:00
Linda Guiga
42f7038031
Add blockhash sys opcode 2023-09-07 09:43:59 +01:00
Linda Guiga
6207f4465a
Merge pull request #1206 from topos-protocol/missing-public-value-links
Add missing links between public values
2023-09-06 18:53:15 +01:00
Linda Guiga
bf21b278d8
Apply comments 2023-09-05 08:22:53 +01:00
Linda Guiga
9ba2b895b9
Implement receipts of types 1 and 2 2023-09-04 15:03:18 +01:00
Linda Guiga
b07644368f
Add missing links between public values 2023-08-31 13:40:13 +01:00
Hamy Ratoanina
8beba56903
Constrain next row's stack length 2023-08-28 16:32:04 -04:00
Robin Salen
c0b4f155f4
Implement receipts and logs
Co-authored-by: Hamy Ratoanina <hamy.ratoanina@toposware.com>
Co-authored-by: Linda Guiga <lindaguiga3@gmail.com>
2023-08-22 20:00:49 +01:00
Linda Guiga
44115de7ae
Merge pull request #1174 from topos-protocol/merge-context-flags
Combine get_context and set_context into one flag
2023-08-22 19:23:22 +01:00
BGluth
18ca89f093 Patched plonky2 to use a patch for eth_trie_utils 2023-08-21 16:44:22 -06:00
Linda Guiga
c3cb227896
Combine get_context and set_context into one flag 2023-08-21 23:12:25 +01:00
Robin Salen
74212a29ae
Merge pull request #1192 from topos-protocol/misc_constraints 2023-08-21 14:58:34 -04:00
Linda Guiga
06e20f87b6
Apply comment 2023-08-19 18:24:35 +01:00
Robin Salen
0b78c43fa3
Remove filtering in membus 2023-08-18 15:53:13 -04:00
Robin Salen
91e8d52d35
Reduce overconstraining in decode module 2023-08-18 15:46:23 -04:00
Linda Guiga
d70d67fad4
Remove copy on write for mpt_insert and mpt_delete 2023-08-18 16:53:40 +01:00
Robin Salen
49d92cb8f1
Remove is_bootstrap_kernel column 2023-08-17 17:35:35 -04:00
Hamy Ratoanina
815a02ab75
Remove is_cpu_cycle 2023-08-15 15:22:41 -04:00