Skip to content

Commit f00ba6f

Browse files
committed
feat: Update with latest circuits
1 parent 5423671 commit f00ba6f

6 files changed

Lines changed: 430 additions & 619 deletions

File tree

src/BETH.abi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@
279279
"internalType": "uint256"
280280
},
281281
{
282-
"name": "_fee",
282+
"name": "_broadcasterFee",
283283
"type": "uint256",
284284
"internalType": "uint256"
285285
},

src/cli/burn.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ impl BurnOpt {
3131
nullifier_u256,
3232
remaining_coin_val,
3333
remaining_coin_u256,
34+
burn_extra_commit,
3435
) = self.common_opt.prepare_inputs(amount, fee, spend).await?;
3536

3637
let (_tx_hash, _ok) = self.common_opt.send_burn_tx(burn_addr, amount).await?;
@@ -49,8 +50,8 @@ impl BurnOpt {
4950
params_dir,
5051
burn_addr,
5152
burn_key,
52-
fee,
5353
spend,
54+
burn_extra_commit,
5455
"input.json",
5556
"witness.wtns",
5657
)

src/cli/mod.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mod utils;
1111
use crate::cli::utils::{append_new_entry, burn_file, coins_file, init_coins_file, next_id};
1212
use crate::constants::poseidon_burn_address_prefix;
1313
use crate::fp::Fp;
14-
use crate::utils::{RapidsnarkOutput, build_and_prove_burn_logic};
14+
use crate::utils::{RapidsnarkOutput, build_and_prove_burn_logic, generate_burn_extra_commit};
1515
use crate::utils::{
1616
compute_nullifier, compute_previous_coin, compute_remaining_coin, fetch_block_and_header_bytes,
1717
find_burn_key, generate_burn_address, get_account_proof,
@@ -208,7 +208,7 @@ impl CommonOpt {
208208
amount: U256,
209209
fee: U256,
210210
spend: U256,
211-
) -> Result<(Fp, Address, Fp, U256, Fp, U256)> {
211+
) -> Result<(Fp, Address, Fp, U256, Fp, U256, U256)> {
212212
let rt = self.setup().await?;
213213

214214
if fee + spend > amount {
@@ -222,7 +222,8 @@ impl CommonOpt {
222222

223223
// 1) burn_key
224224
println!("Generating a burn-key...");
225-
let burn_key = find_burn_key(2, rt.wallet_address, U256::ZERO, fee, spend);
225+
let extra_commit = generate_burn_extra_commit(rt.wallet_address, U256::ZERO, fee);
226+
let burn_key = find_burn_key(2, extra_commit, spend);
226227
println!("Your burn_key: {:?}", burn_key);
227228
println!(
228229
"Your burn-key as string: {}",
@@ -231,7 +232,7 @@ impl CommonOpt {
231232

232233
// 2) burn address
233234
let burn_addr_prefix = poseidon_burn_address_prefix();
234-
let burn_addr = generate_burn_address(
235+
let (burn_addr, burn_extra_commit) = generate_burn_address(
235236
burn_addr_prefix,
236237
burn_key,
237238
rt.wallet_address,
@@ -254,6 +255,7 @@ impl CommonOpt {
254255
nullifier_u256,
255256
remaining_coin_val_fp,
256257
remaining_coin_u256,
258+
burn_extra_commit,
257259
))
258260
}
259261

@@ -266,7 +268,7 @@ impl CommonOpt {
266268
let rt = self.setup().await?; // wallet addr + provider + network
267269
let burn_addr_prefix = crate::constants::poseidon_burn_address_prefix();
268270

269-
let burn_addr = crate::utils::generate_burn_address(
271+
let (burn_addr, _burn_extra_commit) = crate::utils::generate_burn_address(
270272
burn_addr_prefix,
271273
burn_key,
272274
rt.wallet_address,
@@ -318,8 +320,8 @@ impl CommonOpt {
318320
params_dir: &Path,
319321
burn_addr: Address,
320322
burn_key: Fp,
321-
fee: U256,
322323
spend: U256,
324+
burn_extra_commit: U256,
323325
input_json_path: &str,
324326
witness_path: &str,
325327
) -> Result<(RapidsnarkOutput, u64, PathBuf)> {
@@ -331,9 +333,8 @@ impl CommonOpt {
331333
params_dir,
332334
header_bytes,
333335
burn_key,
334-
fee,
335336
spend,
336-
rt.wallet_address,
337+
burn_extra_commit,
337338
rt.wallet_address,
338339
input_json_path,
339340
witness_path,

0 commit comments

Comments
 (0)