Skip to content

Commit

Permalink
Merge branch 'tomas/masp-main' (#3285)
Browse files Browse the repository at this point in the history
* tomas/masp-main:
  sdk/masp: fix the build with "mainnet" feature on
  dep: update to main branch of masp
  • Loading branch information
tzemanovic committed May 21, 2024
2 parents ead6c41 + 8be265c commit 7172ac7
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 33 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ ledger-transport-hid = "0.10.0"
libc = "0.2.97"
libloading = "0.7.2"
linkme = "0.3.24"
# branch = "murisi/alternative-num-traits"
masp_primitives = { git = "https://github.com/anoma/masp", rev = "6fc4692841a2241633792c429cc66b42023e5bf3" }
masp_proofs = { git = "https://github.com/anoma/masp", rev = "6fc4692841a2241633792c429cc66b42023e5bf3", default-features = false, features = ["local-prover"] }
# branch = "main"
masp_primitives = { git = "https://github.com/anoma/masp", rev = "3aacc707c5948e7423589ac617305448bead9842" }
masp_proofs = { git = "https://github.com/anoma/masp", rev = "3aacc707c5948e7423589ac617305448bead9842", default-features = false, features = ["local-prover"] }
num256 = "0.3.5"
num_cpus = "1.13.0"
num-derive = "0.4"
Expand Down
33 changes: 15 additions & 18 deletions crates/sdk/src/masp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ use borsh_ext::BorshSerializeExt;
use lazy_static::lazy_static;
use masp_primitives::asset_type::AssetType;
#[cfg(feature = "mainnet")]
use masp_primitives::consensus::MainNetwork;
use masp_primitives::consensus::MainNetwork as Network;
#[cfg(not(feature = "mainnet"))]
use masp_primitives::consensus::TestNetwork;
use masp_primitives::consensus::TestNetwork as Network;
use masp_primitives::convert::AllowedConversion;
use masp_primitives::ff::PrimeField;
use masp_primitives::group::GroupEncoding;
Expand Down Expand Up @@ -90,10 +90,7 @@ pub const ENV_VAR_MASP_PARAMS_DIR: &str = "NAMADA_MASP_PARAMS_DIR";
pub const ENV_VAR_MASP_TEST_SEED: &str = "NAMADA_MASP_TEST_SEED";

/// The network to use for MASP
#[cfg(feature = "mainnet")]
const NETWORK: MainNetwork = MainNetwork;
#[cfg(not(feature = "mainnet"))]
const NETWORK: TestNetwork = TestNetwork;
const NETWORK: Network = Network;

// TODO these could be exported from masp_proof crate
/// Spend circuit name
Expand Down Expand Up @@ -1655,7 +1652,7 @@ impl<U: ShieldedUtils + MaybeSend + MaybeSync> ShieldedContext<U> {
u32::MAX - 20
}
};
let mut builder = Builder::<TestNetwork, _>::new(
let mut builder = Builder::<Network, _>::new(
NETWORK,
// NOTE: this is going to add 20 more blocks to the actual
// expiration but there's no other exposed function that we could
Expand Down Expand Up @@ -2674,7 +2671,7 @@ pub mod testing {
value: u64,
)(
address in arb_transparent_address(),
expiration_height in arb_height(BranchId::MASP, &TestNetwork),
expiration_height in arb_height(BranchId::MASP, &Network),
mut rng in arb_rng().prop_map(TestCsprng),
bparams_rng in arb_rng().prop_map(TestCsprng),
prover_rng in arb_rng().prop_map(TestCsprng),
Expand All @@ -2689,7 +2686,7 @@ pub mod testing {
.to_payment_address(div)
.expect("a PaymentAddress");

let mut builder = Builder::<TestNetwork, _>::new(
let mut builder = Builder::<Network, _>::new(
NETWORK,
// NOTE: this is going to add 20 more blocks to the actual
// expiration but there's no other exposed function that we could
Expand Down Expand Up @@ -2835,7 +2832,7 @@ pub mod testing {
asset_range,
),
)(
expiration_height in arb_height(BranchId::MASP, &TestNetwork),
expiration_height in arb_height(BranchId::MASP, &Network),
spend_descriptions in assets
.iter()
.map(|(asset, values)| arb_spend_descriptions(asset.clone(), values.clone()))
Expand All @@ -2846,10 +2843,10 @@ pub mod testing {
.collect::<Vec<_>>(),
assets in Just(assets),
) -> (
Builder::<TestNetwork>,
Builder::<Network>,
HashMap<AssetData, u64>,
) {
let mut builder = Builder::<TestNetwork, _>::new(
let mut builder = Builder::<Network, _>::new(
NETWORK,
// NOTE: this is going to add 20 more blocks to the actual
// expiration but there's no other exposed function that we could
Expand Down Expand Up @@ -2902,7 +2899,7 @@ pub mod testing {
asset_range,
),
)(
expiration_height in arb_height(BranchId::MASP, &TestNetwork),
expiration_height in arb_height(BranchId::MASP, &Network),
txins in assets
.iter()
.map(|(asset, values)| arb_txouts(asset.clone(), values.clone(), source))
Expand All @@ -2913,10 +2910,10 @@ pub mod testing {
.collect::<Vec<_>>(),
assets in Just(assets),
) -> (
Builder::<TestNetwork>,
Builder::<Network>,
HashMap<AssetData, u64>,
) {
let mut builder = Builder::<TestNetwork, _>::new(
let mut builder = Builder::<Network, _>::new(
NETWORK,
// NOTE: this is going to add 20 more blocks to the actual
// expiration but there's no other exposed function that we could
Expand Down Expand Up @@ -2945,7 +2942,7 @@ pub mod testing {
asset_range,
),
)(
expiration_height in arb_height(BranchId::MASP, &TestNetwork),
expiration_height in arb_height(BranchId::MASP, &Network),
spend_descriptions in assets
.iter()
.map(|(asset, values)| arb_spend_descriptions(asset.clone(), values.clone()))
Expand All @@ -2956,10 +2953,10 @@ pub mod testing {
.collect::<Vec<_>>(),
assets in Just(assets),
) -> (
Builder::<TestNetwork>,
Builder::<Network>,
HashMap<AssetData, u64>,
) {
let mut builder = Builder::<TestNetwork, _>::new(
let mut builder = Builder::<Network, _>::new(
NETWORK,
// NOTE: this is going to add 20 more blocks to the actual
// expiration but there's no other exposed function that we could
Expand Down
8 changes: 4 additions & 4 deletions wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions wasm_for_tests/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7172ac7

Please sign in to comment.