Skip to content

Commit cc3a360

Browse files
authored
hotfix: add flag to use random addresses for proof_generator_addr in Aligned CLI (#1850)
1 parent 8819bec commit cc3a360

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

alerts/sender_with_alert.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ do
111111
--proof "./scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/ineq_${x}_groth16.proof" \
112112
--public_input "./scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/ineq_${x}_groth16.pub" \
113113
--vk "./scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/ineq_${x}_groth16.vk" \
114-
--proof_generator_addr $SENDER_ADDRESS \
115114
--private_key $PRIVATE_KEY \
116115
--rpc_url $RPC_URL \
117116
--network $NETWORK \
118117
--max_fee 0.004ether \
118+
--random_address \
119119
2>&1)
120120

121121
echo "$submit"

batcher/aligned/src/main.rs

+28-1
Original file line numberDiff line numberDiff line change
@@ -88,42 +88,61 @@ pub struct SubmitArgs {
8888
default_value = "http://localhost:8545"
8989
)]
9090
eth_rpc_url: String,
91+
9192
#[arg(name = "Proving system", long = "proving_system")]
9293
proving_system_flag: ProvingSystemArg,
94+
9395
#[arg(name = "Proof file path", long = "proof")]
9496
proof_file_name: PathBuf,
97+
9598
#[arg(name = "Public input file name", long = "public_input")]
9699
pub_input_file_name: Option<PathBuf>,
100+
97101
#[arg(name = "Verification key file name", long = "vk")]
98102
verification_key_file_name: Option<PathBuf>,
103+
99104
#[arg(name = "VM prgram code file name", long = "vm_program")]
100105
vm_program_code_file_name: Option<PathBuf>,
106+
101107
#[arg(
102108
name = "Number of repetitions",
103109
long = "repetitions",
104110
default_value = "1"
105111
)]
106112
repetitions: usize,
113+
107114
#[arg(
108115
name = "Proof generator address",
109116
long = "proof_generator_addr",
110117
default_value = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
111118
)] // defaults to anvil address 1
112119
proof_generator_addr: String,
120+
113121
#[arg(
114122
name = "Aligned verification data directory Path",
115123
long = "aligned_verification_data_path",
116124
default_value = "./aligned_verification_data/"
117125
)]
118126
batch_inclusion_data_directory_path: String,
127+
119128
#[command(flatten)]
120129
private_key_type: PrivateKeyType,
130+
121131
#[arg(name = "Nonce", long = "nonce")]
122132
nonce: Option<String>, // String because U256 expects hex
133+
123134
#[clap(flatten)]
124135
network: NetworkArg,
136+
125137
#[command(flatten)]
126138
fee_type: FeeType,
139+
140+
#[arg(
141+
name = "Random Address",
142+
long = "random_address",
143+
default_value = "false"
144+
)]
145+
random_address: bool,
127146
}
128147

129148
impl SubmitArgs {
@@ -516,7 +535,15 @@ async fn main() -> Result<(), AlignedError> {
516535

517536
let verification_data = verification_data_from_args(&submit_args)?;
518537

519-
let verification_data_arr = vec![verification_data; repetitions];
538+
let mut verification_data_arr = vec![verification_data; repetitions];
539+
540+
// If random_address flag is enabled, change every address with a random value
541+
if submit_args.random_address {
542+
info!("Randomizing proof generator address for each proof...");
543+
for verification_data in verification_data_arr.iter_mut() {
544+
verification_data.proof_generator_addr = Address::random();
545+
}
546+
}
520547

521548
info!("Submitting proofs to the Aligned batcher...");
522549

docs/3_guides/9_aligned_cli.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ Submit a proof to the Aligned Layer batcher.
8686
- `--default_fee_estimate`: Specifies a `max_fee` equivalent to the cost of 1 proof in a batch of size 10.
8787
- `--instant_fee_estimate`: Specifies a `max_fee` that ensures the proof is included instantly, equivalent to the cost of a proof in a batch of size 1.
8888
- `--custom_fee_estimate <amount_of_proofs_in_batch>`: Specifies a `max_fee` equivalent to the cost of 1 proof in a batch of size `num_proofs_in_batch`.
89-
89+
- `random_address`: If set, random addresses will be used as `proof_generator_addr` for each proof.
90+
- Default: `false`
9091

9192
#### Example:
9293

0 commit comments

Comments
 (0)