Skip to content

Commit 69bc0a5

Browse files
committed
Bugfix in key-distribution, lots of defense in depth - both based on zkao report
1 parent 5dc1717 commit 69bc0a5

57 files changed

Lines changed: 3121 additions & 323 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 48 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ ark-dlog-gadget = { package = "ark-dlog-gadget", git = "https://github.com/Polym
2525

2626
#dock_crypto_utils = { path = "../crypto/utils" }
2727
#schnorr_pok = { path = "../crypto/schnorr_pok" }
28-
dock_crypto_utils = { git = "https://github.com/PolymeshAssociation/crypto", branch = "main" }
29-
schnorr_pok = { git = "https://github.com/PolymeshAssociation/crypto", branch = "main" }
28+
dock_crypto_utils = { git = "https://github.com/PolymeshAssociation/crypto", branch = "patch30" }
29+
schnorr_pok = { git = "https://github.com/PolymeshAssociation/crypto", branch = "patch30" }
3030

3131
# Polymesh changes.
3232
#ark-serialize = { path = "../arkworks-algebra/serialize" }
@@ -42,18 +42,18 @@ schnorr_pok = { git = "https://github.com/PolymeshAssociation/crypto", branch =
4242
#ark-curve25519 = { path = "../arkworks-algebra/curves/curve25519" }
4343
#ark-ed25519 = { path = "../arkworks-algebra/curves/ed25519" }
4444

45-
ark-serialize = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "polymesh-master" }
46-
ark-ec = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "polymesh-master" }
47-
ark-host-msm = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "polymesh-master" }
48-
#ark-host-msm-impl = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "polymesh-master" }
49-
ark-ff = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "polymesh-master" }
50-
ark-pallas = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "polymesh-master" }
51-
ark-vesta = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "polymesh-master" }
52-
ark-helios = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "polymesh-master" }
53-
ark-selene = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "polymesh-master" }
54-
ark-wei25519 = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "polymesh-master" }
55-
ark-curve25519 = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "polymesh-master" }
56-
ark-ed25519 = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "polymesh-master" }
45+
ark-serialize = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "pasta-opts" }
46+
ark-ec = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "pasta-opts" }
47+
ark-host-msm = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "pasta-opts" }
48+
#ark-host-msm-impl = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "pasta-opts" }
49+
ark-ff = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "pasta-opts" }
50+
ark-pallas = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "pasta-opts" }
51+
ark-vesta = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "pasta-opts" }
52+
ark-helios = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "pasta-opts" }
53+
ark-selene = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "pasta-opts" }
54+
ark-wei25519 = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "pasta-opts" }
55+
ark-curve25519 = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "pasta-opts" }
56+
ark-ed25519 = { git = "https://github.com/PolymeshAssociation/arkworks-algebra.git", branch = "pasta-opts" }
5757

5858
[workspace.dependencies]
5959
polymesh-dart = { path = "./", version = "0.1.0", default-features = false }

dart-bp/benches/fee_account_proofs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn new_fee_account<R: CryptoRngCore>(
3737
pk: VerKey<PallasA>,
3838
balance: u64,
3939
) -> FeeAccountState<PallasA> {
40-
FeeAccountState::new(rng, pk.0, balance, asset_id)
40+
FeeAccountState::new(rng, pk.0, balance, asset_id).unwrap()
4141
}
4242

4343
fn create_shared_setup() -> (

dart-bp/src/account/common/balance.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use ark_std::{format, string::ToString};
1313
use bulletproofs::r1cs::{ConstraintSystem, Prover};
1414
use bulletproofs::{BulletproofGens, PedersenGens};
1515
use dock_crypto_utils::transcript::MerlinTranscript;
16-
use polymesh_dart_common::Balance;
16+
use polymesh_dart_common::{Balance, MAX_BALANCE};
1717
use rand_core::CryptoRngCore;
1818
use schnorr_pok::partial::PartialSchnorrResponse;
1919
use schnorr_pok::{SchnorrChallengeContributor, SchnorrCommitment};
@@ -169,6 +169,10 @@ pub fn ensure_correct_balance_change<G: AffineRepr>(
169169

170170
#[cfg(not(feature = "ignore_prover_input_sanitation"))]
171171
{
172+
if amount > MAX_BALANCE {
173+
return Err(Error::AmountTooLarge(amount));
174+
}
175+
172176
if has_balance_decreased {
173177
if new_state.balance() != old_state.balance() - amount {
174178
return Err(Error::ProofGenerationError(

0 commit comments

Comments
 (0)