Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
WIP Remove nibbles (#237)
Browse files Browse the repository at this point in the history
* Implement PC opcode (#109)

* add pc gadget

* add pc constraint

* fix

* tab -> space

* use new way to build op circuit

* remove redundent assign

* fix

Co-authored-by: mask-pp <[email protected]>
Co-authored-by: gaswhat <[email protected]>

* Show better error message when Go isn't installed (#130)

* Introduce a global Context for bus-mapping (#134)

* Introduce a global Context for bus-mapping

- Add Context type that can be accessed an mutated by
  `gen_associated_ops` of each execution step which serves two purposes
  - Maintain an execution state so that we can fill information about
    the current Context in which the step was executed (for example, we
    will add a Call context to handle reverts)
  - Keep track of all the data required for the circuits (like the list
    of Operations related to the Bus Mapping)
- Remove the global counter from each {StorageOp, MemoryOp, StackOp},
  and create a generic wrapper type `Operation` with the global counter
  and an op.
- In OperationContainer, separate each Operation Type into a different
  vector, but keeping a single method for inserting Operations.
- Add a helper method in Context to push an Operation while assigning
  and incrementing the GlobalCounter automatically.  This simplifies
  implementation of new bus-mapping opcodes.
- Introduce ProgramCounter and GlobalCounter `inc_pre` methods to
  replace the `advance_pc` and `advance_gc` macros.
- Fix increment of the GlobalCounter per ExecutionStep (an ExecutionStep
  will not increment the GlobalCounter, only [data] Operations will).

Resolve #128
Resolve #126

* Change `Context` by `TraceContext`

* Remove `NoOp` arm from `Target` enum

* Fix `OperationContainer` broken intra-doc links

Co-authored-by: CPerezz <[email protected]>

* Fix the test error for geth-utils on MacOS (#131)

* Fix the test error for geth-utils on MacOS

* fix the flag

Co-authored-by: gaswhat <[email protected]>

* fix: remove unnecessary constraint which requires zero on unused cells (#135)

* Change CI to not trigger for Draft PRs (#146)

Since we share a lot of code in Draft PRs with no purpose at all of
running tests for them, it's a waste of time and resources to run the
entire CI each time we push something to a Draft PR or we simply open
one.

Therefore, thanks to @han0110 who found that was possible to avoid this
in the workflow config, it has been added.

Resolves: #145

* Split gas info (#142)

* split gas info into gas and gas cost

* remove gas info reference

* Add EQ support in LtGadget (#120)

* Add EQ to comparator gadget

* [Opcode] Jumpdest  (#143)

* implement jumpdest code

* fix fmt

* change format

* mark _step

Co-authored-by: Dream Wu <[email protected]>

* udpate toolchain to enable the array_map feature (#157)

* udpate toolchain

* fix ci lint stable: remove override and use toolchain

* Add operation (#158)

* fix operation container and write test

* implement ADD opcode in bus-mapping

* extend stack methods

* Refactor all opcodes to use the constraint builder + other utils (#147)

* Refactor all opcodes to use constraint builder + other utils

* Small misc improvements

* minor import and doc improvements

* Merge fixes

* Implement MLOAD/MSTORE opcodes (#87)

* Implement MLOAD/MSTORE opcodes

* Feedback

* Refactor bus-mapping (#162)

- Introduce the CircuitInputBuilder, which allows building the circuit
  inputs by taking types returned by geth and parsing them to generate
  the appropiate outputs.  The CircuitInputBuilder works by firs taking
  a block and then transactions and their associated execution traces.
  - The CircuitInputBuilder works by steps:
    1. Take a block
    2. Take each tx in the block
    3. Take each exec trace in the tx
  - The CircuitInpubBuilder in general is designed with 3 concepts that
    apply to 3 levels (block, tx, exec step):
    a. Input data: types obtained from geth (or in the future other
    modules like the partial merkle tree).
    b. context: data that must be available from one step to the other.
    c. Output data: data generated from Input data + context, that forms
    the circuit inputs.
- Previously there was a single type for ExecutionStep used both for
  deserializing and for circuit input.  Now the types are split into
  eth_types (which contains all types that geth / web3 can return), and
  internal structs in the CircuitInputBuilder which only contain the
  inputs required by the circuit.
- Introduce the eth_types modules (mentioned before).  Some of the types
  are reexported from rust-web3, others not available in external crates
  are defined.
- Introduce helper macros useful for tests to declare Address, Word and
  Word->Word maps from hex strings.
- Introduce mock data generators for tests.
- Rename `EvmWord` to `Word`.
- Rename `ExecutionTrace` to `ExecTrace`.
- Rename `ExecutionStep` to `ExecStep`.

* Add rho related checks (#156)

* add rho related checks

* feedback: add reasons to panic

* doc coef converter

* revamp biguint_to_f

* doc rho checks

* randomly modify the test and catch a bug

* add more docs to block counts

* complete the block count doc

* Implement MSTORE8 opcode (#160)

* build for apple silicon (#169)

* Implement some opcodes in bus-mapping (#167)

- Implement all the opcodes already implemented in the circuit, and some
  more.
- Add convencience `map` methods to StackAddress and MemoryAddress.
- New implemented opcodes in bus-mapping:
    - All unary opcodes: ISZERO, NOT.
    - All binary opcodes: ADD, SUB, MUL, DIV, SDIV, MOD, SMOD,
      SIGNEXTEND, LT, GT, SLT, SGT, EQ, AND, OR, XOR, BYTE, SHL, SHR,
      SAR.
    - All ternary opcodes: ADDMOD, MULMOD.
    - MSTORE
    - PC
    - JUMPDEST
    - PUSH2..32
    - DUP1..16
    - SWAP1..16

* Add GethClient and support for minimum required JSON-RPC endpoints by bus-mapping. (#171)

* Add ProviderError

* Add rpc module

* Add ethrs-providers to deps and url & tokio to dev-deps

* Add `GethQueries` and getBlockByHash fn

* Change `GethQueries` by `GethClient`

* Add `eth_getBlockByNumber` support

* Update `serde` version to `1.0.130`.

* Impl `Serialize` for `GethExecStep` & `GethExecStepInternal`

Since the `json_rpc` lib that we use requires the response types to be:
`Serialize + Deserialize`, it has been needed to impl `Serialize` for
the types that were lacking it.

- GethExecStepInternal now derives `Serialize`.
- Implemented `From<GethExecStep> for GethExecStepInternal` which is
  used in the next point.
- Implement `Serialize` for `GethExecStep` serializing it as a
  `GethExecStepInternal` using the previous `From` impl mentioned.

* Add `ResultGethExecTrace` & `ResultGethExecStep`

Geth return value for `debug_traceBlockByHash` and
`debug_traceBlockByNumber` isn't the expected.

While the expected format was to get from these calls
`Vec<GethExecTrace>`, you are given a similar vector but that contains a
`result` Json field that makes no sense previous to each trace.

Therefore it has been needed to simulate this as a new type and derive
`Serialize` and `Deserialize` for it so that the response from this call
can be parsed from the JSON and turned into usable data structures.

* Add support for debug_traceBlockByHash/Number

Following @ed255 suggestions the following extra JSON-RPC methods have
been provided support:
- debug_traceBlockByHash
- debug_traceBlockByNumber

Resolves: #23

* Fix clippy complaints

* Fix review suggestions from @ed255

- Renames ResultGethExecTraces and ResultGethExecTrace.
- Fix `From<GethExecStep` impl for `GethExecStepInternal`.

Co-authored-by: Eduard S. <[email protected]>

* Upgrade the toolchain to nightly (#181)

* use nightly

* cargo fmt

* clippy happy

* rename to remove stable

* lint more

* handle unused fields in keccak

* fix doc

* specify exact nightly version

* bus-mapping: Introduce EVM error detection (#183)

Implement error detection for EVM execution steps.  This PR adds all the
possible errors that can happen during EVM execution, with some of the
error detection incomplete due to missing access to a state trie.  List
of errors as declared by geth:
- Errors not reported
    - [x] ErrInvalidJump
    - [x] ErrReturnDataOutOfBounds
    - [x] ErrExecutionReverted
- Errors ignored
    - [x] ErrCodeStoreOutOfGas
    - [x] ErrMaxCodeSizeExceeded
    - [x] ErrInvalidCode
    - [ ] ErrContractAddressCollision
    - [ ] ErrInsufficientBalance
    - [x] ErrDepth
- Errors reported
    - [x] ErrWriteProtection
    - [x] ErrOutOfGas
    - [x] ErrGasUintOverflow
    - [x] ErrStackUnderflow
    - [x] ErrStackOverflow
    - [x] ErrInvalidOpCode

Each error has a test that uses the external_tracer and produces the
error.

The two incomplete error detections are for
`ErrContractAddressCollision` and `ErrInsufficientBalance`.  Detecting
these errors requires keeping track of the state, which we don't do yet.

Also, bump go-ethereum version in geth-utils.

* bus-mapping: Extend CallContext (#191)

Add the required fields in the CallContext, and use it to detect
CREATE/CREATE2 RETURN errors, and to fill the address in SLOAD
StorageOp.

Resolve #137
Resolve #185

* Implement XOR opcode (#75)

* bitwise circuit

* fix rebase error

* rebase and fix lint and tests

* fix the xor test

Co-authored-by: gaswhat <[email protected]>
Co-authored-by: Haichen Shen <[email protected]>

* feat: mitigate the long testing time by allowing partial fixed table (#198)

* bus-mapping: Add StateDB key-value database (#193)

Resolve #184

* JUMP and JUMPI opcode circuit (#176)

* first draft jump circuit

* fix operations lookup

* load bytecode from executionstep

* change comments

* remove tag&push_rindex

* remove assgin_byte_table method as unused now

* add jumpi circuit & lookup selector

* remove unused comment

* make impl_op_gadget return vec of contraint and revert lookup selector feature

* remove bytecode in bussmapping

* use vec! to simplify Vec::

* remove reset_expression

* update with latest main branch

* fix fmt check

* fix clippy

* fmt resolve

* fix ci & rebase long test time mitigation

* use select expression

* update to use dest cells intead of linear combination

Co-authored-by: Dream Wu <[email protected]>

* bus-mapping: Extend circuit_input_builder (#201)

Extend the types returned by the CircuitInputBuilder to match the
requirements from the circuits.

Rename CallContext to Call because the struct will be required for the
circuits.  Instead of keeping call metadata in a call stack, keep all
call metadata in a vector, and use a call stack with indices to this
vector.

Extend Call, Transaction, ExecStep and Block with fields required by the
circuits.

Calculate addresses in bus-mapping.

Integrate StateDB into CircuitInputBuilder and detect
InsufficientBalance and ContractAddressCollision execution errors.

Remove web3 dependency in favour of ethers-core for eth_types.

Resolve #190
Resolve #187
Resolve #180
Resolve #172

* bus-mapping: Bump ethers dependency (#208)

Remove unecessary Serialize implementations for types used in rpc
results

Resolve #179

* enable rho check selectors (#182)

* enable rho check selectors

* fix chunk rotate, 13->9 lookup, and block count check

* docs and nitpicks

* Replace with kate (#199)

* replace with kate

* fix clippy

* update dev graph

* igonore evm_word test

* fix evm word

* fix unexpected changes

* update reference

* test compilation success

* fix from_u64 and fmt

* fix test

* feat: Add get_proof RPC (#205)

* Generate AccessTrace and AccessSet (#209)

Generate a trace of state accesses from a transaction execution trace.

From a state access trace, generate a state access set.

The AccessSet will be used to query necessary State data from geth to
process transactions and generate the associated circuit inputs.

* Add integration testing with geth (#221)

Introduce a new crate `integration-tests` to do integration tests of the
rest of the crates with geth.  This crate contains a binary used to
generate data for the geth dev blockchain, and groups of integration
tests.  For now we only have the `rpc` test group.  See
`integration-tests/README.md` for more details.

Add a github action workflow that runs the integration test for the
bus-mapping rpc methods.  The action runs the `run.sh` integration test
script by steps to make it easier to see how long steps take, and to
quickly find which step fails in case of an error.

bus-mapping: Add `get_code_by_address` rpc method.

bus-mapping: Set the fields in the types returned by `get_proof` public,
and move them to `eth_types`.

Co-authored by: NoCtrlZ <[email protected]>

* Build keccak all toghether (#144)

* Add KeccakFConfig & allocation structure def

The KeccakFConfig contains all of the gadget configurations of the
gadgets plus the logic for the allocations of each of the keccak steps
on each of the regions.

This is the first design guideline that seems can fit in with the infra
we have.
Works with #105

* Remove biguint_to_pallas duplicity

* Add aux functions to switch state repr

We need to move from `FieldExt` to `BigUint` Repr in order to execute
KeccaK intermediate steps so that we can allocate all the intermediate
states of the keccak algorithm inside of the circuit.

Therefore we need functions that allow us to swap between both
representations.

* Add `assign_state` placeholders for Pi and Rho Configs

* Add 24-loop state allocation phase in KeccakConfig

* Add state_assign minus mixing stage

* Add configure initial impl for `KeccakConfig`

* Add basic b9 & b13 ROUND_CTANTS allocation

* Change gadgets state allocation to add out_state

We now also allocate the out_state of the gadget when we allocate the
entire witness for the gadget in keccak.

* Merge `next_input` and state assigment to single fn

We can simply do the assigment of the `out_state`, `state` and
`next_input` in a single function reducing the overhead and the
verbosity.

* Change `q_enable` activations to happen in `assign_state`

* Add missing offset increments in KeccakConfig allocation

* Set IotaB9Config Selector as generic Expression

* Set IotaB13 Selector as Expression

* Change AbsorbConfig design and allocation

We now allocate the Absorb as:
- State Row
- Next Mixing Row
- Out State Row

* Move state transformation fns to arith_helpers mod

* Add MixingConfig preliminary design

* Externalize state conversion functions

* Add out_state computation during `assign_state` runtime for B13 & B9

* Add `State` creation function in arith_helpers

* Change AbsorbConfig assigment to compute out_state internally

* Add assign_state_and_mixing_flag_and_rc for IotaB9Config

* Finalize first MixingConfig configure fn

* Change AbsorbConfig to copy_cell strategy

* Add IotaB13Config Cell copy constrains strategy & modify tests

* Update IotaB9Config assigment functions

* Change KeccakF circuit calls to IotaB9 and Mixing configs

* Fix `state_bigint_to_pallas` slice copy lengths

* Add mixing step to KeccakFArith

* test_absorb_gate: Witness input state to get (Cell, Value) tuples.

* Fix range of `state_to_state_bigint`

* IotaB9:_Fix test_flag wrong assignation_err

* iota_b9: Introduce q_last, q_not_last selectors.

These are used to differentiate between gates for the steady state,
and gates for the final round (where an is_mixing flag is witnessed
by the prover).

In the final round, q_last * flag is used as a composite selector.

* Add IotaB9 missing test cases

* IotaB13: Add internal selector + flag setup

With the previous setup, the gate was producing `ConstraintPoisoned` due
to the usage of `round_ctant_b13` at rotation:next to store the
`is_mixing` flag inside.

It also was activated/deactivated following the same bool logic as
IotaB9, and has been changed.

- IotaB13 now activates when `is_mixing = false` so no matter the inputs
  the verification will pass as the gate is not active.
- IotaB13 contains now an internal selector `q_mixing` which is always
  active and prevents the gate equations to fail due to queriyng
  `round_ctant_b13` cells that they shouldn't.

This completes all the development needed for IotaB9 and IotaB13 in
order to add them inside the `MixingConfig` and so work towards closing
issue #105

* Absorb: Add internal selector + flag setup

With the previous setup, the gate was producing `ConstraintPoisoned` due
to the usage of `absorb_next_inputs` at rotation:next to store the
`is_mixing` flag inside.

It also was activated/deactivated following the same bool logic as
IotaB9, and has been changed.

- Absorb now activates when `is_mixing = false` so no matter the inputs
  the verification will pass as the gate is not active.
- Absorb contains now an internal selector `q_mixing` which is always
  active and prevents the gate equations to fail due to queriyng
  `absorb_next_inputs` cells that they shouldn't.

ASSIGNATION MAP:
- STATE (25 columns) (offset -1)
- NEXT_INPUTS (17 columns) + is_mixing flag (1 column) (offset +0) (current rotation)
- OUT_STATE (25 columns) (offset +1)

This completes all the development needed for `AbsorbConfig` in
order to add them inside the `MixingConfig` and so work towards closing
issue #105

* Add state computation fn's for configs

It's much easier, clean and less verbose to compute
`in_state`, `out_state` and `next_inputs` with an associated function
for the MixingConfig sub-configs. And also makes the tests much less
verbose.

* Update StateBigint in compute_states signatures

* Mixing: Add `MixingConfig` impl + tests lacking base conversion

* mixing: Witness flag in state assignation

* Rho: Derive `Debug` for all configs

* xi: Apply copy_constraints for xi inputs

It is critical for the correctness of the keccak circuit to apply copy
constraints between the gates while executing the rounds.

Works towards solving: #219

* Add OFFSET associated consts

* Ignore failing Mixing tests

* Clippy fixes

* Replace pallas by field

* Add zeroed_bytes assertion

Co-authored-by: ying tong <[email protected]>

* use (Cell, F) (#224)

* Make gadgets to handle an execution state instead of an opcode per step (#196)

* feat(bus-mapping): implment ToLittleEndian for U256

* refactor: refactor EvmCircuit and all *Gadgets with ConstraintBuilder (without MemoryGadget)

* feat: add execution gadget name and constraint names for easier debugging

* feat: refactor MemoryGadget with ConstraintBuilder

* feat: refactor all with SameContextGadget for opcode and gas_left check

* feat: add ErrorOOGPureMemoryGadget as original MemoryGadget's OOG handler

* feat: make struct in bus_mapping_tmp be like the being implemented one in bus_mapping

* feat: make EvmCircuit pub for further benchs and examples usage

* feat: add bitwise gadgets back as a single AndGadget

* feat: assign transaction context

* feat: test AND, OR, XOR in the same trace to further shorten testing time

* feat: fix comment of ADD, add comment for PUSH

* chore: remove Range17 table

* chore: add rw_lookup and rw_lookup_at for all read/write lookup

* feat: refactor util and extend AddWordsGadget to add N words

* feat: adopt JumpGadget and JumpiGadget from upstream with new interface

* fix: add missing execution result ErrorOutOfGasCodeStore

* chore: cap jump and jumpi's testing time as k upto 11

* fix: pass test after rebasing

* chore: remove moved files

* feat: add number of cells used for StepState into param as constant

* chore: rename ExecutionResult to ExecutionState

* chore: rename ExecutionResult to ExecutionState

* chore: rename StateTransition to StepStateTransition

* chore: rename q_execution_state to execution_state_selector

* chore: renaming ExecutionState BITWISE, CMP, SCMP, MEMORY

* fix: fix name and_gadget to bitwise_gadget

* chore: calculate rotation_offset from state instead of hardcoding

* chore: add comment on opcode_source and update namings

* fix: use OpcodeId for checking whether an u8 is PUSH*

* fix: remove incorrect comments

* fix: add more docs

* fix: improve comment

* chore: init array with same value F::zero() and length

* fix: use *_lookup_with_counter instead of *_lookup_inner

* feat: add docs on Lookup and its variants

* fix: make MemoryExpansionGadget's expression method more straightforward

* Circuit benchmarks addition to workspace (#226)

* Add bench profile to workspace Cargo.toml

* Add benchmark running rules to Makefile

* Change CI to test the benchmarks without run

* Add circuit-benchmarks crate

This crate is responsible for allowing to run the circuit
benchmarks on a more easy and clean way.

* Update visibility of Circuit structs to allow benchmarks

* Compile crate before checking rustfmt

* Fix rebase unused_imports

* Add state_circuit module during build.rs run

* Change to more descriptive env var error messages

Co-authored-by: Eduard S. <[email protected]>

* Fix Makefile and CI

* Fix ethers dep to pull grom git

While a new version is not published in crates.io, we need to pull from
git.

* Change state_circuit generation from build.rs

* Update evm_circuit to latest main version

Co-authored-by: Han <[email protected]>

* Fix contract deployment breaking change issues

`ethers-solc` had a breaking change within patch versions.
This solves it while we still depend on the git dep.

* Update solc version used in integration CI job to 0.8.10

Co-authored-by: Eduard S. <[email protected]>

Co-authored-by: Eduard S. <[email protected]>
Co-authored-by: Han <[email protected]>

* chore: add Cargo.lock (#232)

* chore: add Cargo.lock

* sync with main

* docs: fix typos (#229)

* gitignore circuit_benchmarks bench_params (#238)

* radical Pi (#234)

* Update Theta to copy state Cells for in/out (#241)

* Update Theta to copy state Cells for in/out

As stated in #219, the gates need to apply copy constraints between the
input cells and the witnessed values to ensure correctness between
keccak steps.

Also, now the state_assignation fn returns `out_state` as `[(Cell,F);25]` instead of simply the `F` values.

* Fix nit for arr + vec creation order

Co-authored-by: Chih Cheng Liang <[email protected]>

* Use Layouter instead of `Region` + `offset`

* bus-mapping: Extend CircuitInputBuilder (#235)

- CircuitInputBuilder:
    - Fix `gen_state_access_trace` by splitting the code and address in the
      context of a call.
    - Add `codes` field in the CircuitInputBuilder to keep a mapping of
      code hash -> code.
    - When doing the `gen_associated_ops` step for opcodes not yet
      implemented, instead of panic show a log warning, so that we can
      generate circuit inputs for blocks eventhough the implementation
      is not complete.  This will allow performing integration tests.
    - Resolve #207
- rpc:
    - Add `eth_coinbase` and `eth_chainId` methods.
    - Remove `BlockNumber` in favour of the implementation in `ethers`.
- General:
    - Replace usage of `BlockConstants` by the new struct
      `ChainConstants`.  This way we split constant parameters of the
      chain into `ChainConstants` and block parameters into `Block`.
      `BlockConstants` is now only used by the external_tracer.
    - Move `BlockConstants` from `bus-mapping/src/exec_trace.rs` to
      `bus-mapping/src/external_tracer.rs`.
    - Implement the Debug trait for some types manually to make debug
      output nicer.
    - Introduce a `circuit_input_builder` integration test with geth.
      The test builds the circuit inputs for the block where the
      Greeter.sol contract is deployed, up to step 5 from
      #222 (whith
      some missing parts)
    - Fix `mload` by allowing memory reads at addresses higher than the
      memory size found in the trace (in such case, a 0 value is read)

* Construct EVM circuit test inputs from Geth trace (#239)

* construct evm circuit test inputs from geth trace

* add `mstore8_opcode_impl` test (#22)

* WHOLEWORD -> IS_MSTORE8

* clean up

clean up

* more docs

* Update zkevm-circuits/src/evm_circuit/witness.rs

Co-authored-by: Han <[email protected]>

* Update zkevm-circuits/src/evm_circuit/witness.rs

Co-authored-by: Han <[email protected]>

* fix conflicts caused by merge

fix conflicts caused by merge

fix conflicts caused by merge

* fix needless_borrow

* combine imports

* set expected value explicitly for mstore8_opcode_impl test

* use larger value for mstore8_opcode_impl test

* more clean up

* remove TODOs

fix typos

Co-authored-by: HAOYUatHZ <[email protected]>
Co-authored-by: HAOYUatHZ <[email protected]>
Co-authored-by: Han <[email protected]>

* rebasing

* branch json added; assignment of s_advices and c_advices

* some initial branch constraints

* keccak table; fixes

* keccak lookup simulation

* non assignment errors fixed

* some docs

* row type info integrated

* simulation of keccak lookups now works

* renaming

* test path changed

* printlns removed

* two layer test added

* branch children constraints

* branch children constraints

* some keccak related constraints

* fixing keccak constraints

* fixed keccak constraint problem

* keccak constraints

* into keccak words constraints

* started on branch hashing

* initial branch acc constraints

* minor changes

* assigning branch random linear accumulator

* Branch accumulator chip

* branch RLP row assigned after all branch nodes

* is_branch_rlp removed; will be replace by lookup into rlp circuit

* keccak leaf row removed; leaf key rows added

* constraints for key hex -> nibbles

* leaf key compression constraints

* key compression constraints moved into a chip

* leaf key c removed as both branches have the same key

* Branches of different (RLP) length supported

* key length considered when checking key compression

* key rlc acc

* leaf key checked to have zeros after nibbles end

* fixing key RLC

* all key rlc constraints

* branch RLC keccak lookups

* leaf hash constraints reanbled with RLC

* leaf hash chip

* account leaf selectors added

* acount leaf assignments

* accout leaf key constraints

* account_leaf_nonce_balance partially implemented

* account leaf nonce balance multiplier constraints now work

* account leaf nonce balance constraints for zeros after nonce and balance end

* r_table generated outside chips

* account leaf storage codehash chip

* missing rlp meta data  bytes added in nonce balance

* account leaf hash checked to be in the parent branch

* witness updated

* key (address) rlc distinguished for account and storage proof

* storage root in account leaf constraint

* address compression

* Address compression for even addresses

* Key compression constraints for long RLPs

* key compression long RLP even length

* separate row for leaf value

* hash accumulator for leaf

* storage leaf generalized for short and long RLPs

* branch S and C can have different number of RLP meta data bytes

* r_table removed 1 from first position

* r_table instead of curr_r in account_leaf_nonce_balance

* fixing r_table

* branch_acc now uses r_table

* nibbles removed

* key rlc changed from nibbles to bytes

* leaf key RLC enabled on bytes instead of nibbles

* leaf storage key rlc reimplemented with bytes (instead of nibbles)

* account address now uses bytes for rlc (instead of nibbles); additionally, nonce balance c row has been removed

* nonce balance C removed; fix in leaf_key

* key_compr and address_compr removed

* switched to appliedzkp/halo2

Co-authored-by: Scroll Dev <[email protected]>
Co-authored-by: mask-pp <[email protected]>
Co-authored-by: gaswhat <[email protected]>
Co-authored-by: Brecht Devos <[email protected]>
Co-authored-by: Eduard S <[email protected]>
Co-authored-by: CPerezz <[email protected]>
Co-authored-by: Han <[email protected]>
Co-authored-by: Carlos Pérez <[email protected]>
Co-authored-by: ash <[email protected]>
Co-authored-by: Dream Wu <[email protected]>
Co-authored-by: Chih Cheng Liang <[email protected]>
Co-authored-by: Eduard S. <[email protected]>
Co-authored-by: Haichen Shen <[email protected]>
Co-authored-by: Tengfei Niu <[email protected]>
Co-authored-by: ying tong <[email protected]>
Co-authored-by: Zhang Zhuo <[email protected]>
Co-authored-by: HAOYUatHZ <[email protected]>
Co-authored-by: HAOYUatHZ <[email protected]>
Co-authored-by: Miha Stopar <[email protected]>
  • Loading branch information
20 people authored Dec 21, 2021
1 parent b52832a commit aba9d1f
Show file tree
Hide file tree
Showing 161 changed files with 22,283 additions and 9,426 deletions.
4 changes: 2 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[build]
rustflags = ["-C", "link-args=-framework CoreFoundation -framework Security"]
[target.'cfg(target_os="macos")']

29 changes: 26 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: CI checks

on: [push, pull_request]
on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]

## `actions-rs/toolchain@v1` overwrite set to false so that
## `actions-rs/toolchain@v1` overwrite set to false so that
## `rust-toolchain` is always used and the only source of truth.

jobs:
test:
if: github.event.pull_request.draft == false

name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -24,9 +28,11 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --release --all --all-features
args: --verbose --release --all --all-features --exclude integration-tests --exclude circuit-benchmarks

build:
if: github.event.pull_request.draft == false

name: Build target ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
Expand All @@ -47,8 +53,16 @@ jobs:
with:
command: build
args: --all-features
# Make sure benchmarks compile.
- name: cargo build benchmarks no-run
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --release --all-features -p circuit-benchmarks --no-run

bitrot:
if: github.event.pull_request.draft == false

name: Bitrot check
runs-on: ubuntu-latest

Expand All @@ -65,6 +79,8 @@ jobs:
args: --benches --examples --all-features

doc-links:
if: github.event.pull_request.draft == false

name: Intra-doc links
runs-on: ubuntu-latest

Expand All @@ -87,6 +103,8 @@ jobs:
args: --all --document-private-items

fmt:
if: github.event.pull_request.draft == false

name: Rustfmt
timeout-minutes: 30
runs-on: ubuntu-latest
Expand All @@ -95,6 +113,11 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
override: false
- name: cargo check
uses: actions-rs/cargo@v1
with:
command: check
args: --all-features
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Integration Tests

on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]

jobs:
integration-tests:
if: github.event.pull_request.draft == false

name: Integration Tests
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./integration-tests
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
override: false
- name: Set PATH
run: echo "${HOME}/bin" >> $GITHUB_PATH
- name: Install Solc
run: |
mkdir -p "$HOME/bin"
wget -q https://github.com/ethereum/solidity/releases/download/v0.8.10/solc-static-linux -O $HOME/bin/solc
chmod u+x "$HOME/bin/solc"
solc --version
# Run an initial build in a sepparate step to split the build time from execution time
- name: Build gendata bin
run: cargo build --bin gen_blockchain_data
- run: ./run.sh --steps "setup"
- run: ./run.sh --steps "gendata"
- run: ./run.sh --steps "tests" --tests "rpc"
- run: ./run.sh --steps "tests" --tests "circuit_input_builder"
- run: ./run.sh --steps "cleanup"
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@

name: Stable lints
name: Lints

# We only run these lints on trial-merges of PRs to reduce noise.
on: pull_request
on:
pull_request:
types: [synchronize, opened, reopened, ready_for_review]

jobs:
clippy:
name: Clippy (1.53.0)
if: github.event.pull_request.draft == false

name: Clippy
timeout-minutes: 30
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.53.0
components: clippy
override: true
override: false
- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
name: Clippy (1.53.0)
name: Clippy
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/target
*.png
Cargo.lock
.vscode
.DS_Store

Loading

0 comments on commit aba9d1f

Please sign in to comment.