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

Commit

Permalink
Split out MerkleTree contract and emit CapeBlock as part of BlockComm…
Browse files Browse the repository at this point in the history
…itted event (#1097)

* Emit CapeBlock as part of BlockCommitted event

* Run cargo update

* Emit block data fields individually

If we emit the CapeBlock struct directly this leads to a compilation
error. The workaround to emit ABI encoded bytes instead fails to decode
the CapeBlock in rust struct at runtime. This workaround emits the
ABI encoded fields of CapeBlock individually.

The function `decode_cape_block` uses an ugly workaround to deal with
the problem of not being able to import `BlockCommittedFilter` because
that type exists both for `CAPE` and `TestCAPE` and is therefore
ambiguous.

* cargo update to get latest ethers-rs version

* Remove ambigous type workaround

* Organize imports

* [WIP] Separate merkle tree contract

- Create ownable merkle tree contract owned by CAPE.

* undo unwanted changes

* Add missing file

* All tests pass.

- Add missing public getters.
- Remove tree height constructor arg from CAPE.

* Update hardcoded contract addresses

* Check access control of merkle tree contract

After running `hardhat deploy` check that

1. The merkle tree contract is owned by the CAPE contract.
2. The deployer can no longer add elements to the merkle tree.

* Fix typescript tests

* Fix typo

* Use 1000 solc optimizer runs instead of 20

Using a really high (e.g. 1M) number does have a significant
impact on gas usage but also leads to a contract that is too
big to deploy. With 1000 runs the CAPE contract is as 22.5 kB
so there is still room to make changes to the contract.

* Build executables before exporting wallet docs

* More consistency

* Remove the geth patch that enables >24kB contracts

* Revert "Remove the geth patch that enables >24kB contracts"

This reverts commit b716ae2.

Re-enable failing compilation if CAPE code is > 24kB

The TestCAPE contract is still too big unless we use a very low number
of optimizer runs.

* Update smart contract architecture diagram
  • Loading branch information
sveitser authored Jun 3, 2022
1 parent 28feea1 commit 60e6557
Show file tree
Hide file tree
Showing 26 changed files with 1,236 additions and 921 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- uses: cachix/cachix-action@v10
with:
name: espresso-systems-private
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"

- uses: actions/checkout@v2
name: Checkout Repository
Expand Down Expand Up @@ -68,6 +68,9 @@ jobs:
- name: Generate Docs
run: nix-shell --run "prepend-timestamps make-doc"

- name: Build all executables
run: nix-shell --run "cargo build --release"

- name: Generate Wallet
run: ./target/release/export-wallet-api-docs --api ./wallet/api/api.toml --assets ./wallet/public/ ./doc/mdbook/book/wallet

Expand All @@ -79,9 +82,6 @@ jobs:
publish_dir: ./doc/mdbook/book/
cname: cape.docs.espressosys.com

- name: Build all executables
run: nix-shell --run "cargo build --release"

- name: Build demo geth data dir
run: nix-shell --run "demo/initialize-demo-geth"

Expand Down
Loading

0 comments on commit 60e6557

Please sign in to comment.