metacraft-labs / DendrETH

A smart contract implementation of the Ethereum light client sync protocol
GNU General Public License v3.0
44 stars 9 forks source link

refactor: Move files and update paths #319

Closed smanilov closed 2 months ago

smanilov commented 2 months ago

refactor: Move files and update paths

There are no functional changes.

The manual testing procedure results in a success.

(Manual testing procedure: https://coda.io/d/R-D_dqNv6ZkeyaI/manual-testing_suo6Y ) (Also copied at the end of this commit message, in case you don't have access to Coda.)

When navigating to the directories containing the two affected Cargo.toml files followed by cargo build results in successful builds with no warnings or errors:

$ pushd beacon-light-client/plonky2/crates/circuit_executables
$ cargo build
[success]
$ popd
$ pushd beacon-light-client/plonky2/crates/circuits
$ cargo build
[success]
$ popd

Running the TypeScript checks passes.

yarn check:build
Setting $USER_PRIVATE_KEY to $LOCAL_HARDHAT_PRIVATE_KEY as fallback
Nothing to compile

Manual testing procedure (copied from Coda):

  1. Manually test the Commitment Mapper.
For each of these commands, make sure you're in the DendrETH root.
Make sure to start from a clean state:
 - this means `git status` returns "nothing to commit, working tree clean"

In one terminal, start Redis server.
$ redis-server

In another terminal, run redis-commander.
$ yarn install
$ yarn redis-commander

In another terminal, fetch validators; limit to 32, because there are millions.
$ cd beacon-light-client/plonky2/input_fetchers
$ yarn ts validators_commitment_mapper/runnable/run_scheduler.ts --take 32

Note: the last dir/file is moved from the following in [main]:
cd beacon-light-client/plonky2/
yarn ts validators_commitment_mapper_tree/get_changed_validators.ts --take 32
This does not finish; continue once the output changes from "Syncing 9128780/9128787..." to "Syncing 9128814..." (exact numbers don't matter).
This should take around 30 seconds.

In a different terminal, build the commitment mapper circuit and serialize it.
$ cd beacon-light-client/plonky2/crates/circuit_executables/
$ cargo run --bin commitment_mapper_circuit_data_generation --release
This takes around 45 seconds.
in [main] this is in beacon-light-client/plonky2/circuits_executables/

In the same terminal, start performing proofs.
$ cargo run --bin commitment_mapper --release -- --proof-storage-type file --folder-name ~/code/repos/metacraft-labs/proof_storage
This should finish with a "Waiting for task..." message on success
This takes around 6 minutes.
  1. Once you’ve tested the correct behavior of the Commitment Mapper, do the same for the DIVA
In the same terminal, fetch validators; limit to 32, because there are millions.
$ cd -
$ cd beacon-light-client/plonky2/input_fetchers
$ yarn ts balance_verification/withdrawal_credentials/runnable/run_scheduler.ts  --take 32 --withdraw-credentials 0x01000000000000000000000015f4b914a0ccd14333d850ff311d6dafbfbaa32b --protocol diva

Note: the last dir/file is moved from the following in [main]:
cd beacon-light-client/plonky2/
yarn ts balance_verification/get_balances_input_runner.ts --take 32 --withdraw-credentials 0x01000000000000000000000015f4b914a0ccd14333d850ff311d6dafbfbaa32b --protocol diva

In the same terminal, build the balance verification circuit and serialize it.
$ cd -
$ cd beacon-light-client/plonky2/crates/circuit_executables/
$ cargo run --bin balance_verification_circuit_data_generation --release
Again, in [main], this is here:
cd beacon-light-client/plonky2/circuits_executables/
cargo run --bin balance_verification_circuit_data_generation --release
This takes around 1 minute.

Start performing proofs.
$ ./run.sh 0 diva
This should finish with a "No task left in queue" message on success
This takes around 2 minutes.

run.sh will report a directory where it writes data, e.g.
--folder-name /home/stan/code/repos/metacraft-labs/proof_storage
You should use the same folder for the last step:

$ cargo run --bin final_layer --release -- --proof-storage-type file --folder-name ~/code/repos/metacraft-labs/proof_storage --protocol diva

This should finish with no errors and a "Wrapper finished!" message
It should take around 1 minute.

Once testing is done, do the following to get back to a clean state:
Stop redis-server and redis-commander, then
$ git restore .
$ git clean -f
smanilov commented 2 months ago

Closing, because same code was merged by @Xearty