diff --git a/crates/bench/benches/swap_claim.rs b/crates/bench/benches/swap_claim.rs index 2ba03515bb..bbeb2ea233 100644 --- a/crates/bench/benches/swap_claim.rs +++ b/crates/bench/benches/swap_claim.rs @@ -71,6 +71,7 @@ fn swap_claim_proving_time(c: &mut Criterion) { height: height.into(), trading_pair: swap_plaintext.trading_pair, epoch_starting_height: (epoch_duration * position.epoch()).into(), + sct_position_prefix: position, }; let (lambda_1, lambda_2) = output_data.pro_rata_outputs((delta_1_i, delta_2_i)); diff --git a/crates/bin/pcli/tests/proof.rs b/crates/bin/pcli/tests/proof.rs index a3eacf3860..ead865959e 100644 --- a/crates/bin/pcli/tests/proof.rs +++ b/crates/bin/pcli/tests/proof.rs @@ -279,6 +279,7 @@ fn swap_claim_parameters_vs_current_swap_claim_circuit() { height: height.into(), trading_pair: swap_plaintext.trading_pair, epoch_starting_height: (epoch_duration * position.epoch()).into(), + sct_position_prefix: position, }; let (lambda_1, lambda_2) = output_data.pro_rata_outputs((delta_1_i, delta_2_i)); diff --git a/crates/core/component/dex/src/batch_swap_output_data.rs b/crates/core/component/dex/src/batch_swap_output_data.rs index f40a446b46..8b29b6b8ac 100644 --- a/crates/core/component/dex/src/batch_swap_output_data.rs +++ b/crates/core/component/dex/src/batch_swap_output_data.rs @@ -6,11 +6,12 @@ use ark_r1cs_std::{ select::CondSelectGadget, }; use ark_relations::r1cs::{ConstraintSystemRef, SynthesisError}; -use decaf377::{r1cs::FqVar, Fq}; +use decaf377::Fq; use penumbra_proto::{penumbra::core::component::dex::v1 as pb, DomainType}; +use penumbra_tct::{r1cs::PositionVar, Position}; use serde::{Deserialize, Serialize}; -use penumbra_num::fixpoint::{bit_constrain, U128x128, U128x128Var}; +use penumbra_num::fixpoint::{U128x128, U128x128Var}; use penumbra_num::{Amount, AmountVar}; use crate::TradingPairVar; @@ -38,6 +39,8 @@ pub struct BatchSwapOutputData { pub trading_pair: TradingPair, /// The starting block height of the epoch for which the batch swap data is valid. pub epoch_starting_height: u64, + /// The position prefix where this batch swap occurred. The commitment index must be 0. + pub sct_position_prefix: Position, } impl BatchSwapOutputData { @@ -116,20 +119,15 @@ impl ToConstraintField for BatchSwapOutputData { .to_field_elements() .expect("U128x128 types are Bls12-377 field members"), ); - public_inputs.extend( - Fq::from(self.height) - .to_field_elements() - .expect("Fq types are Bls12-377 field members"), - ); public_inputs.extend( self.trading_pair .to_field_elements() .expect("trading_pair is a Bls12-377 field member"), ); public_inputs.extend( - Fq::from(self.epoch_starting_height) + self.sct_position_prefix .to_field_elements() - .expect("Fq types are Bls12-377 field members"), + .expect("Position types are Bls12-377 field members"), ); Some(public_inputs) } @@ -142,9 +140,8 @@ pub struct BatchSwapOutputDataVar { pub lambda_2: U128x128Var, pub unfilled_1: U128x128Var, pub unfilled_2: U128x128Var, - pub height: FqVar, pub trading_pair: TradingPairVar, - pub epoch_starting_height: FqVar, + pub sct_position_prefix: PositionVar, } impl AllocVar for BatchSwapOutputDataVar { @@ -168,18 +165,13 @@ impl AllocVar for BatchSwapOutputDataVar { let unfilled_1 = U128x128Var::new_variable(cs.clone(), || Ok(unfilled_1_fixpoint), mode)?; let unfilled_2_fixpoint: U128x128 = output_data.unfilled_2.into(); let unfilled_2 = U128x128Var::new_variable(cs.clone(), || Ok(unfilled_2_fixpoint), mode)?; - let height = FqVar::new_variable(cs.clone(), || Ok(Fq::from(output_data.height)), mode)?; - // Check the height is 64 bits - let _ = bit_constrain(height.clone(), 64); let trading_pair = TradingPairVar::new_variable_unchecked( cs.clone(), || Ok(output_data.trading_pair), mode, )?; - let epoch_starting_height = - FqVar::new_variable(cs, || Ok(Fq::from(output_data.epoch_starting_height)), mode)?; - // Check the epoch starting height is 64 bits - let _ = bit_constrain(epoch_starting_height.clone(), 64); + let sct_position_prefix = + PositionVar::new_variable(cs.clone(), || Ok(output_data.sct_position_prefix), mode)?; Ok(Self { delta_1, @@ -189,8 +181,7 @@ impl AllocVar for BatchSwapOutputDataVar { unfilled_1, unfilled_2, trading_pair, - height, - epoch_starting_height, + sct_position_prefix, }) } } @@ -211,6 +202,7 @@ impl From for pb::BatchSwapOutputData { height: s.height, epoch_starting_height: s.epoch_starting_height, trading_pair: Some(s.trading_pair.into()), + sct_position_prefix: s.sct_position_prefix.into(), } } } @@ -276,6 +268,14 @@ impl From for pb::BatchSwapOutputDataResponse { impl TryFrom for BatchSwapOutputData { type Error = anyhow::Error; fn try_from(s: pb::BatchSwapOutputData) -> Result { + let sct_position_prefix = { + let prefix = Position::from(s.sct_position_prefix); + anyhow::ensure!( + prefix.commitment() == 0, + "sct_position_prefix.commitment() != 0" + ); + prefix + }; Ok(Self { delta_1: s .delta_1 @@ -307,6 +307,7 @@ impl TryFrom for BatchSwapOutputData { .ok_or_else(|| anyhow!("Missing trading_pair"))? .try_into()?, epoch_starting_height: s.epoch_starting_height, + sct_position_prefix, }) } } @@ -421,9 +422,10 @@ mod tests { lambda_2: Amount::from(1u32), unfilled_1: Amount::from(1u32), unfilled_2: Amount::from(1u32), - height: 1, + height: 0, trading_pair, - epoch_starting_height: 1, + epoch_starting_height: 0, + sct_position_prefix: 0u64.into(), }, } } @@ -445,6 +447,7 @@ mod tests { height: 0u64, trading_pair, epoch_starting_height: 0u64, + sct_position_prefix: 0u64.into(), }; // Now suppose our user's contribution is: diff --git a/crates/core/component/dex/src/component/circuit_breaker/value.rs b/crates/core/component/dex/src/component/circuit_breaker/value.rs index ac76907569..5337549861 100644 --- a/crates/core/component/dex/src/component/circuit_breaker/value.rs +++ b/crates/core/component/dex/src/component/circuit_breaker/value.rs @@ -162,6 +162,7 @@ mod tests { height: 1, trading_pair: pair_1.into_directed_trading_pair().into(), epoch_starting_height: 0, + sct_position_prefix: Default::default(), }, None, None, @@ -252,7 +253,16 @@ mod tests { let routing_params = state.routing_params().await.unwrap(); // This call should panic due to the outflow of gn not being covered by the circuit breaker. state - .handle_batch_swaps(trading_pair, swap_flow, 0, 0, routing_params) + .handle_batch_swaps( + trading_pair, + swap_flow, + 0, + Epoch { + index: 0, + start_height: 0, + }, + routing_params, + ) .await .expect("unable to process batch swaps"); } diff --git a/crates/core/component/dex/src/component/dex.rs b/crates/core/component/dex/src/component/dex.rs index bdb9ada0c5..1bbaf4e41e 100644 --- a/crates/core/component/dex/src/component/dex.rs +++ b/crates/core/component/dex/src/component/dex.rs @@ -69,7 +69,7 @@ impl Component for Dex { .height .try_into() .expect("height is part of the end block data"), - current_epoch.start_height, + current_epoch, // Always include both ends of the target pair as fixed candidates. routing_params .clone() diff --git a/crates/core/component/dex/src/component/router/route_and_fill.rs b/crates/core/component/dex/src/component/router/route_and_fill.rs index b18a786200..47dfd997e3 100644 --- a/crates/core/component/dex/src/component/router/route_and_fill.rs +++ b/crates/core/component/dex/src/component/router/route_and_fill.rs @@ -5,6 +5,7 @@ use async_trait::async_trait; use cnidarium::StateWrite; use penumbra_asset::{asset, Value}; use penumbra_num::Amount; +use penumbra_sct::epoch::Epoch; use tracing::instrument; use crate::{ @@ -23,21 +24,14 @@ use super::fill_route::FillError; /// a block's batch swap flows. #[async_trait] pub trait HandleBatchSwaps: StateWrite + Sized { - #[instrument(skip( - self, - trading_pair, - batch_data, - block_height, - epoch_starting_height, - params - ))] + #[instrument(skip(self, trading_pair, batch_data, block_height, epoch, params))] async fn handle_batch_swaps( self: &mut Arc, trading_pair: TradingPair, batch_data: SwapFlow, // TODO: why not read these 2 from the state? block_height: u64, - epoch_starting_height: u64, + epoch: Epoch, params: RoutingParams, ) -> Result<()> where @@ -97,7 +91,7 @@ pub trait HandleBatchSwaps: StateWrite + Sized { }; let output_data = BatchSwapOutputData { height: block_height, - epoch_starting_height, + epoch_starting_height: epoch.start_height, trading_pair, delta_1, delta_2, @@ -105,6 +99,13 @@ pub trait HandleBatchSwaps: StateWrite + Sized { lambda_2, unfilled_1, unfilled_2, + sct_position_prefix: ( + u16::try_from(epoch.index).expect("epoch index should be small enough"), + u16::try_from(block_height - epoch.start_height) + .expect("block index should be small enough"), + 0, + ) + .into(), }; // Fetch the swap execution object that should have been modified during the routing and filling. diff --git a/crates/core/component/dex/src/component/router/tests.rs b/crates/core/component/dex/src/component/router/tests.rs index bd9c5f4de6..42048a30fd 100644 --- a/crates/core/component/dex/src/component/router/tests.rs +++ b/crates/core/component/dex/src/component/router/tests.rs @@ -5,6 +5,7 @@ use core::panic; use futures::StreamExt; use penumbra_asset::{asset, Value}; use penumbra_num::{fixpoint::U128x128, Amount}; +use penumbra_sct::epoch::Epoch; use rand_core::OsRng; use std::sync::Arc; @@ -1024,7 +1025,16 @@ async fn best_position_route_and_fill() -> anyhow::Result<()> { .unwrap(); let routing_params = state.routing_params().await.unwrap(); state - .handle_batch_swaps(trading_pair, swap_flow, 0u32.into(), 0, routing_params) + .handle_batch_swaps( + trading_pair, + swap_flow, + 0u32.into(), + Epoch { + index: 0, + start_height: 0, + }, + routing_params, + ) .await .expect("unable to process batch swaps"); @@ -1165,7 +1175,16 @@ async fn multi_hop_route_and_fill() -> anyhow::Result<()> { .unwrap(); let routing_params = state.routing_params().await.unwrap(); state - .handle_batch_swaps(trading_pair, swap_flow, 0u32.into(), 0, routing_params) + .handle_batch_swaps( + trading_pair, + swap_flow, + 0u32.into(), + Epoch { + index: 0, + start_height: 0, + }, + routing_params, + ) .await .expect("unable to process batch swaps"); diff --git a/crates/core/component/dex/src/component/tests.rs b/crates/core/component/dex/src/component/tests.rs index 69baee6c9b..72ecda092d 100644 --- a/crates/core/component/dex/src/component/tests.rs +++ b/crates/core/component/dex/src/component/tests.rs @@ -6,6 +6,7 @@ use cnidarium::{ArcStateDeltaExt, StateDelta, TempStorage}; use futures::StreamExt; use penumbra_asset::{asset, Value}; use penumbra_num::Amount; +use penumbra_sct::epoch::Epoch; use rand_core::OsRng; use crate::lp::action::PositionOpen; @@ -632,7 +633,16 @@ async fn swap_execution_tests() -> anyhow::Result<()> { .unwrap(); let routing_params = state.routing_params().await.unwrap(); state - .handle_batch_swaps(trading_pair, swap_flow, 0, 0, routing_params) + .handle_batch_swaps( + trading_pair, + swap_flow, + 0, + Epoch { + index: 0, + start_height: 0, + }, + routing_params, + ) .await .expect("unable to process batch swaps"); @@ -740,7 +750,16 @@ async fn swap_execution_tests() -> anyhow::Result<()> { .unwrap(); let routing_params = state.routing_params().await.unwrap(); state - .handle_batch_swaps(trading_pair, swap_flow, 0u32.into(), 0, routing_params) + .handle_batch_swaps( + trading_pair, + swap_flow, + 0u32.into(), + Epoch { + index: 0, + start_height: 0, + }, + routing_params, + ) .await .expect("unable to process batch swaps"); @@ -758,6 +777,7 @@ async fn swap_execution_tests() -> anyhow::Result<()> { height: 0, epoch_starting_height: 0, trading_pair, + sct_position_prefix: Default::default(), } ); diff --git a/crates/core/component/dex/src/swap_claim/proof.rs b/crates/core/component/dex/src/swap_claim/proof.rs index c8698d131c..7484e1d307 100644 --- a/crates/core/component/dex/src/swap_claim/proof.rs +++ b/crates/core/component/dex/src/swap_claim/proof.rs @@ -123,11 +123,16 @@ fn check_satisfaction( anyhow::bail!("claim fee did not match public input"); } - let block: u64 = private.state_commitment_proof.position().block().into(); - let note_commitment_block_height: u64 = public.output_data.epoch_starting_height + block; - if note_commitment_block_height != public.output_data.height { - anyhow::bail!("swap commitment height did not match public input"); - } + anyhow::ensure!( + private.state_commitment_proof.position().block() + == public.output_data.sct_position_prefix.block(), + "scm block did not match batch swap" + ); + anyhow::ensure!( + private.state_commitment_proof.position().epoch() + == public.output_data.sct_position_prefix.epoch(), + "scm epoch did not match batch swap" + ); if private.swap_plaintext.trading_pair != public.output_data.trading_pair { anyhow::bail!("trading pair did not match public input"); @@ -255,12 +260,14 @@ impl ConstraintSynthesizer for SwapClaimCircuit { claimed_fee_var.enforce_equal(&swap_plaintext_var.claim_fee)?; // Validate the swap commitment's height matches the output data's height (i.e. the clearing price height). - let block = position_var.block()?; - let note_commitment_block_height_var = - output_data_var.epoch_starting_height.clone() + block; output_data_var - .height - .enforce_equal(¬e_commitment_block_height_var)?; + .sct_position_prefix + .block()? + .enforce_equal(&position_var.block()?)?; + output_data_var + .sct_position_prefix + .epoch()? + .enforce_equal(&position_var.epoch()?)?; // Validate that the output data's trading pair matches the note commitment's trading pair. output_data_var @@ -360,6 +367,7 @@ impl DummyWitness for SwapClaimCircuit { height: 0, trading_pair: swap_plaintext.trading_pair, epoch_starting_height: 0, + sct_position_prefix: Default::default(), }; let note_blinding_1 = Fq::from(1); let note_blinding_2 = Fq::from(1); @@ -643,6 +651,7 @@ mod tests { height: height.into(), trading_pair: swap_plaintext.trading_pair, epoch_starting_height: (epoch_duration * position.epoch()).into(), + sct_position_prefix: Default::default(), }; let (lambda_1, lambda_2) = output_data.pro_rata_outputs((delta_1_i, delta_2_i)); @@ -775,6 +784,7 @@ mod tests { height: height.into(), trading_pair: swap_plaintext.trading_pair, epoch_starting_height: (epoch_duration * position.epoch()).into(), + sct_position_prefix: Default::default() }; let (lambda_1, lambda_2) = output_data.pro_rata_outputs((delta_1_i, delta_2_i)); @@ -875,6 +885,7 @@ mod tests { height: height.into(), trading_pair: swap_plaintext.trading_pair, epoch_starting_height: (epoch_duration * dummy_position.epoch()).into(), + sct_position_prefix: Default::default() }; let (lambda_1, lambda_2) = output_data.pro_rata_outputs((delta_1_i, delta_2_i)); diff --git a/crates/crypto/proof-params/src/gen/convert_id.rs b/crates/crypto/proof-params/src/gen/convert_id.rs deleted file mode 100644 index eac6947907..0000000000 --- a/crates/crypto/proof-params/src/gen/convert_id.rs +++ /dev/null @@ -1,3 +0,0 @@ - -pub const PROVING_KEY_ID: &'static str = "groth16pk1x4m7qnm4czf3mtys3s8p8fnzpcz22fv26udz7cgql3x047rqn6nqquqh7t"; -pub const VERIFICATION_KEY_ID: &'static str = "groth16vk1eu7tznfakx6dh3kzfrtfzt034ypzc69eaqdmjptyayxjqp0jt84s94hy8m"; diff --git a/crates/crypto/proof-params/src/gen/convert_pk.bin b/crates/crypto/proof-params/src/gen/convert_pk.bin deleted file mode 100644 index 8b10cb9535..0000000000 --- a/crates/crypto/proof-params/src/gen/convert_pk.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:882527eb795af2819f8df4f6233d5844757768fb03d51a000f11b100eeea573f -size 7926960 diff --git a/crates/crypto/proof-params/src/gen/convert_vk.param b/crates/crypto/proof-params/src/gen/convert_vk.param deleted file mode 100644 index 342c631cbe..0000000000 Binary files a/crates/crypto/proof-params/src/gen/convert_vk.param and /dev/null differ diff --git a/crates/crypto/proof-params/src/gen/delegator_vote_id.rs b/crates/crypto/proof-params/src/gen/delegator_vote_id.rs deleted file mode 100644 index ea04ca5f90..0000000000 --- a/crates/crypto/proof-params/src/gen/delegator_vote_id.rs +++ /dev/null @@ -1,3 +0,0 @@ - -pub const PROVING_KEY_ID: &'static str = "groth16pk1wquddkhlkp3tj3fsjt7qtgaevfpndp2ejptvp7lxhafa0ddxqetqtp52ja"; -pub const VERIFICATION_KEY_ID: &'static str = "groth16vk1j8jt9leawttxhqdye26apdtfkju4nmhzf40y3339g774ca73qyusq7wpcn"; diff --git a/crates/crypto/proof-params/src/gen/delegator_vote_pk.bin b/crates/crypto/proof-params/src/gen/delegator_vote_pk.bin deleted file mode 100644 index b7d0e5ba44..0000000000 --- a/crates/crypto/proof-params/src/gen/delegator_vote_pk.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6712a90216c7c0cfb12ef2a37d48ffae666f8d2bd9a722836864d0a70064dce7 -size 21943632 diff --git a/crates/crypto/proof-params/src/gen/delegator_vote_vk.param b/crates/crypto/proof-params/src/gen/delegator_vote_vk.param deleted file mode 100644 index d826f0ac1b..0000000000 Binary files a/crates/crypto/proof-params/src/gen/delegator_vote_vk.param and /dev/null differ diff --git a/crates/crypto/proof-params/src/gen/nullifier_derivation_id.rs b/crates/crypto/proof-params/src/gen/nullifier_derivation_id.rs deleted file mode 100644 index 70a79236e8..0000000000 --- a/crates/crypto/proof-params/src/gen/nullifier_derivation_id.rs +++ /dev/null @@ -1,3 +0,0 @@ - -pub const PROVING_KEY_ID: &'static str = "groth16pk1e79gm2pkg5rlkyeectfh4yualrjy9qdlez22l4f56g5tjqkqfv3syrrzsm"; -pub const VERIFICATION_KEY_ID: &'static str = "groth16vk1ylw2upegj9ppaz9s0hd0czh8yeqxvqc4s39468733cnfcch2cfwqnm4gqj"; diff --git a/crates/crypto/proof-params/src/gen/nullifier_derivation_pk.bin b/crates/crypto/proof-params/src/gen/nullifier_derivation_pk.bin deleted file mode 100644 index 0e349558b5..0000000000 --- a/crates/crypto/proof-params/src/gen/nullifier_derivation_pk.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ac9568335c1c158edddb2a70212c7b98d7c7aeff633b485a088049ecc01cc0ef -size 232368 diff --git a/crates/crypto/proof-params/src/gen/nullifier_derivation_vk.param b/crates/crypto/proof-params/src/gen/nullifier_derivation_vk.param deleted file mode 100644 index d28fe881b4..0000000000 Binary files a/crates/crypto/proof-params/src/gen/nullifier_derivation_vk.param and /dev/null differ diff --git a/crates/crypto/proof-params/src/gen/output_id.rs b/crates/crypto/proof-params/src/gen/output_id.rs deleted file mode 100644 index 6ee9e3ae19..0000000000 --- a/crates/crypto/proof-params/src/gen/output_id.rs +++ /dev/null @@ -1,3 +0,0 @@ - -pub const PROVING_KEY_ID: &'static str = "groth16pk1cq4kzdw0gksjch329u7dwznuutgswt084w259ef9aul3zpsnvmxqmjqwwu"; -pub const VERIFICATION_KEY_ID: &'static str = "groth16vk1clsj7lwhfqkvvuy6syd37a4ghnpgle67qefxtfm4fmkwf2yr6cmst2axts"; diff --git a/crates/crypto/proof-params/src/gen/output_pk.bin b/crates/crypto/proof-params/src/gen/output_pk.bin deleted file mode 100644 index 490d0a21c4..0000000000 --- a/crates/crypto/proof-params/src/gen/output_pk.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a8c5ccc9d6c74150a21a8411e90d523e6ebb0f2a2985327d9fb4ef690600461e -size 7257360 diff --git a/crates/crypto/proof-params/src/gen/output_vk.param b/crates/crypto/proof-params/src/gen/output_vk.param deleted file mode 100644 index 2fbd0568f2..0000000000 Binary files a/crates/crypto/proof-params/src/gen/output_vk.param and /dev/null differ diff --git a/crates/crypto/proof-params/src/gen/spend_id.rs b/crates/crypto/proof-params/src/gen/spend_id.rs deleted file mode 100644 index 8a81dea3b1..0000000000 --- a/crates/crypto/proof-params/src/gen/spend_id.rs +++ /dev/null @@ -1,3 +0,0 @@ - -pub const PROVING_KEY_ID: &'static str = "groth16pk1q5g33sdz9u9thkpj67rzacrlashgumzjnzenu589tn3dx6798q2qwx3z59"; -pub const VERIFICATION_KEY_ID: &'static str = "groth16vk1v7rahtkzn3045auj3h24pf3du7dlhjyfwgvya4pwvtq4jhfmw7vqawpf33"; diff --git a/crates/crypto/proof-params/src/gen/spend_pk.bin b/crates/crypto/proof-params/src/gen/spend_pk.bin deleted file mode 100644 index 190bb16ce6..0000000000 --- a/crates/crypto/proof-params/src/gen/spend_pk.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:69694b15abd96fdbeba5bbe1ba982d2240129be05813a9693acce31a1b43b0fd -size 21187632 diff --git a/crates/crypto/proof-params/src/gen/spend_vk.param b/crates/crypto/proof-params/src/gen/spend_vk.param deleted file mode 100644 index 1ca209a13a..0000000000 Binary files a/crates/crypto/proof-params/src/gen/spend_vk.param and /dev/null differ diff --git a/crates/crypto/proof-params/src/gen/swap_id.rs b/crates/crypto/proof-params/src/gen/swap_id.rs deleted file mode 100644 index 376279bbdd..0000000000 --- a/crates/crypto/proof-params/src/gen/swap_id.rs +++ /dev/null @@ -1,3 +0,0 @@ - -pub const PROVING_KEY_ID: &'static str = "groth16pk1uly6kxvkvmygl9n74zm27nujqj2deg793c6kcjwsmt43akt9jw3qulqxqc"; -pub const VERIFICATION_KEY_ID: &'static str = "groth16vk1pzv7jlra2tmkwxnchzqm2rd5pq8wvhkx5j3vpe5xspw3h6lyygqquqjjed"; diff --git a/crates/crypto/proof-params/src/gen/swap_pk.bin b/crates/crypto/proof-params/src/gen/swap_pk.bin deleted file mode 100644 index 0a805cb3d9..0000000000 --- a/crates/crypto/proof-params/src/gen/swap_pk.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3d75cac8a227cd8c6680cd40f94a436b89f10d9b9bb1a118cf4479f1aa9b3fef -size 14019984 diff --git a/crates/crypto/proof-params/src/gen/swap_vk.param b/crates/crypto/proof-params/src/gen/swap_vk.param deleted file mode 100644 index c3915c8be2..0000000000 Binary files a/crates/crypto/proof-params/src/gen/swap_vk.param and /dev/null differ diff --git a/crates/crypto/proof-params/src/gen/swapclaim_id.rs b/crates/crypto/proof-params/src/gen/swapclaim_id.rs index 0293098666..4745bf8515 100644 --- a/crates/crypto/proof-params/src/gen/swapclaim_id.rs +++ b/crates/crypto/proof-params/src/gen/swapclaim_id.rs @@ -1,3 +1,3 @@ -pub const PROVING_KEY_ID: &'static str = "groth16pk1vs60etmlvwfzmn2ve0ljz0vfkzjlrhjpue5svm5ry6l076qukjcsw566rp"; -pub const VERIFICATION_KEY_ID: &'static str = "groth16vk18qjn0kxmypk8gmfc6zhjukhyxk0agmunfnhpxmf3yxq266q6sgaqwe94rc"; +pub const PROVING_KEY_ID: &'static str = "groth16pk19hg2sshv5t4d3fhexjr4vhq4d8tuxr5nfsw7mkzucwxmsjcf2kxql9gdte"; +pub const VERIFICATION_KEY_ID: &'static str = "groth16vk18pt0t8685e8h7y4dz494a2pamunadu4x3rtrttsaf4cd37gdsnhqsqkqgv"; diff --git a/crates/crypto/proof-params/src/gen/swapclaim_pk.bin b/crates/crypto/proof-params/src/gen/swapclaim_pk.bin index 96b1d164b6..8ff04c4e53 100644 --- a/crates/crypto/proof-params/src/gen/swapclaim_pk.bin +++ b/crates/crypto/proof-params/src/gen/swapclaim_pk.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8501f1dad9ac85d80c6421b17b838f8c6478431babfa836d3d33b5398fa6b6ad -size 26003952 +oid sha256:5331fa2cf2f005c969125a2b61d2cf8a41f8f52b81360ad4d157c28d08aeee8b +size 25972272 diff --git a/crates/crypto/proof-params/src/gen/swapclaim_vk.param b/crates/crypto/proof-params/src/gen/swapclaim_vk.param index 4bd2b584a5..efe58c0c56 100644 Binary files a/crates/crypto/proof-params/src/gen/swapclaim_vk.param and b/crates/crypto/proof-params/src/gen/swapclaim_vk.param differ diff --git a/crates/proto/src/gen/penumbra.core.component.dex.v1.rs b/crates/proto/src/gen/penumbra.core.component.dex.v1.rs index 316658f996..86e9a47b7c 100644 --- a/crates/proto/src/gen/penumbra.core.component.dex.v1.rs +++ b/crates/proto/src/gen/penumbra.core.component.dex.v1.rs @@ -475,6 +475,9 @@ pub struct BatchSwapOutputData { /// The starting block height of the epoch for which the batch swap data is valid. #[prost(uint64, tag = "9")] pub epoch_starting_height: u64, + /// The prefix (epoch, block) of the position where this batch swap occurred. + #[prost(uint64, tag = "10")] + pub sct_position_prefix: u64, } impl ::prost::Name for BatchSwapOutputData { const NAME: &'static str = "BatchSwapOutputData"; diff --git a/crates/proto/src/gen/penumbra.core.component.dex.v1.serde.rs b/crates/proto/src/gen/penumbra.core.component.dex.v1.serde.rs index b7294296fc..20ca700579 100644 --- a/crates/proto/src/gen/penumbra.core.component.dex.v1.serde.rs +++ b/crates/proto/src/gen/penumbra.core.component.dex.v1.serde.rs @@ -614,6 +614,9 @@ impl serde::Serialize for BatchSwapOutputData { if self.epoch_starting_height != 0 { len += 1; } + if self.sct_position_prefix != 0 { + len += 1; + } let mut struct_ser = serializer.serialize_struct("penumbra.core.component.dex.v1.BatchSwapOutputData", len)?; if let Some(v) = self.delta_1.as_ref() { struct_ser.serialize_field("delta1", v)?; @@ -644,6 +647,10 @@ impl serde::Serialize for BatchSwapOutputData { #[allow(clippy::needless_borrow)] struct_ser.serialize_field("epochStartingHeight", ToString::to_string(&self.epoch_starting_height).as_str())?; } + if self.sct_position_prefix != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("sctPositionPrefix", ToString::to_string(&self.sct_position_prefix).as_str())?; + } struct_ser.end() } } @@ -671,6 +678,8 @@ impl<'de> serde::Deserialize<'de> for BatchSwapOutputData { "tradingPair", "epoch_starting_height", "epochStartingHeight", + "sct_position_prefix", + "sctPositionPrefix", ]; #[allow(clippy::enum_variant_names)] @@ -684,6 +693,7 @@ impl<'de> serde::Deserialize<'de> for BatchSwapOutputData { Height, TradingPair, EpochStartingHeight, + SctPositionPrefix, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -715,6 +725,7 @@ impl<'de> serde::Deserialize<'de> for BatchSwapOutputData { "height" => Ok(GeneratedField::Height), "tradingPair" | "trading_pair" => Ok(GeneratedField::TradingPair), "epochStartingHeight" | "epoch_starting_height" => Ok(GeneratedField::EpochStartingHeight), + "sctPositionPrefix" | "sct_position_prefix" => Ok(GeneratedField::SctPositionPrefix), _ => Ok(GeneratedField::__SkipField__), } } @@ -743,6 +754,7 @@ impl<'de> serde::Deserialize<'de> for BatchSwapOutputData { let mut height__ = None; let mut trading_pair__ = None; let mut epoch_starting_height__ = None; + let mut sct_position_prefix__ = None; while let Some(k) = map_.next_key()? { match k { GeneratedField::Delta1 => { @@ -803,6 +815,14 @@ impl<'de> serde::Deserialize<'de> for BatchSwapOutputData { Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) ; } + GeneratedField::SctPositionPrefix => { + if sct_position_prefix__.is_some() { + return Err(serde::de::Error::duplicate_field("sctPositionPrefix")); + } + sct_position_prefix__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } @@ -818,6 +838,7 @@ impl<'de> serde::Deserialize<'de> for BatchSwapOutputData { height: height__.unwrap_or_default(), trading_pair: trading_pair__, epoch_starting_height: epoch_starting_height__.unwrap_or_default(), + sct_position_prefix: sct_position_prefix__.unwrap_or_default(), }) } } diff --git a/crates/proto/src/gen/proto_descriptor.bin.no_lfs b/crates/proto/src/gen/proto_descriptor.bin.no_lfs index 8a26d29b04..8f030d1fee 100644 Binary files a/crates/proto/src/gen/proto_descriptor.bin.no_lfs and b/crates/proto/src/gen/proto_descriptor.bin.no_lfs differ diff --git a/proto/penumbra/penumbra/core/component/dex/v1/dex.proto b/proto/penumbra/penumbra/core/component/dex/v1/dex.proto index 4ba3cbb394..1076e03ecf 100644 --- a/proto/penumbra/penumbra/core/component/dex/v1/dex.proto +++ b/proto/penumbra/penumbra/core/component/dex/v1/dex.proto @@ -227,6 +227,8 @@ message BatchSwapOutputData { TradingPair trading_pair = 8; // The starting block height of the epoch for which the batch swap data is valid. uint64 epoch_starting_height = 9; + // The prefix (epoch, block) of the position where this batch swap occurred. + uint64 sct_position_prefix = 10; } // The trading function for a specific pair.