|
| 1 | +# Validating public input |
| 2 | + |
| 3 | +## Testing locally |
| 4 | + |
| 5 | +Set up all the components of aligned locally following the [aligned setup guide](../../docs/3_guides/6_setup_aligned.md). |
| 6 | + |
| 7 | +This example is designed to do either with SP1 or risc0 proofs these are the commands to use depending on which verifier want to be used. |
| 8 | + |
| 9 | +### Risc0 |
| 10 | + |
| 11 | +1. `make generate_risc0_fibonacci_proof` |
| 12 | + |
| 13 | +2. `make submit_fibonacci_risc0_proof_devnet` |
| 14 | + |
| 15 | +> The batch needs at least two proofs to be sealed, in another terminal run `make batcher_send_risc0_task` to actually submit the batch to aligned. |
| 16 | +
|
| 17 | +The command will log the file where all the aligned verification data was saved like so: |
| 18 | + |
| 19 | +``` |
| 20 | +[2024-10-09T15:54:42Z INFO aligned_integration] Saved batch inclusion data to ".../aligned_test/examples/validating-public-input/aligned-integration/batch_inclusion_data/<DATA_FILE_NAME>" |
| 21 | +``` |
| 22 | + |
| 23 | +Save the name since it will be necessary, you can found it in the path logged in the previous command otherwise. |
| 24 | + |
| 25 | +3. `make deploy_fibonacci_validator_devnet` |
| 26 | + |
| 27 | +The command will log the address where the validator was deployed: |
| 28 | + |
| 29 | +``` |
| 30 | +##### anvil-hardhat |
| 31 | +✅ [Success]Hash: 0xe0c216a3a24d5bd0551924592e42c6d96a889e3082ba3d7fff413336fba66815 |
| 32 | +Contract Address: 0x5081a39b8A5f0E35a8D959395a630b68B74Dd30f |
| 33 | +Block: 585 |
| 34 | +Paid: 0.000000000005889224 ETH (736153 gas * 0.000000008 gwei) |
| 35 | +``` |
| 36 | + |
| 37 | +save the contract address for the next command. |
| 38 | + |
| 39 | +4. `make verify_risc0_batch_inclusion_devnet FIBONACCI_VALIDATOR_ADDRESS=<FIBONACCI_VALIDATOR_ADDRESS> DATA_FILE_NAME=<DATA_FILE_NAME>` |
| 40 | + |
| 41 | +Where `FIBONACCI_VALIDATOR_ADDRESS` is the address of the deployed validator contract and `DATA_FILE_NAME` the name of the file where the aligned verification data was saved (including the extension `.json`). |
| 42 | + |
| 43 | +If everything goes well you should see a transaction receipt with a `success` label in the status: |
| 44 | + |
| 45 | +``` |
| 46 | +... |
| 47 | +root <ROOT_HASH> |
| 48 | +status 1 (success) |
| 49 | +transactionHash <TX_HASH> |
| 50 | +... |
| 51 | +``` |
| 52 | + |
| 53 | +### SP1 |
| 54 | + |
| 55 | +1. `make generate_sp1_fibonacci_proof` |
| 56 | + |
| 57 | +2. `make submit_fibonacci_sp1_proof_devnet` |
| 58 | + |
| 59 | +> The batch needs at least two proofs to be selaed, in another terminal run `make batcher_send_sp1_task` to actually submit the batch to aligned. |
| 60 | +
|
| 61 | +The command will log the file where all the aligned verification data was saved like so: |
| 62 | + |
| 63 | +``` |
| 64 | +[2024-10-09T15:54:42Z INFO aligned_integration] Saved batch inclusion data to "aligned-layer/examples/validating-public-input/aligned-integration/batch_inclusion_data/<DATA_FILE_NAME>" |
| 65 | +``` |
| 66 | + |
| 67 | +Save the name since it will be necessary, you can found it in the path logged in the previous command otherwise. |
| 68 | + |
| 69 | +3. `make deploy_fibonacci_validator_devnet` |
| 70 | + |
| 71 | +The command will log the address where the validator was deployed: |
| 72 | + |
| 73 | +``` |
| 74 | +##### anvil-hardhat |
| 75 | +✅ [Success]Hash: 0xe0c216a3a24d5bd0551924592e42c6d96a889e3082ba3d7fff413336fba66815 |
| 76 | +Contract Address: 0x5081a39b8A5f0E35a8D959395a630b68B74Dd30f |
| 77 | +Block: 585 |
| 78 | +Paid: 0.000000000005889224 ETH (736153 gas * 0.000000008 gwei) |
| 79 | +``` |
| 80 | + |
| 81 | +save the contract address for the next command. |
| 82 | + |
| 83 | +4. `make verify_sp1_batch_inclusion_devnet FIBONACCI_VALIDATOR_ADDRESS=<FIBONACCI_VALIDATOR_ADDRESS> DATA_FILE_NAME=<DATA_FILE_NAME>` |
| 84 | + |
| 85 | +Where `FIBONACCI_VALIDATOR_ADDRESS` is the address of the deployed validator contract and `DATA_FILE_NAME` the name of the file where the aligned verification data was saved (including the extension `.json`). |
| 86 | + |
| 87 | +If everything goes well you should see a transaction receipt with a `success` label in the status: |
| 88 | + |
| 89 | +``` |
| 90 | +... |
| 91 | +root <ROOT_HASH> |
| 92 | +status 1 (success) |
| 93 | +transactionHash <TX_HASH> |
| 94 | +... |
| 95 | +``` |
0 commit comments