93 Commits

Author SHA1 Message Date
Robin Salen
bfcfcdb498
Add Checkpoint heights (#1418) 2023-12-09 06:26:55 +01:00
Linda Guiga
a90aa40b7a
Implement MPT preinitialization (#1406)
* Implement MPT preinitialization

* Apply comments

* Replace GlobalMetadata reads with stores in the kernel

* Change memory specs

* Remove trie data length as a prover input
2023-12-07 12:08:47 -05:00
Robin Salen
47e24306b7
Remove GenerationOutputs (#1408) 2023-12-05 18:10:36 -05:00
Robin Salen
2d36559dad
Make some functions const (#1407) 2023-12-05 13:41:31 -05:00
Robin Salen
7ac6bf2c66
Implement PublicValues retrieval from public inputs (#1405)
* Implement PublicValues retrieval from public inputs

* Use utility method

* Remove generic argument

* Typo
2023-12-05 11:42:40 -05:00
Robin Salen
5572da30d7
Remove intermediary block bloom filters (#1395)
* Remove intermediary block blooms

* Update specs

* Regenerate pdf

* Apply comment, remove unneeded segment
2023-11-30 13:11:38 -05:00
Hamy Ratoanina
30c944f778
Remove bootstrapping (#1390)
* Start removing bootstrapping

* Change the constraint for kernel code initializing

* Update specs

* Apply comments

* Add new global metadata to circuit methods

* Change zero-initializing constraint

* Apply comment

* Update circuit size range for recursive test
2023-11-30 10:04:08 -05:00
Robin Salen
6dd2e313c4
Add upgradeability to AllRecursiveCircuits and output verifier data (#1387)
* Add upgradeable preprocessed sizes

* Add verifier data
2023-11-28 12:23:20 -05:00
Linda Guiga
3440ba94e6
Remove extra rows in BytePackingStark (#1388)
* Have at most one row per (un)packing operation in BytePackingStark

* Change specs

* Fix comment

* Fix tests and apply comments

* Fix log_opcodes
2023-11-28 10:25:03 -05:00
Robin Salen
2039e18f29
Fix genesis block number in prove_block (#1382)
* Fix genesis block number target

* Add consistency check

* Fix genesis block number

* Revert pruning

* Cleanup

* Update error message with hashes

* Fix and add comment

* Make comment more explicit
2023-11-27 10:24:11 -05:00
Linda Guiga
98b5e5be51
Initialize blockhashes (#1370)
* Initialize blockhashes

* Update comment
2023-11-22 13:30:52 -05:00
Robin Salen
4dc42c513a
Merge public values inside prove_aggreg (#1358) 2023-11-15 14:51:35 -05:00
Robin Salen
01f229a8e1
Add push constraints (#1352)
* Add push constraints

* Fix ranges

* Add stack constraints
2023-11-15 11:15:14 -05:00
Hamy Ratoanina
6d751b13c1
Remove values of last memory channel (#1291)
* Remove values of last memory channel

Co-authored-by: Linda Guiga <lindaguiga3@gmail.com>

* Fix merge

* Apply comments

* Fix ASM

* Top stack documentation (#7)

* Add doc file

* Apply comments

* Apply comments

* Fix visibility

* Fix visibility

---------

Co-authored-by: Linda Guiga <lindaguiga3@gmail.com>
2023-11-13 11:03:50 -05:00
Robin Salen
ec41b754a6
Fix ranges in AllRecursiveCircuits initialization for log_opcode aggregation test (#1345) 2023-11-09 17:21:21 -05:00
Robin Salen
954d1a77c6
Remove logic for multiple txns at once (#1341)
* Have prover take only a single txn at most

* Update comment

* Apply review
2023-11-09 09:34:12 -05:00
wborgeaud
fa93454c5c
Add withdrawals (#1322)
* Withdrawals

* Remove AllRecursiveCircuits in withdrawals test

* Fix ERC20 test
2023-11-07 12:20:54 +01:00
wborgeaud
099994abe4
Add test for ERC20 transfer (#1331)
* Working test

* Minor

* Cleaning
2023-11-06 13:02:33 +01:00
wborgeaud
f71f227d3c
Add test for selfdestruct (#1321)
* Add test for selfdestruct

* Comment
2023-11-02 07:56:21 +01:00
wborgeaud
3ac0c4ae18
Fix genesis state trie root when calling prove_root (#1271)
* Fix genesis state trie root in some tests

* Just do it in tests calling prove_block
2023-10-03 17:47:10 +02:00
Robin Salen
cd36e96cb8
Derive clone for txn RLP structs (#1264)
* Derive Clone for txn rlp structs

* Put txn rlp related structs behind testing module

* Move module to end of file
2023-10-02 09:59:45 -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
acc659da07
Add type 1 and 2 txn for RLP encoding support (#1255) 2023-09-26 14:56:18 -04:00
Linda Guiga
5694af79f9
Merge remote-tracking branch 'mir-plonky2/main' into constrain-genesis-state 2023-09-26 12:24:48 -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
Linda Guiga
9d0101d652
Merge branch 'main' into 'constrain-genesis-state' 2023-09-25 10:19:13 -04:00
Linda Guiga
f944a08b4d
Fix self_balance_gas_cost and basic_smart_contract. (#1227)
* Fix self_balance_gas_cost and basic_smart_contract.

* Fix Clippy
2023-09-13 09:12:56 -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
Linda Guiga
4d7d9ffa3c
Constrain genesis block's state trie. 2023-09-11 19:09:12 +01:00
Linda Guiga
42f7038031
Add blockhash sys opcode 2023-09-07 09:43:59 +01:00
Robin Salen
fa9aae1fdc
Remove duplicate code 2023-09-06 15:15:33 -04:00
Linda Guiga
6bd17e29c1
Apply comments 2023-09-06 01:19:31 +01:00
Linda Guiga
b07644368f
Add missing links between public values 2023-08-31 13:40:13 +01:00
Robin Salen
7196714734
Update range from ReceiptTrie PR 2023-08-25 09:58:20 -07:00
Linda Guiga
5b962f3c06
Change receipts_trie in basic_smart_contract and self_balance_gas_cost 2023-08-22 20:00:49 +01:00
Linda Guiga
ad9796cb10
Fix tests and address comments 2023-08-22 20:00:49 +01: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
Robin Salen
68bb49671d
Update tests to have a blockgaslimit fitting u32s 2023-08-18 19:02:06 -04:00
Robin Salen
89e62e554a
Use Keccak config in simple tests 2023-08-15 10:48:40 -04:00
wborgeaud
df07ae093a
Write trie roots to memory before kernel bootstrapping (#1172)
* Write trie roots

* Remove CPU trace length

* Update hash_initial/final_tries

* Fix tests

* Minor

* PR feedback
2023-08-09 10:15:13 +02:00
Robin Salen
9f8c152222
Remove unused attributes 2023-08-02 08:54:20 -04:00
Hamy Ratoanina
7a882d0a64
Clippy 2023-07-27 18:27:09 -04:00
Linda Guiga
6253a68ea5
Change public values into public inputs 2023-07-27 18:27:08 -04:00
Hamy Ratoanina
1590c1d0be
Fix indices in CTL functions 2023-07-27 18:27:05 -04:00
Linda Guiga
06037f814f
Fix the memory CTL and implement the verifier memory bus
Co-authored-by: Hamy Ratoanina <hamy.ratoanina@toposware.com>
2023-07-27 18:20:03 -04:00
Robin Salen
0a59aa6e6f
Remove need for matching start ranges 2023-07-06 16:26:00 -04:00
wborgeaud
6e3036017e
Support for type-2 transactions (#1052)
* Type-2 txns

* Minor

* Minor

* Fix add11_yml block metadata

* Fix simple_transfer test

* Minor
2023-05-23 15:06:26 +02:00
BGluth
10e6c76842 TrieInputs now uses H256 for storage account addresses
- Slightly easier for us if we use `H256` instead of `H160`.
2023-05-16 13:51:03 -06:00
Hamish Ivey-Law
c134b59763
Cross-table lookup for arithmetic stark (#905)
* First draft of linking arithmetic Stark into the CTL mechanism.

* Handle {ADD,SUB,MUL}FP254 operations explicitly in `modular.rs`.

* Adjust argument order; add tests.

* Add CTLs for ADD, MUL, SUB, LT and GT.

* Add CTLs for {ADD,MUL,SUB}MOD, DIV and MOD.

* Add CTLs for {ADD,MUL,SUB}FP254 operations.

* Refactor the CPU/arithmetic CTL mapping; add some documentation.

* Minor comment fixes.

* Combine addcy CTLs at the expense of repeated constraint evaluation.

* Combine addcy CTLs at the expense of repeated constraint evaluation.

* Merge `*FP254` CTL into main CTL; rename some registers.

* Connect extra argument from CPU in binary ops to facilitate combining with ternary ops.

* Merge modular ops CTL into main CTL.

* Refactor DIV and MOD code into its own module.

* Merge DIV and MOD into arithmetic CTL.

* Clippy.

* Fixes related to merge.

* Simplify register naming.

* Generate u16 BN254 modulus limbs at compile time.

* Clippy.

* Add degree bits ranges for Arithmetic table.
2023-05-11 03:29:06 +10:00
Robin Salen
5de5bfb5e4
Move serialization files into dedicated module 2023-04-20 07:59:37 +02:00