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 a5a13de900..f810136b38 100644 --- a/crates/core/component/dex/src/batch_swap_output_data.rs +++ b/crates/core/component/dex/src/batch_swap_output_data.rs @@ -134,6 +134,16 @@ impl ToConstraintField for BatchSwapOutputData { .to_field_elements() .expect("Fq types are Bls12-377 field members"), ); + public_inputs.extend( + Fq::from(self.sct_position_prefix.epoch()) + .to_field_elements() + .expect("Fq types are Bls12-377 field members"), + ); + public_inputs.extend( + Fq::from(self.sct_position_prefix.block()) + .to_field_elements() + .expect("Fq types are Bls12-377 field members"), + ); Some(public_inputs) } } @@ -469,7 +479,7 @@ mod tests { height: 0u64, trading_pair, epoch_starting_height: 0u64, - sct_position_prefix: Position::default(), + sct_position_prefix: 0u64.into(), }; // Now suppose our user's contribution is: diff --git a/crates/core/component/dex/src/swap_claim/proof.rs b/crates/core/component/dex/src/swap_claim/proof.rs index c562809d18..e90a863277 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");