Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constrain uninitialized memory to 0 #1318

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

hratoanina
Copy link
Contributor

Missing constraints in the Memory Stark.
We do not check that memory is initialized at 0, that is to say that a read at a new address without a prior write must have a value of 0.
An immediate exploit is to bypass JUMPDEST analysis in case of a jump outside of the contract code, and subsequently arbitrary code execution in the uninitialized memory. In https://github.com/topos-protocol/plonky2/tree/code_injection, the code of the contract is a jump to address 0x80 which should raise an invalid jump exception, but the transaction is accepted and the proof is valid.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@hratoanina hratoanina requested a review from nbgl October 30, 2023 22:37
@hratoanina
Copy link
Contributor Author

@nbgl Assigning you, since I presumed you'd be interested in this exploit!

@Nashtare Nashtare added bug Something isn't working soundness Soundness related changes labels Oct 30, 2023
Copy link
Contributor

@nbgl nbgl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!!

@hratoanina hratoanina merged commit d2b549a into 0xPolygonZero:main Nov 3, 2023
4 checks passed
@hratoanina hratoanina deleted the fix_uninit_memory branch November 3, 2023 23:52
wborgeaud pushed a commit that referenced this pull request Nov 14, 2023
pgebheim added a commit that referenced this pull request Nov 27, 2023
* Squashed commit of the following:

commit 4f854e6
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Fri Nov 3 13:48:23 2023 +0100

    Minor

commit fbd4c78
Merge: ad580c2 c70a785
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Fri Nov 3 13:42:45 2023 +0100

    Merge branch 'feat/type2' into type2/smt_deletion

    # Conflicts:
    #	evm/src/cpu/kernel/aggregator.rs
    #	evm/src/cpu/kernel/asm/mpt/storage/storage_write.asm
    #	evm/src/cpu/kernel/asm/smt/insert.asm
    #	evm/src/cpu/kernel/asm/smt/utils.asm
    #	evm/src/cpu/kernel/constants/mod.rs
    #	evm/src/cpu/kernel/tests/smt/mod.rs
    #	evm/tests/selfdestruct.rs

commit c70a785
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Fri Nov 3 13:37:19 2023 +0100

    Start of SMT implementation for Type 2 zkEVM (#1315)

    * Add SMT types

    * Progress

    * Progress

    * Working smt hashing

    * Minor

    * Fix hash

    * Working insert

    * Minor

    * Add insert test for storage trie

    * Add missing constraints for DUP/SWAP (#1310)

    * Refactor wcopy syscalls

    * Refactor memcpy

    * Working test_simple_transfer

    * Modify add11_yml.rs

    * Refactor codecopy

    * Fix

    * Fix calldatacopy

    * Fix test on interpreter side

    * Remove new_stack_top_channel from StackBehavior (#1296)

    * Working add11_yml.rs

    * All tests compile

    * Working test_balance

    * Minor

    * Working test_extcodesize

    * All non-ignored tests pass

    * Fix test_empty_txn_list

    * Clippy

    * smt_utils point to github

    * Comments

    * Fix kexit_info in test

    * Review

    * Update Cargo.toml

    * Move empty check inside final iteration

    * Remerge context flags (#1292)

    * Remerge context flags

    * Apply comments and revert some unwanted changes

    * Merge NOT and POP flags. (#1257)

    * Merge NOT and POP flags

    * Add comments

    * Disable remaining memory channels for POP

    * Apply comments

    * Fix stack

    * More of memcpy_bytes

    * Add some documentation in EVM crate (#1295)

    Co-authored-by: Linda Guiga <linda.guiga@toposware.com>

    * Combine PUSH0 and PC flags. (#1256)

    * PR feedback

    * Add context constraints (#1260)

    * Combine JUMPDEST and KECCAK_GENERAL flags. (#1259)

    * Combine JUMPDEST and KECCAK_GENERAL flags.

    * Apply comments

    * Fix merging of jumpdest and keccak_general.

    * Add test for selfdestruct (#1321)

    * Add test for selfdestruct

    * Comment

    * Fix test

    ---------

    Co-authored-by: Hamy Ratoanina <hamy.ratoanina@toposware.com>
    Co-authored-by: Robin Salen <salenrobin@gmail.com>
    Co-authored-by: Linda Guiga <101227802+LindaGuiga@users.noreply.github.com>
    Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>
    Co-authored-by: Linda Guiga <linda.guiga@toposware.com>
    Co-authored-by: Linda Guiga <lindaguiga3@gmail.com>

commit ad580c2
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Thu Nov 2 08:40:46 2023 +0100

    Clippy

commit fe5b8fd
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Thu Nov 2 08:39:26 2023 +0100

    s/mpt/smt in a bunch of places

commit 73dc262
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Thu Nov 2 08:15:56 2023 +0100

    Selfdestruct test passes

commit 539190f
Merge: e110941 f71f227
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Thu Nov 2 07:58:15 2023 +0100

    Merge branch 'main' into type2/smt_deletion

commit e110941
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Wed Nov 1 17:04:38 2023 +0100

    Minor

commit f7fba35
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Wed Nov 1 12:24:13 2023 +0100

    PR feedback

commit e528b89
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Mon Oct 30 09:11:25 2023 +0100

    Update Cargo.toml

commit 5eaf83e
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Fri Oct 27 12:34:52 2023 +0200

    Comments

commit ae9c443
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Fri Oct 27 11:51:16 2023 +0200

    smt_utils point to github

commit b3d61b7
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Fri Oct 27 11:49:33 2023 +0200

    Clippy

commit ccb3d7e
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Fri Oct 27 10:00:20 2023 +0200

    Fix test_empty_txn_list

commit 986b010
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Fri Oct 27 09:48:14 2023 +0200

    All non-ignored tests pass

commit 7bb0c02
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Fri Oct 27 09:44:40 2023 +0200

    Working test_extcodesize

commit b8a85d4
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Fri Oct 27 09:38:08 2023 +0200

    Minor

commit 2c01b05
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Fri Oct 27 09:37:05 2023 +0200

    Working test_balance

commit e370b62
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Fri Oct 27 09:13:36 2023 +0200

    All tests compile

commit f21bc5c
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Fri Oct 27 08:31:04 2023 +0200

    Working add11_yml.rs

commit 4e2b3f3
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Thu Oct 26 18:50:32 2023 +0200

    Modify add11_yml.rs

commit c324412
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Thu Oct 26 18:28:21 2023 +0200

    Working test_simple_transfer

commit df55e45
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Thu Oct 26 08:54:24 2023 +0200

    Add insert test for storage trie

commit ca0102f
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Thu Oct 26 08:42:03 2023 +0200

    Minor

commit dc27351
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Thu Oct 26 08:40:57 2023 +0200

    Working insert

commit f6c4067
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Wed Oct 25 08:07:31 2023 +0200

    Fix hash

commit c6e85eb
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Wed Oct 18 18:46:32 2023 +0200

    Minor

commit d95c430
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Wed Oct 18 18:32:05 2023 +0200

    Working smt hashing

commit fd09915
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Wed Oct 18 14:32:38 2023 +0200

    Progress

commit a706cda
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Wed Oct 18 07:37:26 2023 +0200

    Progress

commit 95e5cc1
Author: wborgeaud <williamborgeaud@gmail.com>
Date:   Fri Oct 13 09:19:45 2023 +0200

    Add SMT types

* Constrain uninitialized memory to 0 (#1318)

* Fix typos in comments

* Fix typos in comments

* Add test for ERC20 transfer (#1331)

* Working test

* Minor

* Cleaning

* Implement storage SMT

* Working ERC20 test

* Cleaning

* Remove `len` column in `KeccakSpongeStark` (#1334)

* Remove len column in KeccakSpongeStark

* Apply comment

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>

---------

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>

* Add withdrawals (#1322)

* Withdrawals

* Remove AllRecursiveCircuits in withdrawals test

* Fix ERC20 test

* Add memory checks for prover_input, as well as range_checks for prover_input, syscalls/exceptions (#1168)

* Add memory checks for prover_input and range_checks for prover_input, syscalls and exceptions

* Replace u32 by U256, and remove extra CTLs

* Add column in ArithmeticStark to use ctl_arithmetic_base_rows for is_range_check

* Fix CTLs and circuit constraint.

* Fix CTLs

* restore `no-std` support (#1335)

* perform test action on `x86_64-unknown-linux-gnu` and `wasm32-unknown-unknown`

Signed-off-by: muraca <mmuraca247@gmail.com>

* make `plonky2` build on `wasm32-unknown-unknown`

Signed-off-by: muraca <mmuraca247@gmail.com>

* make `starky` build on `wasm32-unknown-unknown`
small oversight on `plonky2` fixed

Signed-off-by: muraca <mmuraca247@gmail.com>

* skip `evm` folder if target is `wasm32-unknown-unknown`

Signed-off-by: muraca <mmuraca247@gmail.com>

* add `default: true` to toolchain

Signed-off-by: muraca <mmuraca247@gmail.com>

* skip `test` if target is `wasm32-unknown-unknown`

Signed-off-by: muraca <mmuraca247@gmail.com>

* single ticks instead of double

Signed-off-by: muraca <mmuraca247@gmail.com>

* explicit target

Signed-off-by: muraca <mmuraca247@gmail.com>

* wasm32 job

Signed-off-by: muraca <mmuraca247@gmail.com>

* added `--no-default-features` to checks

Signed-off-by: muraca <mmuraca247@gmail.com>

---------

Signed-off-by: muraca <mmuraca247@gmail.com>

* Fix create_contract_account

* Fixes

* More fixes

* More fixes

* Minor

---------

Signed-off-by: muraca <mmuraca247@gmail.com>
Co-authored-by: Paul Gebheim <pgebheim@gmail.com>
Co-authored-by: Hamy Ratoanina <hamy.ratoanina@toposware.com>
Co-authored-by: shuoer86 <129674997+shuoer86@users.noreply.github.com>
Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>
Co-authored-by: Linda Guiga <101227802+LindaGuiga@users.noreply.github.com>
Co-authored-by: Matteo Muraca <56828990+muraca@users.noreply.github.com>
Nashtare added a commit that referenced this pull request Feb 10, 2024
* Fix merging of jumpdest and keccak_general.

* Add test for selfdestruct (#1321)

* Add test for selfdestruct

* Comment

* Constrain uninitialized memory to 0 (#1318)

* Fix typos in comments

* Fix typos in comments

* Add test for ERC20 transfer (#1331)

* Working test

* Minor

* Cleaning

* Remove `len` column in `KeccakSpongeStark` (#1334)

* Remove len column in KeccakSpongeStark

* Apply comment

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>

---------

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>

* Add withdrawals (#1322)

* Withdrawals

* Remove AllRecursiveCircuits in withdrawals test

* Fix ERC20 test

* Add memory checks for prover_input, as well as range_checks for prover_input, syscalls/exceptions (#1168)

* Add memory checks for prover_input and range_checks for prover_input, syscalls and exceptions

* Replace u32 by U256, and remove extra CTLs

* Add column in ArithmeticStark to use ctl_arithmetic_base_rows for is_range_check

* Fix CTLs and circuit constraint.

* Fix CTLs

* restore `no-std` support (#1335)

* perform test action on `x86_64-unknown-linux-gnu` and `wasm32-unknown-unknown`

Signed-off-by: muraca <mmuraca247@gmail.com>

* make `plonky2` build on `wasm32-unknown-unknown`

Signed-off-by: muraca <mmuraca247@gmail.com>

* make `starky` build on `wasm32-unknown-unknown`
small oversight on `plonky2` fixed

Signed-off-by: muraca <mmuraca247@gmail.com>

* skip `evm` folder if target is `wasm32-unknown-unknown`

Signed-off-by: muraca <mmuraca247@gmail.com>

* add `default: true` to toolchain

Signed-off-by: muraca <mmuraca247@gmail.com>

* skip `test` if target is `wasm32-unknown-unknown`

Signed-off-by: muraca <mmuraca247@gmail.com>

* single ticks instead of double

Signed-off-by: muraca <mmuraca247@gmail.com>

* explicit target

Signed-off-by: muraca <mmuraca247@gmail.com>

* wasm32 job

Signed-off-by: muraca <mmuraca247@gmail.com>

* added `--no-default-features` to checks

Signed-off-by: muraca <mmuraca247@gmail.com>

---------

Signed-off-by: muraca <mmuraca247@gmail.com>

* Move empty_check inside final iteration

* Remove logic for multiple txns at once (#1341)

* Have prover take only a single txn at most

* Update comment

* Apply review

* Constrain clock (#1343)

* Fix ranges in AllRecursiveCircuits initialization for log_opcode aggregation test (#1345)

* Root out some unwraps

* Range-check keccak sponge inputs to bytes (#1342)

* Range-check keccak sponge inputs to bytes

* Move outside of inner loop

* Apply review

* Charge gas for native instructions in interpreter (#1348)

* Charge gas for native instructions in interpreter

* Apply comment

* Format

* Remove unnecessary code duplication (#1349)

* Remove unnecessary code duplication

* Clippy

* Add run_syscall and tests for sload and sstore (#1344)

* Add run_syscall and tests for sload and sstore

* Replace panics with errors and address comments

* Apply comments

* Change last addr name in prepare_interpreter

* Fix kernel_mode in tests

* Minor cleanup

* Reduce visibility for a bunch of structs and methods in EVM crate (#1289)

* Reduce visibility for a bunch of structs and methods

* Remove redundant

* 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>

* Fix MSTORE_32BYTES in interpreter (#1354)

* Fix parsing of non-legacy receipts (#1356)

* Fix parsing of non-legacy receipts

* Clippy

* Refactor JUMPDEST analysis (#1347)

* Use table for JUMPDEST

* Refactor jumpdest loop

* Update comment

---------

Co-authored-by: Robin Salen <salenrobin@gmail.com>

* Add push constraints (#1352)

* Add push constraints

* Fix ranges

* Add stack constraints

* Implement out of gas exception (#1328)

* Implement out of gas exception

* Use gas constants in gas_cost_for_opcode

* Remove comment

* Merge public values inside prove_aggreg (#1358)

* Constrain is_keccak_sponge (#1357)

* Revert "Make gas fit in 2 limbs (#1261)" (#1361)

* Revert "Make gas fit in 2 limbs (#1261)"

This reverts commit 0f19cd0.

* Comment

* Update Memory in specs (#1362)

* Update Memory specs

* Apply comment

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>

---------

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>

* Add doc for privileged instructions (#1355)

* Add doc for privileged instructions

* Comment

* Update specs for Logic and Arithmetic Tables (#1363)

* Update specs for Logic and Arithmetic

* Apply comments

* Reduce visibility (#1364)

* Add specs for KeccakSponge (#1366)

* Add specs for KeccakSponge

* Apply comments

* Update Keccak-f specs. (#1365)

* Update Keccak-f specs.

* Apply comments

* wip

* Create README.md

* Update README.md

* Update README.md

Link 2 EVM Tests Repo

* Update README.md

* Update README.md (#1371)

* CTL and range-check documentation (#1368)

* CTL and range-check documentation

* Apply comments

* Add exceptions to specs (#1372)

* Add exceptions to specs

* Apply comments

* Starting the specs for the CPU logic (#1377)

* Add CPU logic section to specs

* Add kernel specs

* Apply comments

---------

Co-authored-by: Hamy Ratoanina <hamy.ratoanina@toposware.com>

* Initialize blockhashes (#1370)

* Initialize blockhashes

* Update comment

* Check is_kernel_mode when halting (#1369)

* Add specs for BytePackingStark (#1373)

* Start

* Finish documenting BytePackingStark

* Apply comments

* Apply comment

---------

Co-authored-by: Robin Salen <salenrobin@gmail.com>

* Add range check constraints for the looked table (#1380)

* Add constraints to check that looked tables are well constructed for range checks

* Fix comments

* Explain difference between simple opcodes and syscalls (#1378)

* Explain difference between simple opcodes and syscalls

* Apply comment

* Add specs for the CPU table (#1375)

* Add specs for the CPU table

* Add general columns

* Apply comments

* Apply comments

* Backporting gas handling to the specs (#1379)

* Backporting gas handling to the specs

* Fix typo and syscall handling

* Add specs for stack handling (#1381)

* Add specs for stack handling

* Apply comments

* Add MPT specs

* Update evm/spec/mpts.tex

Co-authored-by: David <dvdplm@gmail.com>

* Update evm/spec/mpts.tex

Co-authored-by: David <dvdplm@gmail.com>

* Update evm/spec/mpts.tex

Co-authored-by: David <dvdplm@gmail.com>

* Update evm/spec/mpts.tex

Co-authored-by: David <dvdplm@gmail.com>

* Update evm/spec/mpts.tex

Co-authored-by: David <dvdplm@gmail.com>

* Update evm/spec/mpts.tex

Co-authored-by: David <dvdplm@gmail.com>

* Fix typo in evm/spec/mpts.tex

Co-authored-by: David <dvdplm@gmail.com>

* Address comment

* Remove redundant sect about MPT

* Update evm/spec/mpts.tex

Co-authored-by: wborgeaud <williamborgeaud@gmail.com>

* 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

* Fix run_syscall in interpreter. (#1351)

* Fix syscall and change sload test to catch the error

* Update comment

* Cleanup

* comment

* 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

* Add upgradeability to `AllRecursiveCircuits` and output verifier data (#1387)

* Add upgradeable preprocessed sizes

* Add verifier data

* Changes in interpreter and implement interpreter version for add11 (#1359)

* Fix interpreter, turn syscall opcodes into actual syscalls, create interpreter test for add11

* Rename test_add11 to test_add11_yml

* Apply comments

* Cleanup add11_yml interpreter test

* Make stack_top() return a Result, and remove Result from add11_yml test

* Apply comment

* Move stack_len_bounds_aux to general columns (#1360)

* Move stack_len_bounds_aux to general columns

* Update specs

* Apply comments

* Apply comment

* VerifierCircuitData Clone,PartialEq,Eq

* chore: from_values takes ref

* Optimize `num_bytes` and `hex_prefix_rlp` (#1384)

* Compute num_bytes non-deterministically

* Optimize hex_prefix_rlp

* Clean code

* Clippy

* Apply suggestions

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>

* Clean

* Add endline

* Change 1^256 to U256_MAX

* Apply suggestions from code review

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>

---------

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>

* Revert "chore: from_values takes ref"

This reverts commit 7cc123e.

* chore: Remove TODOs about `from_values` taking a reference

* 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

* Remove intermediary block bloom filters (#1395)

* Remove intermediary block blooms

* Update specs

* Regenerate pdf

* Apply comment, remove unneeded segment

* Fix kernel codehash discrepancy (#1400)

* Fix set_context constraints (#1401)

* Fix set_context constraints

* Apply comment

* Pacify clippy (#1403)

* Update stack op cost (#1402)

* Update stack op cost

* Update from review

* Use logUp for CTLs (#1398)

* Use LogUp for CTLs

* Update specs

* Invert in batch

* Reorder framework sections

* Implement `PublicValues` retrieval from public inputs (#1405)

* Implement PublicValues retrieval from public inputs

* Use utility method

* Remove generic argument

* Typo

* Make some functions const (#1407)

* Implement degree 2 filters (#1404)

* Implement degree 2 filters

* Apply comments

* Remove GenerationOutputs (#1408)

* Optimize asserts (#1411)

* 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

* Preinitialize all code segments (#1409)

* Preinitialize all code segments

* Add zero writes after code_size

* Use preinitializing for extcodesize

* Fix gas calculation

* Extend logic to extcodecopy

* Apply comments

* Remove is_keccak_sponge (#1410)

* Remove is_keccak_sponge

* Apply comment

* Use mstore_32bytes to optimize decode_int_given_len (#1413)

* chore: fix some comment typos

* Merge MSTORE_32BYTES and MLOAD_32BYTES columns (#1414)

* Merge MSTORE_32BYTES and MLOAD_32BYTES columns

* Fix circuit functions

* Apply comments

* Check that limbs after the length are 0 (#1419)

* Check that limbs after the length are 0

* Update comments

* Update comments

* Add `Checkpoint` heights (#1418)

* typo fix

* typo fix

* minor typo fix

* typo fix

* Fix a minor typo in evm/spec/cpulogic.tex

* Merge `push` and  `prover_input` flags (#1417)

* Merge PUSH and PROVER_INPUT flags

* Apply comment

* Rebase to main

* Refactor run_next_jumpdest_table_proof

* Fix jumpdest analisys test

* Constrain MSTORE_32BYTES new offset limbs (#1415)

* Apply suggestions from code review

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>

* fix: make `from_noncanonical_biguint` work for zero (#1427)

* Eliminate nested simulations

* Remove U256::as_u8 in comment

* Fix fmt

* Clippy

* Add aborting signal (#1429)

* Add aborting signal

* Clippy

* Update to Option following comment

* Add ERC721 test (#1425)

* Add ERC721 test

* Add IS_READ column to BytePacking CTL

* Apply comment

* Change context to current context for BN precompiles (#1428)

* Change context to current for BN precompiles

* Rename segments

* rustfmt

* Added a Discord badge to `README.md`

* Regenerate tries upon Kernel failure during `hash_final_tries` (#1424)

* Generate computed tries in case of failure

* Only output debug info when hashing final tries

* Clippy

* Apply comments

* Add exceptions handling to the interpreter (#1393)

* Add exceptions handling to the interpreter

* Apply comments

* Fix comments

* Filter range checks (#1433)

* Add filtering to range-checks

* Cleanup

* Fix Clippy

* Apply comment

* Constrain new top to loaded value in MLOAD_GENERAL (#1434)

* Minor cleanup (#1435)

* Improve proof generation

* Constrain first offset of a segment (#1397)

* Constrain first offset of a segment

* Apply comment, revert debugging code

* Modify specs

* Apply comments

* Remove aborts for invalid jumps

* Rebase to main

* Refactor run_next_jumpdest_table_proof

* Fix jumpdest analisys test

* Apply suggestions from code review

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>

* Eliminate nested simulations

* Remove U256::as_u8 in comment

* Fix fmt

* Clippy

* Improve proof generation

* Remove aborts for invalid jumps

* Remove aborts for invalid jumps and Rebase

* Clippy

* add Debug trait to PartitionWitness to enable trace information output (#1437)

* Refactor encode_empty_node and encode_branch_node

Clean code

Not important

Restore jumpdets_analysis.asm

Refactor encode_empty_node and encode_branch_node

* Constrain partial_channel (#1436)

* Add alternative method to prove txs without pre-loaded table circuits (#1438)

* Rebase to main

Refactor encode_empty_node and encode_branch_node

Add constant and store encoded empty node in an other position

Remove child segment

Clean code

Apply suggestions from code review

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>

Remive global label

Move encoded empty nodes

* Remove duplicated label

* Restore simple_transfer and Clippy

* Clippy

* Pacify latest clippy (#1442)

* Add initial constraint z polynomial (#1440)

* Prevent some lints from being allowed (#1443)

* Add packed verification

* Fix minor error

* Minor

* Apply suggestions from code review

Co-authored-by: Linda Guiga <101227802+LindaGuiga@users.noreply.github.com>
Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>

* Address comments

* Remove assertion in packed verif

* Remove assertion

* Add some more explicit doc on plonky2 crate

* Rustdoc

* Add comment

* Remove gas check in sys_stop (#1448)

* Address bundling (#1426)

* Start

* Scale TxnFields

* Speed-up

* Misc fixes

* Other fixes

* Fix

* Fix offset

* One more fix

* And one more fix

* Fix

* Fix

* Fix init

* More interpreter fixes

* Final fixes

* Add helper methods

* Clippy

* Apply suggestions

* Comments

* Update documentation

* Regenerate pdf

* minor

* Rename some macros for consistency

* Add utility method for unscaling segments and scaled metadata

* Address comments

* Remove unused macro

* Add crate-level documentation (#1444)

* Add crate-level documentation

* Revert change

* Skip

* Typo

* Apply comments

* Rephrase paragraph

* Apply comments

* Adress reviewer comments

* Add some more + module doc

* chore: fix typos (#1451)

* Some more

* Fix `after_mpt_delete_extension_branch` (#1449)

* Fix after_mpt_delete_extension_branch

* Rename test

* PR feedback

* Address review comments

* Improve some calls to `%mstore_rlp` (#1452)

* Improve some calls to mstore_rlp

* Remove comment

* Add Boolean constraints for `ArithmeticStark` (#1453)

* Constrain IS_READ to be boolean

* Constrain arithmetic flags to be boolean

* Comment on memory stark

* Implement CTL bundling (#1439)

* Implement CTL bundling

* Cleanup

* Clippy

* Preallocate memory

* Apply comments and remove unnecessary functions.

* Start removing clones

* Set columns and filters inside if condition.

* Remove extra CTL helper columns

* Add circuit version, with cleanup and fixes

* Remove some overhead

* Use refs

* Pacify clippy

---------

Co-authored-by: Robin Salen <salenrobin@gmail.com>

* Intra doc link

* chore(evm,field,plonky2):fix typos (#1454)

* Use current context in ecrecover (#1456)

* Apply suggestions from code review

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>

* Address comments

* Missing review comments

* Free up some CPU cycles (#1457)

* Free up some cycles

* Comments

* Apply suggestions from code review

Co-authored-by: Linda Guiga <101227802+LindaGuiga@users.noreply.github.com>

* Constrain syscall/exceptions filter to be boolean (#1458)

* Adress review comments

* Update empty_txn_list

* Fix comment

* Apply review

* Interpreter GenerationInputs (#1455)

* Add initialization with GenerationInputs to the interpreter

* Add new_with_generation_inputs_and_kernel

* Apply comments

* Remove full memory channel (#1450)

* Remove a full memory channel

* Remove unnecessary uses

* Revert PDF change

* Apply comments

* Apply more comments

* Move disabling functions to cpu_stark.rs

* Apply comments

* Bumped `eth_trie_utils`

- Contains important fixes.

* Add files via upload

* Update README.md

Add License / Contributing to readme

* Update Cargo.toml

Add license field to cargo manifest

* Packed rlp prover inputs (#1460)

* Pack rlp prover inputs

* Fix endianness bug

* Remove debug info and fix clippy

* Fix clippy (#1464)

* Fix fill_gaps (#1465)

* Add math rendering with Katex (#1459)

* fix: make add_generators public (#1463)

* proofreading (#1466)

* Fix simulation for jumpdest analysis (#1467)

* Remove some CPU cycles (#1469)

* Amortize mload_packing

* Reduce stack overhead

* Amortize mstore_unpacking

* Speed-up stack operation in hash.asm

* Misc

* Small tweaks

* Misc small optims

* Fix comments

* Fix main access to withdrawals

* Fix stack description

* minor: rename label

* Comments

---------

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

* Remove some more CPU cycles (#1472)

* Speed-up some mload/mstore calls

* Misc

* Improve logs loop

* Speed-up bloom

* Speed-up access_lists loops

* Fix

* Speed up selfdestruct loop

* Speed-up touched_addresses loop

* Speed-up receipt loop

* Skip rep loop

* Fix

* Misc

* Review

* Fix touched_addresses removal (#1473)

* chore: update ci workflow (#1475)

* chore: bump `actions/checkout` and `actions/cache`

* chore: use `dtolnay/rust-toolchain` and `Swatinem/rust-cache` instead of outdated github actions

* chore: use `cargo test`

* chore: remove `actions-rs/cargo`

* fix: typo

* chore: enable to cancel in-progress jobs

* chore: add job timeouts

* Fix typos (#1479)

* Fix interpreter jumps (#1471)

* Fix interpreter jumps

* Apply comments

* Improve SHA2 precompile (#1480)

* Improve SHA2 precompile

* Review

* Add removed global label

* Improve `blake2f` call (#1477)

* Improve on blake2 operations

* Comments

* Remove swap_mstore calls by changing stack macros

* Speed-up `bn254` pairing operation (#1476)

* Speed-up bn254 operations

* Add comment for write_fp254_12_unit macro

* Refactor some macros

* nit: comment

* Add newline

* Improve `BIGNUM` operations (#1482)

* Fix bugs in jumpdest analysis (#1474)

* Fix simulation for jumpdest analysis

* Fix bugs in jumpdest analysis

* Update evm/src/cpu/kernel/asm/core/jumpdest_analysis.asm

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>

* Address reviews

---------

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>

* Fix circuit sizes (#1484)

* Use web_time crate instead of std::time (#1481)

* Use usize::BITS and wrapping_shr in reverse_index_bits_in_place_small (#1478)

* Add LA audit report

* Cleanup imports (#1492)

* Fix BaseSumGenerator and BaseSplitGenerator Ids (#1494)

* fix: different ids for generators with different bases

required for correct serialisation

Signed-off-by: electron-team <utsavjn48@gmail.com>

* fixing wasm32 build issue

Signed-off-by: electron-team <utsavjn48@gmail.com>

* fix fmt issue

Signed-off-by: electron-team <utsavjn48@gmail.com>

---------

Signed-off-by: electron-team <utsavjn48@gmail.com>

* Make CTLs more generic (#1493)

* Make number of tables generic

* Remove dependency on Table in the CTL module

* Remove needless conversion

* Remove more needless conversion

* Clippy

* Apply reviews

* Reorganize lookup / ctl modules (#1495)

* Reorganize lookup / ctl modules

* Apply review

* Some cleanup (#1498)

* Remove StarkProofWithMetadata (#1497)

* Add missing constraints mentioned by auditors (#1499)

* Fix nightly version

* Fix workflow

* Switch permutation argument for logUp in `starky` (#1496)

* Switch permutation argument for logUp in starky

* Apply comments

* Refactor check_lookup_options

* Comments

* Add more visibility

* std -> core

* Revert "Add more visibility"

This reverts commit 2b4e50e.

* Add more visibility to lookup items

* Fix no-std tests and add corresponding jobs in the CI (#1501)

* Revert "Remove StarkProofWithMetadata (#1497)" (#1502)

This reverts commit af0259c.

* Update new tests for Cancun

---------

Signed-off-by: muraca <mmuraca247@gmail.com>
Signed-off-by: electron-team <utsavjn48@gmail.com>
Co-authored-by: Linda Guiga <lindaguiga3@gmail.com>
Co-authored-by: wborgeaud <williamborgeaud@gmail.com>
Co-authored-by: Hamy Ratoanina <hamy.ratoanina@toposware.com>
Co-authored-by: shuoer86 <129674997+shuoer86@users.noreply.github.com>
Co-authored-by: Linda Guiga <101227802+LindaGuiga@users.noreply.github.com>
Co-authored-by: Matteo Muraca <56828990+muraca@users.noreply.github.com>
Co-authored-by: David Palm <dvdplm@gmail.com>
Co-authored-by: Paul Gebheim <pgebheim@users.noreply.github.com>
Co-authored-by: Chris Tian <chris@succinct.xyz>
Co-authored-by: 4l0n50 <alonso.gon@gmail.com>
Co-authored-by: puma314 <puma314@users.noreply.github.com>
Co-authored-by: yanziseeker <153156292+AdventureSeeker987@users.noreply.github.com>
Co-authored-by: Ben <bmarsh94@gmail.com>
Co-authored-by: Pioua <136521243+dzizazda@users.noreply.github.com>
Co-authored-by: Ayush Shukla <shuklaayush247@gmail.com>
Co-authored-by: BGluth <gluthb@gmail.com>
Co-authored-by: Icer <liangshuangde@163.com>
Co-authored-by: vuittont60 <81072379+vuittont60@users.noreply.github.com>
Co-authored-by: Ratan Kaliani <ratankaliani@berkeley.edu>
Co-authored-by: Ursulafe <152976968+Ursulafe@users.noreply.github.com>
Co-authored-by: Léo Vincent <28714795+leovct@users.noreply.github.com>
Co-authored-by: Thabokani <149070269+Thabokani@users.noreply.github.com>
Co-authored-by: Vivek Pandya <vivekvpandya@gmail.com>
Co-authored-by: Daniel Lubarov <daniel@lubarov.com>
Co-authored-by: Utsav Jain <43694826+utsavjnn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working soundness Soundness related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants