Skip to content

Commit ad1c754

Browse files
authored
chore(examples): Bump aligned-sdk in examples to v0.7.2 (#1079) (#1098)
2 parents 23d5eca + c771d51 commit ad1c754

File tree

6 files changed

+40
-14
lines changed

6 files changed

+40
-14
lines changed

docs/3_guides/3_validating_public_input.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,13 @@ cast send --rpc-url https://ethereum-holesky-rpc.publicnode.com <CONTRACT_ADDRES
211211

212212
The proof submission and verification can be done either with the SDK or by using the Aligned CLI.
213213

214-
To submit the proof generated in this example, run `make submit_fibonacci_proof`. This will output the `AlignedVerificationData` needed to send to the `verifyBatchInclusion` method of the contract in the `batch_inclusion_data` directory inside `aligned-integration`.
214+
To submit the proof generated in this example, run:
215215

216-
For more details on submitting proofs, refer to the [submitting proofs guide](0_submitting_proofs.md).
216+
```sh
217+
export KEYSTORE_PATH=<LOCAL_KEYSTORE_PATH>
218+
make submit_fibonacci_proof
219+
```
220+
221+
This will output the `AlignedVerificationData` needed to send to the `verifyBatchInclusion` method of the contract in the `batch_inclusion_data` directory inside `aligned-integration`.
222+
223+
For more details on submitting proofs and setting up a local wallet keystore, refer to the [submitting proofs guide](0_submitting_proofs.md).

examples/validating-public-input/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ generate_risc_zero_fibonacci_proof:
55

66
submit_fibonacci_proof:
77
@cd aligned-integration && \
8-
RUST_LOG=info cargo run --release
8+
RUST_LOG=info cargo run --release -- --keystore-path $(KEYSTORE_PATH)
99

1010
deploy_fibonacci_validator:
1111
@. ./contracts/.env && . ./contracts/deploy.sh

examples/validating-public-input/aligned-integration/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
aligned-sdk = { git = "https://github.com/yetanotherco/aligned_layer", tag = "v0.6.0" }
7+
aligned-sdk = { git = "https://github.com/yetanotherco/aligned_layer", tag = "v0.7.2" }
88
tokio = { version = "1.37.0", features = [
99
"io-std",
1010
"time",
@@ -21,3 +21,5 @@ serde = { version = "1.0.201", features = ["derive"] }
2121
serde_json = "1.0.117"
2222
log = "0.4.21"
2323
env_logger = "0.11.3"
24+
clap = { version = "4.5.8", features = ["derive"] }
25+
rpassword = "7.3.1"

examples/validating-public-input/aligned-integration/src/main.rs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ use aligned_sdk::core::errors::SubmitError;
88
use aligned_sdk::core::types::Chain::Holesky;
99
use aligned_sdk::core::types::{AlignedVerificationData, ProvingSystemId, VerificationData};
1010
use aligned_sdk::sdk::{get_next_nonce, submit_and_wait_verification};
11+
use clap::Parser;
1112
use env_logger::Env;
1213
use ethers::signers::{LocalWallet, Signer};
13-
use ethers::types::Address;
14+
use ethers::types::{Address, U256};
1415
use ethers::utils::hex;
1516
use log::info;
1617

@@ -22,13 +23,27 @@ const PUB_INPUT_FILE_PATH: &str = "../risc_zero/fibonacci_proof_generator/risc_z
2223
const IMAGE_ID_FILE_PATH: &str =
2324
"../risc_zero/fibonacci_proof_generator/risc_zero_fibonacci_id.bin";
2425
const PROOF_GENERATOR_ADDRESS: &str = "0x66f9664f97F2b50F62D13eA064982f936dE76657";
25-
// Set to the 9th address of anvil that doesn't pay for the proof submission
26-
const WALLET_PRIVATE_KEY: &str = "2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6";
26+
27+
#[derive(Parser, Debug)]
28+
#[command(version, about, long_about = None)]
29+
struct Args {
30+
#[arg(short, long)]
31+
keystore_path: String,
32+
}
2733

2834
#[tokio::main]
2935
async fn main() -> Result<(), SubmitError> {
3036
env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
3137

38+
let args = Args::parse();
39+
40+
let keystore_password = rpassword::prompt_password("Enter keystore password: ")
41+
.expect("Failed to read keystore password");
42+
43+
let wallet = LocalWallet::decrypt_keystore(args.keystore_path, &keystore_password)
44+
.expect("Failed to decrypt keystore")
45+
.with_chain_id(17000u64);
46+
3247
let proof = read_file(PathBuf::from(PROOF_FILE_PATH)).unwrap_or_default();
3348

3449
let pub_input = read_file(PathBuf::from(PUB_INPUT_FILE_PATH));
@@ -50,10 +65,8 @@ async fn main() -> Result<(), SubmitError> {
5065
proof_generator_addr,
5166
};
5267

53-
// Create a wallet and set chain id to holesky
54-
let wallet = LocalWallet::from_str(WALLET_PRIVATE_KEY)
55-
.expect("Failed to create wallet")
56-
.with_chain_id(17000u64);
68+
// Set a fee of 0.1 Eth
69+
let max_fee = U256::from(5) * U256::from(100_000_000_000_000_000u128);
5770

5871
let nonce = get_next_nonce(RPC_URL, wallet.address(), BATCHER_PAYMENTS_ADDRESS)
5972
.await
@@ -65,6 +78,7 @@ async fn main() -> Result<(), SubmitError> {
6578
RPC_URL,
6679
Holesky,
6780
&verification_data,
81+
max_fee,
6882
wallet,
6983
nonce,
7084
BATCHER_PAYMENTS_ADDRESS,

examples/zkquiz/quiz/script/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2021"
66

77
[dependencies]
88
sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", rev = "v1.0.1" }
9-
aligned-sdk = { git = "https://github.com/yetanotherco/aligned_layer", tag = "v0.6.0" }
9+
aligned-sdk = { git = "https://github.com/yetanotherco/aligned_layer", tag = "v0.7.2" }
1010
ethers = { tag = "v2.0.15-fix-reconnections", features = [
1111
"ws",
1212
"rustls",

examples/zkquiz/quiz/script/src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::str::FromStr;
55
use std::sync::Arc;
66

77
use aligned_sdk::core::types::{AlignedVerificationData, Chain, ProvingSystemId, VerificationData};
8-
use aligned_sdk::sdk::{submit_and_wait_verification, get_next_nonce};
8+
use aligned_sdk::sdk::{get_next_nonce, submit_and_wait_verification};
99
use clap::Parser;
1010
use dialoguer::Confirm;
1111
use ethers::prelude::*;
@@ -106,6 +106,8 @@ async fn main() {
106106
pub_input: None,
107107
};
108108

109+
// Set a `max_fee` of 0.5 Eth
110+
let max_fee = U256::from(5) * U256::from(100_000_000_000_000_000u128);
109111
let nonce = get_next_nonce(&rpc_url, wallet.address(), BATCHER_PAYMENTS_ADDRESS)
110112
.await
111113
.expect("Failed to get next nonce");
@@ -115,6 +117,7 @@ async fn main() {
115117
&rpc_url,
116118
Chain::Holesky,
117119
&verification_data,
120+
max_fee,
118121
wallet.clone(),
119122
nonce,
120123
BATCHER_PAYMENTS_ADDRESS,
@@ -136,7 +139,7 @@ async fn main() {
136139
{
137140
println!("Failed to claim prize: {:?}", e);
138141
}
139-
},
142+
}
140143
Err(e) => {
141144
println!("Proof verification failed: {:?}", e);
142145
}

0 commit comments

Comments
 (0)