From 6b5864eeb54ecbcde51cf07980a33d17504ec193 Mon Sep 17 00:00:00 2001 From: Omar Date: Thu, 31 Oct 2024 14:39:49 +0300 Subject: [PATCH 1/6] Use dynamic addresses in invocations `ManifestInput` models --- .../model/manifest_dynamic_addresses.rs | 8 +- radix-common/src/data/manifest/model/mod.rs | 2 + .../src/blueprints/account/invocations.rs | 85 +- .../src/blueprints/locker/invocations.rs | 24 +- .../pool/multi_resource_pool/invocations.rs | 4 +- .../pool/one_resource_pool/invocations.rs | 2 +- .../pool/two_resource_pool/invocations.rs | 4 +- .../src/blueprints/resource/proof_rule.rs | 19 + radix-engine-monkey-tests/src/lib.rs | 13 +- radix-engine-monkey-tests/src/multi_pool.rs | 2 +- radix-engine-monkey-tests/src/two_pool.rs | 8 +- .../static_resource_movements_visitor.rs | 73 ++ .../account_authorized_depositors.rs | 32 +- .../tests/blueprints/account_locker.rs | 166 ++-- .../tests/blueprints/pool_multi_resource.rs | 9 +- .../tests/blueprints/pool_one_resource.rs | 4 +- .../tests/blueprints/pool_two_resource.rs | 6 +- .../tests/dec_macros/Cargo.lock | 819 ++++++++++++++++++ radix-engine-tests/tests/flash/pools.rs | 14 +- .../tests/system/assert_next_call_returns.rs | 2 +- radix-engine/assets/blueprints/Cargo.lock | 187 ++-- .../system/transaction/intent_processor.rs | 1 - .../utils/native_blueprint_call_validator.rs | 1 - .../account_authorized_depositors.rs | 6 +- .../src/scenarios/account_locker.rs | 90 +- .../src/scenarios/basic_subintents.rs | 10 +- .../src/builder/manifest_builder.rs | 4 +- .../src/builder/manifest_namer.rs | 84 +- .../static_resource_movements/effect.rs | 90 +- radix-transactions/src/model/v1/mod.rs | 2 - .../src/ledger_simulator/ledger_simulator.rs | 2 +- 31 files changed, 1401 insertions(+), 372 deletions(-) rename radix-transactions/src/model/v1/dynamic_addresses.rs => radix-common/src/data/manifest/model/manifest_dynamic_addresses.rs (98%) create mode 100644 radix-engine-tests/tests/dec_macros/Cargo.lock diff --git a/radix-transactions/src/model/v1/dynamic_addresses.rs b/radix-common/src/data/manifest/model/manifest_dynamic_addresses.rs similarity index 98% rename from radix-transactions/src/model/v1/dynamic_addresses.rs rename to radix-common/src/data/manifest/model/manifest_dynamic_addresses.rs index cb4141c8268..eb51edf158b 100644 --- a/radix-transactions/src/model/v1/dynamic_addresses.rs +++ b/radix-common/src/data/manifest/model/manifest_dynamic_addresses.rs @@ -39,7 +39,7 @@ TAKE_FROM_WORKTOP ``` */ -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum DynamicGlobalAddress { Static(GlobalAddress), Named(ManifestNamedAddress), @@ -214,7 +214,7 @@ impl TryFrom for DynamicGlobalAddress { } } -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum DynamicPackageAddress { Static(PackageAddress), Named(ManifestNamedAddress), @@ -339,7 +339,7 @@ impl TryFrom for DynamicPackageAddress { } } -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum DynamicComponentAddress { Static(ComponentAddress), Named(ManifestNamedAddress), @@ -441,7 +441,7 @@ impl TryFrom for DynamicComponentAddress { } } -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum DynamicResourceAddress { Static(ResourceAddress), Named(ManifestNamedAddress), diff --git a/radix-common/src/data/manifest/model/mod.rs b/radix-common/src/data/manifest/model/mod.rs index 4ebab2417ba..230455123fa 100644 --- a/radix-common/src/data/manifest/model/mod.rs +++ b/radix-common/src/data/manifest/model/mod.rs @@ -3,6 +3,7 @@ mod manifest_address_reservation; mod manifest_blob; mod manifest_bucket; mod manifest_decimal; +mod manifest_dynamic_addresses; mod manifest_expression; mod manifest_non_fungible_local_id; mod manifest_precise_decimal; @@ -14,6 +15,7 @@ pub use manifest_address_reservation::*; pub use manifest_blob::*; pub use manifest_bucket::*; pub use manifest_decimal::*; +pub use manifest_dynamic_addresses::*; pub use manifest_expression::*; pub use manifest_non_fungible_local_id::*; pub use manifest_precise_decimal::*; diff --git a/radix-engine-interface/src/blueprints/account/invocations.rs b/radix-engine-interface/src/blueprints/account/invocations.rs index 0b6a866f91b..f6f1e6a708e 100644 --- a/radix-engine-interface/src/blueprints/account/invocations.rs +++ b/radix-engine-interface/src/blueprints/account/invocations.rs @@ -160,7 +160,11 @@ pub struct AccountWithdrawInput { pub amount: Decimal, } -pub type AccountWithdrawManifestInput = AccountWithdrawInput; +#[derive(Debug, Eq, PartialEq, ManifestSbor)] +pub struct AccountWithdrawManifestInput { + pub resource_address: DynamicResourceAddress, + pub amount: Decimal, +} pub type AccountWithdrawOutput = Bucket; @@ -176,7 +180,11 @@ pub struct AccountWithdrawNonFungiblesInput { pub ids: IndexSet, } -pub type AccountWithdrawNonFungiblesManifestInput = AccountWithdrawNonFungiblesInput; +#[derive(Debug, Eq, PartialEq, ManifestSbor)] +pub struct AccountWithdrawNonFungiblesManifestInput { + pub resource_address: DynamicResourceAddress, + pub ids: IndexSet, +} pub type AccountWithdrawNonFungiblesOutput = Bucket; @@ -193,7 +201,12 @@ pub struct AccountLockFeeAndWithdrawInput { pub amount: Decimal, } -pub type AccountLockFeeAndWithdrawManifestInput = AccountLockFeeAndWithdrawInput; +#[derive(Debug, Eq, PartialEq, ManifestSbor)] +pub struct AccountLockFeeAndWithdrawManifestInput { + pub amount_to_lock: Decimal, + pub resource_address: DynamicResourceAddress, + pub amount: Decimal, +} pub type AccountLockFeeAndWithdrawOutput = Bucket; @@ -211,8 +224,12 @@ pub struct AccountLockFeeAndWithdrawNonFungiblesInput { pub ids: IndexSet, } -pub type AccountLockFeeAndWithdrawNonFungiblesManifestInput = - AccountLockFeeAndWithdrawNonFungiblesInput; +#[derive(Debug, Eq, PartialEq, ManifestSbor)] +pub struct AccountLockFeeAndWithdrawNonFungiblesManifestInput { + pub amount_to_lock: Decimal, + pub resource_address: DynamicResourceAddress, + pub ids: IndexSet, +} pub type AccountLockFeeAndWithdrawNonFungiblesOutput = Bucket; @@ -228,7 +245,11 @@ pub struct AccountCreateProofOfAmountInput { pub amount: Decimal, } -pub type AccountCreateProofOfAmountManifestInput = AccountCreateProofOfAmountInput; +#[derive(Debug, Eq, PartialEq, ManifestSbor)] +pub struct AccountCreateProofOfAmountManifestInput { + pub resource_address: DynamicResourceAddress, + pub amount: Decimal, +} pub type AccountCreateProofOfAmountOutput = Proof; @@ -244,7 +265,11 @@ pub struct AccountCreateProofOfNonFungiblesInput { pub ids: IndexSet, } -pub type AccountCreateProofOfNonFungiblesManifestInput = AccountCreateProofOfNonFungiblesInput; +#[derive(Debug, Eq, PartialEq, ManifestSbor)] +pub struct AccountCreateProofOfNonFungiblesManifestInput { + pub resource_address: DynamicResourceAddress, + pub ids: IndexSet, +} pub type AccountCreateProofOfNonFungiblesOutput = Proof; @@ -275,7 +300,11 @@ pub struct AccountSetResourcePreferenceInput { pub resource_preference: ResourcePreference, } -pub type AccountSetResourcePreferenceManifestInput = AccountSetResourcePreferenceInput; +#[derive(Debug, Eq, PartialEq, ManifestSbor)] +pub struct AccountSetResourcePreferenceManifestInput { + pub resource_address: DynamicResourceAddress, + pub resource_preference: ResourcePreference, +} pub type AccountSetResourcePreferenceOutput = (); @@ -290,7 +319,10 @@ pub struct AccountRemoveResourcePreferenceInput { pub resource_address: ResourceAddress, } -pub type AccountRemoveResourcePreferenceManifestInput = AccountRemoveResourcePreferenceInput; +#[derive(Debug, Eq, PartialEq, ManifestSbor)] +pub struct AccountRemoveResourcePreferenceManifestInput { + pub resource_address: DynamicResourceAddress, +} pub type AccountRemoveResourcePreferenceOutput = (); @@ -309,7 +341,7 @@ pub struct AccountTryDepositOrRefundInput { #[derive(Debug, Eq, PartialEq, ManifestSbor)] pub struct AccountTryDepositOrRefundManifestInput { pub bucket: ManifestBucket, - pub authorized_depositor_badge: Option, + pub authorized_depositor_badge: Option, } pub type AccountTryDepositOrRefundOutput = Option; @@ -329,7 +361,7 @@ pub struct AccountTryDepositBatchOrRefundInput { #[derive(Debug, Eq, PartialEq, ManifestSbor)] pub struct AccountTryDepositBatchOrRefundManifestInput { pub buckets: BucketBatch, - pub authorized_depositor_badge: Option, + pub authorized_depositor_badge: Option, } pub type AccountTryDepositBatchOrRefundOutput = Option>; @@ -349,7 +381,7 @@ pub struct AccountTryDepositOrAbortInput { #[derive(Debug, Eq, PartialEq, ManifestSbor)] pub struct AccountTryDepositOrAbortManifestInput { pub bucket: ManifestBucket, - pub authorized_depositor_badge: Option, + pub authorized_depositor_badge: Option, } pub type AccountTryDepositOrAbortOutput = (); @@ -369,7 +401,7 @@ pub struct AccountTryDepositBatchOrAbortInput { #[derive(Debug, Eq, PartialEq, ManifestSbor)] pub struct AccountTryDepositBatchOrAbortManifestInput { pub buckets: BucketBatch, - pub authorized_depositor_badge: Option, + pub authorized_depositor_badge: Option, } pub type AccountTryDepositBatchOrAbortOutput = (); @@ -386,7 +418,11 @@ pub struct AccountBurnInput { pub amount: Decimal, } -pub type AccountBurnManifestInput = AccountBurnInput; +#[derive(Debug, Eq, PartialEq, ManifestSbor)] +pub struct AccountBurnManifestInput { + pub resource_address: DynamicResourceAddress, + pub amount: Decimal, +} pub type AccountBurnOutput = (); @@ -402,7 +438,11 @@ pub struct AccountBurnNonFungiblesInput { pub ids: IndexSet, } -pub type AccountBurnNonFungiblesManifestInput = AccountBurnNonFungiblesInput; +#[derive(Debug, Eq, PartialEq, ManifestSbor)] +pub struct AccountBurnNonFungiblesManifestInput { + pub resource_address: DynamicResourceAddress, + pub ids: IndexSet, +} pub type AccountBurnNonFungiblesOutput = (); @@ -417,7 +457,10 @@ pub struct AccountAddAuthorizedDepositorInput { pub badge: ResourceOrNonFungible, } -pub type AccountAddAuthorizedDepositorManifestInput = AccountAddAuthorizedDepositorInput; +#[derive(Debug, Eq, PartialEq, ManifestSbor)] +pub struct AccountAddAuthorizedDepositorManifestInput { + pub badge: ManifestResourceOrNonFungible, +} pub type AccountAddAuthorizedDepositorOutput = (); @@ -432,7 +475,10 @@ pub struct AccountRemoveAuthorizedDepositorInput { pub badge: ResourceOrNonFungible, } -pub type AccountRemoveAuthorizedDepositorManifestInput = AccountRemoveAuthorizedDepositorInput; +#[derive(Debug, Eq, PartialEq, ManifestSbor)] +pub struct AccountRemoveAuthorizedDepositorManifestInput { + pub badge: ManifestResourceOrNonFungible, +} pub type AccountRemoveAuthorizedDepositorOutput = (); @@ -447,7 +493,10 @@ pub struct AccountBalanceInput { pub resource_address: ResourceAddress, } -pub type AccountBalanceManifestInput = AccountBalanceInput; +#[derive(Debug, Eq, PartialEq, ManifestSbor)] +pub struct AccountBalanceDynamicInput { + pub resource_address: DynamicResourceAddress, +} pub type AccountBalanceOutput = Decimal; diff --git a/radix-engine-interface/src/blueprints/locker/invocations.rs b/radix-engine-interface/src/blueprints/locker/invocations.rs index 7432f9179ca..2011eb23a42 100644 --- a/radix-engine-interface/src/blueprints/locker/invocations.rs +++ b/radix-engine-interface/src/blueprints/locker/invocations.rs @@ -61,7 +61,7 @@ define_invocation! { }, output: type (), manifest_input: struct { - claimant: ComponentAddress, + claimant: DynamicComponentAddress, bucket: ManifestBucket, try_direct_send: bool } @@ -77,7 +77,7 @@ define_invocation! { }, output: type Option, manifest_input: struct { - claimants: IndexMap, + claimants: IndexMap, bucket: ManifestBucket, try_direct_send: bool } @@ -97,8 +97,8 @@ define_invocation! { }, output: type Bucket, manifest_input: struct { - claimant: ComponentAddress, - resource_address: ResourceAddress, + claimant: DynamicComponentAddress, + resource_address: DynamicResourceAddress, amount: Decimal } } @@ -113,8 +113,8 @@ define_invocation! { }, output: type Bucket, manifest_input: struct { - claimant: ComponentAddress, - resource_address: ResourceAddress, + claimant: DynamicComponentAddress, + resource_address: DynamicResourceAddress, ids: IndexSet } } @@ -133,8 +133,8 @@ define_invocation! { }, output: type Bucket, manifest_input: struct { - claimant: ComponentAddress, - resource_address: ResourceAddress, + claimant: DynamicComponentAddress, + resource_address: DynamicResourceAddress, amount: Decimal } } @@ -149,8 +149,8 @@ define_invocation! { }, output: type Bucket, manifest_input: struct { - claimant: ComponentAddress, - resource_address: ResourceAddress, + claimant: DynamicComponentAddress, + resource_address: DynamicResourceAddress, ids: IndexSet } } @@ -183,8 +183,8 @@ define_invocation! { }, output: type IndexSet, manifest_input: struct { - claimant: ComponentAddress, - resource_address: ResourceAddress, + claimant: DynamicComponentAddress, + resource_address: DynamicResourceAddress, limit: u32 } } diff --git a/radix-engine-interface/src/blueprints/pool/multi_resource_pool/invocations.rs b/radix-engine-interface/src/blueprints/pool/multi_resource_pool/invocations.rs index bc17acaf454..139553a1f01 100644 --- a/radix-engine-interface/src/blueprints/pool/multi_resource_pool/invocations.rs +++ b/radix-engine-interface/src/blueprints/pool/multi_resource_pool/invocations.rs @@ -22,7 +22,7 @@ define_invocation! { manifest_input: struct { owner_role: OwnerRole, pool_manager_rule: AccessRule, - resource_addresses: IndexSet, + resource_addresses: IndexSet, address_reservation: Option } } @@ -73,7 +73,7 @@ define_invocation! { }, output: type Bucket, manifest_input: struct { - resource_address: ResourceAddress, + resource_address: DynamicResourceAddress, amount: Decimal, withdraw_strategy: WithdrawStrategy } diff --git a/radix-engine-interface/src/blueprints/pool/one_resource_pool/invocations.rs b/radix-engine-interface/src/blueprints/pool/one_resource_pool/invocations.rs index 729c7bc39f4..5a8244e1075 100644 --- a/radix-engine-interface/src/blueprints/pool/one_resource_pool/invocations.rs +++ b/radix-engine-interface/src/blueprints/pool/one_resource_pool/invocations.rs @@ -22,7 +22,7 @@ define_invocation! { manifest_input: struct { owner_role: OwnerRole, pool_manager_rule: AccessRule, - resource_address: ResourceAddress, + resource_address: DynamicResourceAddress, address_reservation: Option } } diff --git a/radix-engine-interface/src/blueprints/pool/two_resource_pool/invocations.rs b/radix-engine-interface/src/blueprints/pool/two_resource_pool/invocations.rs index 9724d98d9e3..a919114be56 100644 --- a/radix-engine-interface/src/blueprints/pool/two_resource_pool/invocations.rs +++ b/radix-engine-interface/src/blueprints/pool/two_resource_pool/invocations.rs @@ -22,7 +22,7 @@ define_invocation! { manifest_input: struct { owner_role: OwnerRole, pool_manager_rule: AccessRule, - resource_addresses: (ResourceAddress, ResourceAddress), + resource_addresses: (DynamicResourceAddress, DynamicResourceAddress), address_reservation: Option } } @@ -73,7 +73,7 @@ define_invocation! { }, output: type Bucket, manifest_input: struct { - resource_address: ResourceAddress, + resource_address: DynamicResourceAddress, amount: Decimal, withdraw_strategy: WithdrawStrategy } diff --git a/radix-engine-interface/src/blueprints/resource/proof_rule.rs b/radix-engine-interface/src/blueprints/resource/proof_rule.rs index 839d6336e87..c63fa4e74c7 100644 --- a/radix-engine-interface/src/blueprints/resource/proof_rule.rs +++ b/radix-engine-interface/src/blueprints/resource/proof_rule.rs @@ -25,6 +25,25 @@ pub enum ResourceOrNonFungible { Resource(ResourceAddress), } +#[derive(Debug, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, ManifestSbor)] +pub enum ManifestResourceOrNonFungible { + NonFungible(NonFungibleGlobalId), + Resource(DynamicResourceAddress), +} + +impl From for ManifestResourceOrNonFungible { + fn from(value: ResourceOrNonFungible) -> Self { + match value { + ResourceOrNonFungible::NonFungible(non_fungible_global_id) => { + Self::NonFungible(non_fungible_global_id) + } + ResourceOrNonFungible::Resource(resource_address) => { + Self::Resource(DynamicResourceAddress::Static(resource_address)) + } + } + } +} + impl Describe for ResourceOrNonFungible { const TYPE_ID: RustTypeId = RustTypeId::WellKnown(well_known_scrypto_custom_types::RESOURCE_OR_NON_FUNGIBLE_TYPE); diff --git a/radix-engine-monkey-tests/src/lib.rs b/radix-engine-monkey-tests/src/lib.rs index f38aebdb33c..452a3bd9c47 100644 --- a/radix-engine-monkey-tests/src/lib.rs +++ b/radix-engine-monkey-tests/src/lib.rs @@ -356,13 +356,12 @@ impl FuzzTest { fuzzer.add_resource(XRD); let validator_meta = { - let validator_address = validator_set + let validator_address = *validator_set .validators_by_stake_desc .iter() .next() .unwrap() - .0 - .clone(); + .0; let validator_substate = ledger.get_validator_info(validator_address); let stake_unit_resource = validator_substate.stake_unit_resource; let claim_resource = validator_substate.claim_nft; @@ -417,7 +416,7 @@ impl FuzzTest { TWO_RESOURCE_POOL_BLUEPRINT_IDENT, TWO_RESOURCE_POOL_INSTANTIATE_IDENT, TwoResourcePoolInstantiateManifestInput { - resource_addresses: (pool_resource1, pool_resource2), + resource_addresses: (pool_resource1.into(), pool_resource2.into()), pool_manager_rule: rule!(require(virtual_signature_badge.clone())), owner_role: OwnerRole::None, address_reservation: None, @@ -467,7 +466,11 @@ impl FuzzTest { MULTI_RESOURCE_POOL_BLUEPRINT_IDENT, MULTI_RESOURCE_POOL_INSTANTIATE_IDENT, MultiResourcePoolInstantiateManifestInput { - resource_addresses: pool_resources.clone().into_iter().collect(), + resource_addresses: pool_resources + .clone() + .into_iter() + .map(Into::into) + .collect(), pool_manager_rule: rule!(require(virtual_signature_badge.clone())), owner_role: OwnerRole::None, address_reservation: None, diff --git a/radix-engine-monkey-tests/src/multi_pool.rs b/radix-engine-monkey-tests/src/multi_pool.rs index 536b60de729..36efab4df09 100644 --- a/radix-engine-monkey-tests/src/multi_pool.rs +++ b/radix-engine-monkey-tests/src/multi_pool.rs @@ -87,7 +87,7 @@ impl MultiPoolFuzzAction { multi_pool_meta.pool_address, MULTI_RESOURCE_POOL_PROTECTED_WITHDRAW_IDENT, MultiResourcePoolProtectedWithdrawManifestInput { - resource_address, + resource_address: resource_address.into(), amount, withdraw_strategy, }, diff --git a/radix-engine-monkey-tests/src/two_pool.rs b/radix-engine-monkey-tests/src/two_pool.rs index 644031e4792..5c83e947181 100644 --- a/radix-engine-monkey-tests/src/two_pool.rs +++ b/radix-engine-monkey-tests/src/two_pool.rs @@ -97,7 +97,7 @@ impl TwoPoolFuzzAction { two_pool_meta.pool_address, TWO_RESOURCE_POOL_PROTECTED_WITHDRAW_IDENT, TwoResourcePoolProtectedWithdrawManifestInput { - resource_address: two_pool_meta.resource_address1, + resource_address: two_pool_meta.resource_address1.into(), amount: amount.into(), withdraw_strategy, }, @@ -112,7 +112,7 @@ impl TwoPoolFuzzAction { two_pool_meta.pool_address, TWO_RESOURCE_POOL_PROTECTED_WITHDRAW_IDENT, TwoResourcePoolProtectedWithdrawManifestInput { - resource_address: two_pool_meta.resource_address2, + resource_address: two_pool_meta.resource_address2.into(), amount, withdraw_strategy, }, @@ -149,7 +149,7 @@ impl TwoPoolFuzzAction { two_pool_meta.pool_address, TWO_RESOURCE_POOL_PROTECTED_WITHDRAW_IDENT, TwoResourcePoolProtectedWithdrawManifestInput { - resource_address: two_pool_meta.resource_address1, + resource_address: two_pool_meta.resource_address1.into(), amount, withdraw_strategy, }, @@ -165,7 +165,7 @@ impl TwoPoolFuzzAction { two_pool_meta.pool_address, TWO_RESOURCE_POOL_PROTECTED_WITHDRAW_IDENT, TwoResourcePoolProtectedWithdrawManifestInput { - resource_address: two_pool_meta.resource_address2, + resource_address: two_pool_meta.resource_address2.into(), amount, withdraw_strategy, }, diff --git a/radix-engine-tests/tests/application/static_resource_movements_visitor.rs b/radix-engine-tests/tests/application/static_resource_movements_visitor.rs index d1715c15dee..ee20880e550 100644 --- a/radix-engine-tests/tests/application/static_resource_movements_visitor.rs +++ b/radix-engine-tests/tests/application/static_resource_movements_visitor.rs @@ -606,6 +606,79 @@ fn static_analysis_on_a_vault_direct_method_succeeds() { assert!(rtn.is_ok()); } +#[test] +fn static_analysis_on_account_add_authorized_depositor_with_named_address_succeeds() { + // Arrange + let manifest_string = r#" + CALL_METHOD + Address("component_tdx_2_1cptxxxxxxxxxfaucetxxxxxxxxx000527798379xxxxxxxxxyulkzl") + "lock_fee" + Decimal("5000") + ; + CALL_METHOD + Address("account_tdx_2_16996e320lnez82q6430eunaz9l3n5fnwk6eh9avrmtmj22e7ll92cg") + "set_default_deposit_rule" + Enum<1u8>() + ; + CALL_METHOD + Address("account_tdx_2_168qgdkgfqxpnswu38wy6fy5v0q0um52zd0umuely5t9xrf88x4wqmf") + "set_default_deposit_rule" + Enum<1u8>() + ; + ALLOCATE_GLOBAL_ADDRESS + Address("package_tdx_2_1pkgxxxxxxxxxresrcexxxxxxxxx000538436477xxxxxxxxxmn4mes") + "FungibleResourceManager" + AddressReservation("reservation1") + NamedAddress("address1") + ; + CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY + Enum<0u8>() + true + 18u8 + Decimal("1") + Tuple( + Enum<0u8>(), + Enum<0u8>(), + Enum<0u8>(), + Enum<0u8>(), + Enum<0u8>(), + Enum<0u8>() + ) + Tuple( + Map(), + Map() + ) + Enum<1u8>( + AddressReservation("reservation1") + ) + ; + CALL_METHOD + Address("account_tdx_2_168qgdkgfqxpnswu38wy6fy5v0q0um52zd0umuely5t9xrf88x4wqmf") + "add_authorized_depositor" + Enum<1u8>( + NamedAddress("address1") + ) + ; + CALL_METHOD + Address("account_tdx_2_16996e320lnez82q6430eunaz9l3n5fnwk6eh9avrmtmj22e7ll92cg") + "deposit_batch" + Expression("ENTIRE_WORKTOP") + ; + "#; + let manifest = compile( + manifest_string, + &NetworkDefinition::stokenet(), + MockBlobProvider::new(), + ) + .unwrap(); + + // Act + let rtn = statically_analyze(&manifest); + + // Assert + assert!(rtn.is_ok()); +} + fn account_address(id: u64) -> ComponentAddress { unsafe { ComponentAddress::new_unchecked(node_id(EntityType::GlobalPreallocatedEd25519Account, id).0) diff --git a/radix-engine-tests/tests/blueprints/account_authorized_depositors.rs b/radix-engine-tests/tests/blueprints/account_authorized_depositors.rs index 2eb4bea71b4..b39fb072f74 100644 --- a/radix-engine-tests/tests/blueprints/account_authorized_depositors.rs +++ b/radix-engine-tests/tests/blueprints/account_authorized_depositors.rs @@ -96,9 +96,9 @@ fn try_authorized_deposit_or_refund_performs_a_refund_when_badge_is_not_in_depos ACCOUNT_TRY_DEPOSIT_OR_REFUND_IDENT, AccountTryDepositOrRefundManifestInput { bucket, - authorized_depositor_badge: Some(ResourceOrNonFungible::Resource( - VALIDATOR_OWNER_BADGE, - )), + authorized_depositor_badge: Some( + ResourceOrNonFungible::Resource(VALIDATOR_OWNER_BADGE).into(), + ), }, ) }) @@ -155,7 +155,7 @@ fn try_authorized_deposit_or_refund_panics_when_badge_is_in_depositors_list_but_ ACCOUNT_TRY_DEPOSIT_OR_REFUND_IDENT, AccountTryDepositOrRefundManifestInput { bucket, - authorized_depositor_badge: Some(badge), + authorized_depositor_badge: Some(badge.into()), }, ) }) @@ -211,7 +211,7 @@ fn try_authorized_deposit_or_refund_accepts_deposit_when_depositor_is_authorized ACCOUNT_TRY_DEPOSIT_OR_REFUND_IDENT, AccountTryDepositOrRefundManifestInput { bucket, - authorized_depositor_badge: Some(badge), + authorized_depositor_badge: Some(badge.into()), }, ) }) @@ -266,7 +266,7 @@ fn authorized_depositor_can_be_removed_later() { ACCOUNT_TRY_DEPOSIT_OR_REFUND_IDENT, AccountTryDepositOrRefundManifestInput { bucket, - authorized_depositor_badge: Some(badge.clone()), + authorized_depositor_badge: Some(badge.clone().into()), }, ) }) @@ -303,7 +303,7 @@ fn authorized_depositor_can_be_removed_later() { ACCOUNT_TRY_DEPOSIT_OR_REFUND_IDENT, AccountTryDepositOrRefundManifestInput { bucket, - authorized_depositor_badge: Some(badge), + authorized_depositor_badge: Some(badge.into()), }, ) }) @@ -404,7 +404,7 @@ fn try_authorized_deposit_batch_or_refund_panics_when_badge_is_in_depositors_lis .withdraw_from_account(account2, XRD, 1) .take_all_from_worktop(XRD, "bucket") .with_bucket("bucket", |builder, bucket| { - builder.try_deposit_batch_or_refund(account1, [bucket], Some(badge)) + builder.try_deposit_batch_or_refund(account1, [bucket], Some(badge.into())) }) .build(); let receipt = @@ -453,7 +453,7 @@ fn try_authorized_deposit_batch_or_refund_accepts_deposit_when_depositor_is_auth .withdraw_from_account(account2, XRD, 1) .take_all_from_worktop(XRD, "bucket") .with_bucket("bucket", |builder, bucket| { - builder.try_deposit_batch_or_refund(account1, [bucket], Some(badge)) + builder.try_deposit_batch_or_refund(account1, [bucket], Some(badge.into())) }) .build(); let receipt = @@ -503,9 +503,9 @@ fn try_authorized_deposit_or_abort_performs_an_abort_when_badge_is_not_in_deposi ACCOUNT_TRY_DEPOSIT_OR_ABORT_IDENT, AccountTryDepositOrAbortManifestInput { bucket, - authorized_depositor_badge: Some(ResourceOrNonFungible::Resource( - VALIDATOR_OWNER_BADGE, - )), + authorized_depositor_badge: Some( + ResourceOrNonFungible::Resource(VALIDATOR_OWNER_BADGE).into(), + ), }, ) }) @@ -560,7 +560,7 @@ fn try_authorized_deposit_or_abort_panics_when_badge_is_in_depositors_list_but_i ACCOUNT_TRY_DEPOSIT_OR_ABORT_IDENT, AccountTryDepositOrAbortManifestInput { bucket, - authorized_depositor_badge: Some(badge), + authorized_depositor_badge: Some(badge.into()), }, ) }) @@ -616,7 +616,7 @@ fn try_authorized_deposit_or_abort_accepts_deposit_when_depositor_is_authorized_ ACCOUNT_TRY_DEPOSIT_OR_ABORT_IDENT, AccountTryDepositOrAbortManifestInput { bucket, - authorized_depositor_badge: Some(badge), + authorized_depositor_badge: Some(badge.into()), }, ) }) @@ -715,7 +715,7 @@ fn try_authorized_deposit_batch_or_abort_panics_when_badge_is_in_depositors_list .withdraw_from_account(account2, XRD, 1) .take_all_from_worktop(XRD, "bucket") .with_bucket("bucket", |builder, bucket| { - builder.try_deposit_batch_or_abort(account1, [bucket], Some(badge)) + builder.try_deposit_batch_or_abort(account1, [bucket], Some(badge.into())) }) .build(); let receipt = @@ -764,7 +764,7 @@ fn try_authorized_deposit_batch_or_abort_accepts_deposit_when_depositor_is_autho .withdraw_from_account(account2, XRD, 1) .take_all_from_worktop(XRD, "bucket") .with_bucket("bucket", |builder, bucket| { - builder.try_deposit_batch_or_abort(account1, [bucket], Some(badge)) + builder.try_deposit_batch_or_abort(account1, [bucket], Some(badge.into())) }) .build(); let receipt = diff --git a/radix-engine-tests/tests/blueprints/account_locker.rs b/radix-engine-tests/tests/blueprints/account_locker.rs index 93d325f2d0a..6ab7412e0f6 100644 --- a/radix-engine-tests/tests/blueprints/account_locker.rs +++ b/radix-engine-tests/tests/blueprints/account_locker.rs @@ -196,7 +196,7 @@ fn store_can_only_be_called_by_storer_role() { ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant: account, + claimant: account.into(), try_direct_send: false, }, ) @@ -349,8 +349,8 @@ fn recover_can_only_be_called_by_recoverer_role() { account_locker, ACCOUNT_LOCKER_RECOVER_IDENT, AccountLockerRecoverManifestInput { - claimant: account, - resource_address: XRD, + claimant: account.into(), + resource_address: XRD.into(), amount: dec!(0), }, ) @@ -424,8 +424,8 @@ fn recover_non_fungibles_can_only_be_called_by_recoverer_role() { account_locker, ACCOUNT_LOCKER_RECOVER_NON_FUNGIBLES_IDENT, AccountLockerRecoverNonFungiblesManifestInput { - claimant: account, - resource_address: ACCOUNT_OWNER_BADGE, + claimant: account.into(), + resource_address: ACCOUNT_OWNER_BADGE.into(), ids: indexset! {}, }, ) @@ -500,7 +500,7 @@ fn send_or_store_stores_the_resources_if_the_account_rejects_the_deposit_and_the user_account, ACCOUNT_SET_RESOURCE_PREFERENCE_IDENT, AccountSetResourcePreferenceInput { - resource_address: XRD, + resource_address: XRD.into(), resource_preference: ResourcePreference::Disallowed, }, ) @@ -527,7 +527,7 @@ fn send_or_store_stores_the_resources_if_the_account_rejects_the_deposit_and_the account_locker, ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { - claimant: user_account, + claimant: user_account.into(), bucket, try_direct_send: true, }, @@ -596,7 +596,7 @@ fn send_or_store_sends_the_resources_if_the_locker_is_an_authorized_depositor() user_account, ACCOUNT_SET_RESOURCE_PREFERENCE_IDENT, AccountSetResourcePreferenceInput { - resource_address: XRD, + resource_address: XRD.into(), resource_preference: ResourcePreference::Disallowed, }, ) @@ -630,7 +630,7 @@ fn send_or_store_sends_the_resources_if_the_locker_is_an_authorized_depositor() account_locker, ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { - claimant: user_account, + claimant: user_account.into(), bucket, try_direct_send: true, }, @@ -699,8 +699,8 @@ fn claim_is_public_and_callable_by_all() { account_locker, ACCOUNT_LOCKER_CLAIM_IDENT, AccountLockerClaimManifestInput { - claimant: account, - resource_address: XRD, + claimant: account.into(), + resource_address: XRD.into(), amount: dec!(0), }, ) @@ -774,8 +774,8 @@ fn claim_non_fungibles_is_public_and_callable_by_all() { account_locker, ACCOUNT_LOCKER_CLAIM_NON_FUNGIBLES_IDENT, AccountLockerClaimNonFungiblesManifestInput { - claimant: account, - resource_address: ACCOUNT_OWNER_BADGE, + claimant: account.into(), + resource_address: ACCOUNT_OWNER_BADGE.into(), ids: indexset! {}, }, ) @@ -858,7 +858,7 @@ fn an_account_can_claim_its_resources_from_the_account_locker() { ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant: user_account1, + claimant: user_account1.into(), try_direct_send: false, }, ) @@ -878,8 +878,8 @@ fn an_account_can_claim_its_resources_from_the_account_locker() { account_locker, ACCOUNT_LOCKER_CLAIM_IDENT, AccountLockerClaimManifestInput { - claimant: user_account1, - resource_address: XRD, + claimant: user_account1.into(), + resource_address: XRD.into(), amount: dec!(10_000), }, ) @@ -957,7 +957,7 @@ fn an_account_cant_claim_another_accounts_resources_from_the_account_locker() { ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant: user_account1, + claimant: user_account1.into(), try_direct_send: false, }, ) @@ -977,8 +977,8 @@ fn an_account_cant_claim_another_accounts_resources_from_the_account_locker() { account_locker, ACCOUNT_LOCKER_CLAIM_IDENT, AccountLockerClaimManifestInput { - claimant: user_account1, - resource_address: XRD, + claimant: user_account1.into(), + resource_address: XRD.into(), amount: dec!(10_000), }, ) @@ -1056,7 +1056,7 @@ fn account_locker_admin_can_recover_resources_from_an_account_locker() { ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant: user_account1, + claimant: user_account1.into(), try_direct_send: false, }, ) @@ -1077,8 +1077,8 @@ fn account_locker_admin_can_recover_resources_from_an_account_locker() { account_locker, ACCOUNT_LOCKER_RECOVER_IDENT, AccountLockerRecoverManifestInput { - claimant: user_account1, - resource_address: XRD, + claimant: user_account1.into(), + resource_address: XRD.into(), amount: dec!(10_000), }, ) @@ -1155,7 +1155,7 @@ fn account_locker_admin_cant_recover_resources_from_an_account_locker_when_disab ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant: user_account1, + claimant: user_account1.into(), try_direct_send: false, }, ) @@ -1176,8 +1176,8 @@ fn account_locker_admin_cant_recover_resources_from_an_account_locker_when_disab account_locker, ACCOUNT_LOCKER_RECOVER_IDENT, AccountLockerRecoverManifestInput { - claimant: user_account1, - resource_address: XRD, + claimant: user_account1.into(), + resource_address: XRD.into(), amount: dec!(10_000), }, ) @@ -1257,7 +1257,7 @@ fn get_amount_method_reports_the_correct_amount_in_the_vault() { ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant: user_account1, + claimant: user_account1.into(), try_direct_send: false, }, ) @@ -1277,8 +1277,8 @@ fn get_amount_method_reports_the_correct_amount_in_the_vault() { account_locker, ACCOUNT_LOCKER_GET_AMOUNT_IDENT, AccountLockerGetAmountManifestInput { - claimant: user_account1, - resource_address: XRD, + claimant: user_account1.into(), + resource_address: XRD.into(), }, ) .build(), @@ -1351,7 +1351,7 @@ fn get_non_fungible_local_ids_method_reports_the_correct_ids_in_the_vault() { ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant: user_account1, + claimant: user_account1.into(), try_direct_send: false, }, ) @@ -1371,8 +1371,8 @@ fn get_non_fungible_local_ids_method_reports_the_correct_ids_in_the_vault() { account_locker, ACCOUNT_LOCKER_GET_NON_FUNGIBLE_LOCAL_IDS_IDENT, AccountLockerGetNonFungibleLocalIdsManifestInput { - claimant: user_account1, - resource_address: non_fungible_resource, + claimant: user_account1.into(), + resource_address: non_fungible_resource.into(), limit: 100, }, ) @@ -1435,7 +1435,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { account, ACCOUNT_SET_RESOURCE_PREFERENCE_IDENT, AccountSetResourcePreferenceInput { - resource_address: resource, + resource_address: resource.into(), resource_preference: ResourcePreference::Disallowed, }, ) @@ -1498,7 +1498,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { //======= Item { action: LockerAction::Store { - claimant: user_account1, + claimant: user_account1.into(), resource_to_mint: fungible_resource1, items_to_mint: ResourceSpecifier::Fungible(dec!(1)), }, @@ -1510,7 +1510,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::Store { - claimant: user_account2, + claimant: user_account2.into(), resource_to_mint: fungible_resource1, items_to_mint: ResourceSpecifier::Fungible(dec!(1)), }, @@ -1554,7 +1554,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { //=============== Item { action: LockerAction::SendOrStore { - claimant: user_account1, + claimant: user_account1.into(), resource_to_mint: fungible_resource1, items_to_mint: ResourceSpecifier::Fungible(dec!(1)), }, @@ -1576,7 +1576,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::SendOrStore { - claimant: user_account1, + claimant: user_account1.into(), resource_to_mint: fungible_resource2, items_to_mint: ResourceSpecifier::Fungible(dec!(1)), }, @@ -1596,7 +1596,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::SendOrStore { - claimant: user_account1, + claimant: user_account1.into(), resource_to_mint: fungible_resource3, items_to_mint: ResourceSpecifier::Fungible(dec!(1)), }, @@ -1616,7 +1616,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::SendOrStore { - claimant: user_account2, + claimant: user_account2.into(), resource_to_mint: fungible_resource1, items_to_mint: ResourceSpecifier::Fungible(dec!(1)), }, @@ -1636,7 +1636,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::SendOrStore { - claimant: user_account2, + claimant: user_account2.into(), resource_to_mint: fungible_resource2, items_to_mint: ResourceSpecifier::Fungible(dec!(1)), }, @@ -1658,7 +1658,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::SendOrStore { - claimant: user_account2, + claimant: user_account2.into(), resource_to_mint: fungible_resource3, items_to_mint: ResourceSpecifier::Fungible(dec!(1)), }, @@ -1678,7 +1678,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::SendOrStore { - claimant: user_account3, + claimant: user_account3.into(), resource_to_mint: fungible_resource1, items_to_mint: ResourceSpecifier::Fungible(dec!(1)), }, @@ -1698,7 +1698,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::SendOrStore { - claimant: user_account3, + claimant: user_account3.into(), resource_to_mint: fungible_resource2, items_to_mint: ResourceSpecifier::Fungible(dec!(1)), }, @@ -1718,7 +1718,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::SendOrStore { - claimant: user_account3, + claimant: user_account3.into(), resource_to_mint: fungible_resource3, items_to_mint: ResourceSpecifier::Fungible(dec!(1)), }, @@ -1825,7 +1825,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { //========= Item { action: LockerAction::Recover { - claimant: user_account1, + claimant: user_account1.into(), resource_to_recover: fungible_resource1, items_to_recover: ResourceSpecifier::Fungible(dec!(1)), }, @@ -1849,7 +1849,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { //======= Item { action: LockerAction::Claim { - claimant: user_account2, + claimant: user_account2.into(), resource_to_claim: fungible_resource2, items_to_claim: ResourceSpecifier::Fungible(dec!(1)), }, @@ -1873,7 +1873,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { //======= Item { action: LockerAction::Store { - claimant: user_account1, + claimant: user_account1.into(), resource_to_mint: non_fungible_resource1, items_to_mint: ResourceSpecifier::NonFungible(indexset!( NonFungibleLocalId::integer(1), @@ -1905,7 +1905,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { //=============== Item { action: LockerAction::SendOrStore { - claimant: user_account1, + claimant: user_account1.into(), resource_to_mint: non_fungible_resource1, items_to_mint: ResourceSpecifier::NonFungible(indexset!( NonFungibleLocalId::integer(3), @@ -1934,7 +1934,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::SendOrStore { - claimant: user_account2, + claimant: user_account2.into(), resource_to_mint: non_fungible_resource1, items_to_mint: ResourceSpecifier::NonFungible(indexset!( NonFungibleLocalId::integer(5), @@ -1963,7 +1963,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::SendOrStore { - claimant: user_account3, + claimant: user_account3.into(), resource_to_mint: non_fungible_resource1, items_to_mint: ResourceSpecifier::NonFungible(indexset!( NonFungibleLocalId::integer(7), @@ -1999,7 +1999,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::SendOrStore { - claimant: user_account1, + claimant: user_account1.into(), resource_to_mint: non_fungible_resource2, items_to_mint: ResourceSpecifier::NonFungible(indexset!( NonFungibleLocalId::integer(1), @@ -2033,7 +2033,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::SendOrStore { - claimant: user_account2, + claimant: user_account2.into(), resource_to_mint: non_fungible_resource2, items_to_mint: ResourceSpecifier::NonFungible(indexset!( NonFungibleLocalId::integer(3), @@ -2074,7 +2074,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::SendOrStore { - claimant: user_account3, + claimant: user_account3.into(), resource_to_mint: non_fungible_resource2, items_to_mint: ResourceSpecifier::NonFungible(indexset!( NonFungibleLocalId::integer(5), @@ -2113,7 +2113,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::SendOrStore { - claimant: user_account1, + claimant: user_account1.into(), resource_to_mint: non_fungible_resource3, items_to_mint: ResourceSpecifier::NonFungible(indexset!( NonFungibleLocalId::integer(1), @@ -2159,7 +2159,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::SendOrStore { - claimant: user_account2, + claimant: user_account2.into(), resource_to_mint: non_fungible_resource3, items_to_mint: ResourceSpecifier::NonFungible(indexset!( NonFungibleLocalId::integer(3), @@ -2203,7 +2203,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::SendOrStore { - claimant: user_account3, + claimant: user_account3.into(), resource_to_mint: non_fungible_resource3, items_to_mint: ResourceSpecifier::NonFungible(indexset!( NonFungibleLocalId::integer(5), @@ -2388,7 +2388,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { //========= Item { action: LockerAction::Recover { - claimant: user_account3, + claimant: user_account3.into(), resource_to_recover: non_fungible_resource1, items_to_recover: ResourceSpecifier::NonFungible(indexset!( NonFungibleLocalId::integer(7), @@ -2441,7 +2441,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::Recover { - claimant: user_account3, + claimant: user_account3.into(), resource_to_recover: non_fungible_resource1, items_to_recover: ResourceSpecifier::Fungible(dec!(1)), }, @@ -2493,7 +2493,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { //======= Item { action: LockerAction::Claim { - claimant: user_account3, + claimant: user_account3.into(), resource_to_claim: non_fungible_resource1, items_to_claim: ResourceSpecifier::NonFungible(indexset!( NonFungibleLocalId::integer(20) @@ -2543,7 +2543,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { }, Item { action: LockerAction::Claim { - claimant: user_account3, + claimant: user_account3.into(), resource_to_claim: non_fungible_resource1, items_to_claim: ResourceSpecifier::Fungible(dec!(1)), }, @@ -2620,7 +2620,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant, + claimant: claimant.into(), try_direct_send: false, }, ) @@ -2650,7 +2650,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant, + claimant: claimant.into(), try_direct_send: false, }, ) @@ -2680,7 +2680,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant, + claimant: claimant.into(), try_direct_send: true, }, ) @@ -2710,7 +2710,7 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant, + claimant: claimant.into(), try_direct_send: true, }, ) @@ -2749,7 +2749,10 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { ACCOUNT_LOCKER_AIRDROP_IDENT, AccountLockerAirdropManifestInput { bucket, - claimants: claimants.into_iter().collect(), + claimants: claimants + .into_iter() + .map(|(k, v)| (k.into(), v)) + .collect(), try_direct_send: false, }, ) @@ -2788,7 +2791,10 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { ACCOUNT_LOCKER_AIRDROP_IDENT, AccountLockerAirdropManifestInput { bucket, - claimants: claimants.into_iter().collect(), + claimants: claimants + .into_iter() + .map(|(k, v)| (k.into(), v)) + .collect(), try_direct_send: true, }, ) @@ -2814,8 +2820,8 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { account_locker, ACCOUNT_LOCKER_RECOVER_IDENT, AccountLockerRecoverManifestInput { - claimant, - resource_address: resource_to_recover, + claimant: claimant.into(), + resource_address: resource_to_recover.into(), amount, }, ) @@ -2841,8 +2847,8 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { account_locker, ACCOUNT_LOCKER_RECOVER_NON_FUNGIBLES_IDENT, AccountLockerRecoverNonFungiblesManifestInput { - claimant, - resource_address: resource_to_recover, + claimant: claimant.into(), + resource_address: resource_to_recover.into(), ids, }, ) @@ -2863,8 +2869,8 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { account_locker, ACCOUNT_LOCKER_CLAIM_IDENT, AccountLockerClaimManifestInput { - claimant, - resource_address: resource_to_claim, + claimant: claimant.into(), + resource_address: resource_to_claim.into(), amount, }, ) @@ -2888,8 +2894,8 @@ fn state_of_the_account_locker_can_be_reconciled_from_events_alone() { account_locker, ACCOUNT_LOCKER_CLAIM_NON_FUNGIBLES_IDENT, AccountLockerClaimNonFungiblesManifestInput { - claimant, - resource_address: resource_to_claim, + claimant: claimant.into(), + resource_address: resource_to_claim.into(), ids, }, ) @@ -3122,7 +3128,7 @@ fn send_does_not_accept_an_address_that_is_not_an_account() { ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant: FAUCET, + claimant: FAUCET.into(), try_direct_send: false, }, ) @@ -3206,7 +3212,7 @@ fn airdrop_does_not_accept_an_address_that_is_not_an_account() { AccountLockerAirdropManifestInput { bucket, claimants: indexmap! { - FAUCET => ResourceSpecifier::Fungible(dec!(1)) + FAUCET.into() => ResourceSpecifier::Fungible(dec!(1)) }, try_direct_send: false, }, @@ -3286,8 +3292,8 @@ fn claim_does_not_accept_an_address_that_is_not_an_account() { account_locker, ACCOUNT_LOCKER_CLAIM_IDENT, AccountLockerClaimManifestInput { - claimant: FAUCET, - resource_address: XRD, + claimant: FAUCET.into(), + resource_address: XRD.into(), amount: dec!(1), }, ) @@ -3365,8 +3371,8 @@ fn recover_does_not_accept_an_address_that_is_not_an_account() { account_locker, ACCOUNT_LOCKER_RECOVER_IDENT, AccountLockerRecoverManifestInput { - claimant: FAUCET, - resource_address: XRD, + claimant: FAUCET.into(), + resource_address: XRD.into(), amount: dec!(1), }, ) @@ -3474,7 +3480,7 @@ fn exceeding_one_of_the_limits_when_airdropping_returns_the_expected_error() { AccountLockerAirdropManifestInput { claimants: keys_and_accounts .iter() - .map(|entry| (entry.1, ResourceSpecifier::Fungible(dec!(1)))) + .map(|entry| (entry.1.into(), ResourceSpecifier::Fungible(dec!(1)))) .collect(), bucket, try_direct_send: true, diff --git a/radix-engine-tests/tests/blueprints/pool_multi_resource.rs b/radix-engine-tests/tests/blueprints/pool_multi_resource.rs index f6fa2afdf63..22d5d366d61 100644 --- a/radix-engine-tests/tests/blueprints/pool_multi_resource.rs +++ b/radix-engine-tests/tests/blueprints/pool_multi_resource.rs @@ -419,7 +419,7 @@ fn creating_a_pool_with_non_fungible_resources_fails() { MULTI_RESOURCE_POOL_BLUEPRINT_IDENT, MULTI_RESOURCE_POOL_INSTANTIATE_IDENT, MultiResourcePoolInstantiateManifestInput { - resource_addresses: indexset!(non_fungible_resource), + resource_addresses: indexset!(non_fungible_resource.into()), pool_manager_rule: rule!(allow_all), owner_role: OwnerRole::None, address_reservation: None, @@ -843,7 +843,10 @@ impl TestEnvironment { MULTI_RESOURCE_POOL_BLUEPRINT_IDENT, MULTI_RESOURCE_POOL_INSTANTIATE_IDENT, MultiResourcePoolInstantiateManifestInput { - resource_addresses: resource_addresses.into_iter().collect(), + resource_addresses: resource_addresses + .into_iter() + .map(Into::into) + .collect(), pool_manager_rule: rule!(require(virtual_signature_badge)), owner_role, address_reservation: None, @@ -947,7 +950,7 @@ impl TestEnvironment { self.pool_component_address, MULTI_RESOURCE_POOL_PROTECTED_WITHDRAW_IDENT, MultiResourcePoolProtectedWithdrawManifestInput { - resource_address, + resource_address: resource_address.into(), amount: amount.into(), withdraw_strategy, }, diff --git a/radix-engine-tests/tests/blueprints/pool_one_resource.rs b/radix-engine-tests/tests/blueprints/pool_one_resource.rs index d126554f3ef..0b59d60911b 100644 --- a/radix-engine-tests/tests/blueprints/pool_one_resource.rs +++ b/radix-engine-tests/tests/blueprints/pool_one_resource.rs @@ -450,7 +450,7 @@ fn creating_a_pool_with_non_fungible_resources_fails() { ONE_RESOURCE_POOL_BLUEPRINT_IDENT, ONE_RESOURCE_POOL_INSTANTIATE_IDENT, OneResourcePoolInstantiateManifestInput { - resource_address: non_fungible_resource, + resource_address: non_fungible_resource.into(), pool_manager_rule: rule!(allow_all), owner_role: OwnerRole::None, address_reservation: None, @@ -731,7 +731,7 @@ impl TestEnvironment { ONE_RESOURCE_POOL_BLUEPRINT_IDENT, ONE_RESOURCE_POOL_INSTANTIATE_IDENT, OneResourcePoolInstantiateManifestInput { - resource_address, + resource_address: resource_address.into(), pool_manager_rule: rule!(require(virtual_signature_badge)), owner_role, address_reservation: None, diff --git a/radix-engine-tests/tests/blueprints/pool_two_resource.rs b/radix-engine-tests/tests/blueprints/pool_two_resource.rs index 873a1516074..6b5082b12cf 100644 --- a/radix-engine-tests/tests/blueprints/pool_two_resource.rs +++ b/radix-engine-tests/tests/blueprints/pool_two_resource.rs @@ -439,7 +439,7 @@ fn creating_a_pool_with_non_fungible_resources_fails() { TWO_RESOURCE_POOL_BLUEPRINT_IDENT, TWO_RESOURCE_POOL_INSTANTIATE_IDENT, TwoResourcePoolInstantiateManifestInput { - resource_addresses: (non_fungible_resource, XRD), + resource_addresses: (non_fungible_resource.into(), XRD.into()), pool_manager_rule: rule!(allow_all), owner_role: OwnerRole::None, address_reservation: None, @@ -1019,7 +1019,7 @@ impl TestEnvironment { TWO_RESOURCE_POOL_BLUEPRINT_IDENT, TWO_RESOURCE_POOL_INSTANTIATE_IDENT, TwoResourcePoolInstantiateManifestInput { - resource_addresses: (pool_resource1, pool_resource2), + resource_addresses: (pool_resource1.into(), pool_resource2.into()), pool_manager_rule: rule!(require(virtual_signature_badge)), owner_role, address_reservation: None, @@ -1136,7 +1136,7 @@ impl TestEnvironment { self.pool_component_address, TWO_RESOURCE_POOL_PROTECTED_WITHDRAW_IDENT, TwoResourcePoolProtectedWithdrawManifestInput { - resource_address, + resource_address: resource_address.into(), amount: amount.into(), withdraw_strategy, }, diff --git a/radix-engine-tests/tests/dec_macros/Cargo.lock b/radix-engine-tests/tests/dec_macros/Cargo.lock new file mode 100644 index 00000000000..400774eac9a --- /dev/null +++ b/radix-engine-tests/tests/dec_macros/Cargo.lock @@ -0,0 +1,819 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "blst" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4378725facc195f1a538864863f6de233b500a8862747e7f165078a419d5e874" +dependencies = [ + "cc", + "glob", + "threadpool", + "zeroize", +] + +[[package]] +name = "bnum" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e31ea183f6ee62ac8b8a8cf7feddd766317adfb13ff469de57ce033efd6a790" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "cc" +version = "1.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "const-sha1" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8a42181e0652c2997ae4d217f25b63c5337a52fd2279736e97b832fa0a3cff" + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "dec_macros" +version = "1.0.0-rc1" +dependencies = [ + "radix-common", + "radix-engine-interface", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown 0.15.0", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +dependencies = [ + "spin", +] + +[[package]] +name = "libc" +version = "0.2.161" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "proc-macro2" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radix-blueprint-schema-init" +version = "1.3.0-dev" +dependencies = [ + "bitflags", + "radix-common", + "sbor", + "serde", +] + +[[package]] +name = "radix-common" +version = "1.3.0-dev" +dependencies = [ + "bech32", + "blake2", + "blst", + "bnum", + "ed25519-dalek", + "hex", + "lazy_static", + "num-bigint", + "num-integer", + "num-traits", + "paste", + "radix-rust", + "radix-sbor-derive", + "sbor", + "secp256k1", + "sha3", + "strum", + "zeroize", +] + +[[package]] +name = "radix-common-derive" +version = "1.3.0-dev" +dependencies = [ + "paste", + "proc-macro2", + "quote", + "radix-common", + "syn 1.0.109", +] + +[[package]] +name = "radix-engine-interface" +version = "1.3.0-dev" +dependencies = [ + "bitflags", + "const-sha1", + "hex", + "lazy_static", + "paste", + "radix-blueprint-schema-init", + "radix-common", + "radix-common-derive", + "radix-rust", + "regex", + "sbor", + "serde", + "serde_json", + "strum", +] + +[[package]] +name = "radix-rust" +version = "1.3.0-dev" +dependencies = [ + "hashbrown 0.13.2", + "indexmap", +] + +[[package]] +name = "radix-sbor-derive" +version = "1.3.0-dev" +dependencies = [ + "proc-macro2", + "quote", + "sbor-derive-common", + "syn 1.0.109", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "regex" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +dependencies = [ + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" +dependencies = [ + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustversion" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "sbor" +version = "1.3.0-dev" +dependencies = [ + "const-sha1", + "hex", + "lazy_static", + "paste", + "radix-rust", + "sbor-derive", + "serde", +] + +[[package]] +name = "sbor-derive" +version = "1.3.0-dev" +dependencies = [ + "proc-macro2", + "sbor-derive-common", + "syn 1.0.109", +] + +[[package]] +name = "sbor-derive-common" +version = "1.3.0-dev" +dependencies = [ + "const-sha1", + "indexmap", + "itertools", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "secp256k1" +version = "0.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" +dependencies = [ + "cc", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "serde" +version = "1.0.214" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.214" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "serde_json" +version = "1.0.132" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "rand_core", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 1.0.109", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] diff --git a/radix-engine-tests/tests/flash/pools.rs b/radix-engine-tests/tests/flash/pools.rs index 5d9600866d8..bceddc37def 100644 --- a/radix-engine-tests/tests/flash/pools.rs +++ b/radix-engine-tests/tests/flash/pools.rs @@ -30,7 +30,7 @@ fn database_is_consistent_before_and_after_protocol_update() { OneResourcePoolInstantiateManifestInput { owner_role: OwnerRole::None, pool_manager_rule: rule!(require(virtual_signature_badge.clone())), - resource_address: fungible1, + resource_address: fungible1.into(), address_reservation: None, }, ) @@ -41,7 +41,7 @@ fn database_is_consistent_before_and_after_protocol_update() { TwoResourcePoolInstantiateManifestInput { owner_role: OwnerRole::None, pool_manager_rule: rule!(require(virtual_signature_badge.clone())), - resource_addresses: (fungible1, fungible2), + resource_addresses: (fungible1.into(), fungible2.into()), address_reservation: None, }, ) @@ -52,7 +52,7 @@ fn database_is_consistent_before_and_after_protocol_update() { MultiResourcePoolInstantiateManifestInput { owner_role: OwnerRole::None, pool_manager_rule: rule!(require(virtual_signature_badge.clone())), - resource_addresses: indexset! {fungible1, fungible2}, + resource_addresses: indexset! {fungible1.into(), fungible2.into()}, address_reservation: None, }, ) @@ -117,7 +117,7 @@ fn single_sided_contributions_to_two_resource_pool_are_only_allowed_after_protoc TwoResourcePoolInstantiateManifestInput { owner_role: OwnerRole::None, pool_manager_rule: rule!(require(virtual_signature_badge.clone())), - resource_addresses: (fungible1, fungible2), + resource_addresses: (fungible1.into(), fungible2.into()), address_reservation: Some(reservation), }, ) @@ -132,7 +132,7 @@ fn single_sided_contributions_to_two_resource_pool_are_only_allowed_after_protoc named_address, TWO_RESOURCE_POOL_PROTECTED_WITHDRAW_IDENT, TwoResourcePoolProtectedWithdrawManifestInput { - resource_address: fungible1, + resource_address: fungible1.into(), amount: dec!(100), withdraw_strategy: WithdrawStrategy::Exact, }, @@ -271,7 +271,7 @@ fn single_sided_contributions_to_multi_resource_pool_are_only_allowed_after_prot MultiResourcePoolInstantiateManifestInput { owner_role: OwnerRole::None, pool_manager_rule: rule!(require(virtual_signature_badge.clone())), - resource_addresses: indexset![fungible1, fungible2], + resource_addresses: indexset![fungible1.into(), fungible2.into()], address_reservation: Some(reservation), }, ) @@ -286,7 +286,7 @@ fn single_sided_contributions_to_multi_resource_pool_are_only_allowed_after_prot named_address, MULTI_RESOURCE_POOL_PROTECTED_WITHDRAW_IDENT, MultiResourcePoolProtectedWithdrawManifestInput { - resource_address: fungible1, + resource_address: fungible1.into(), amount: dec!(100), withdraw_strategy: WithdrawStrategy::Exact, }, diff --git a/radix-engine-tests/tests/system/assert_next_call_returns.rs b/radix-engine-tests/tests/system/assert_next_call_returns.rs index 2b2160e7911..c30ba4b2a16 100644 --- a/radix-engine-tests/tests/system/assert_next_call_returns.rs +++ b/radix-engine-tests/tests/system/assert_next_call_returns.rs @@ -457,7 +457,7 @@ fn create_pool( TWO_RESOURCE_POOL_BLUEPRINT_IDENT, TWO_RESOURCE_POOL_INSTANTIATE_IDENT, TwoResourcePoolInstantiateManifestInput { - resource_addresses: (pool_resource1, pool_resource2), + resource_addresses: (pool_resource1.into(), pool_resource2.into()), pool_manager_rule: AccessRule::AllowAll, owner_role: OwnerRole::None, address_reservation: None, diff --git a/radix-engine/assets/blueprints/Cargo.lock b/radix-engine/assets/blueprints/Cargo.lock index 3843448ca6a..0c99706cd3e 100644 --- a/radix-engine/assets/blueprints/Cargo.lock +++ b/radix-engine/assets/blueprints/Cargo.lock @@ -8,6 +8,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + [[package]] name = "bech32" version = "0.9.1" @@ -26,16 +32,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", + "digest", ] [[package]] @@ -69,12 +66,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - [[package]] name = "cc" version = "1.0.83" @@ -90,6 +81,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "const-sha1" version = "0.3.0" @@ -117,24 +114,39 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "3.2.1" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core", + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version", "subtle", "zeroize", ] [[package]] -name = "digest" -version = "0.9.0" +name = "curve25519-dalek-derive" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ - "generic-array", + "proc-macro2", + "quote", + "syn 2.0.76", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", ] [[package]] @@ -143,31 +155,32 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", "crypto-common", "subtle", ] [[package]] name = "ed25519" -version = "1.5.3" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ + "pkcs8", "signature", ] [[package]] name = "ed25519-dalek" -version = "1.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ "curve25519-dalek", "ed25519", - "rand", "serde", "sha2", + "subtle", "zeroize", ] @@ -190,6 +203,12 @@ dependencies = [ "scrypto", ] +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "generic-array" version = "0.14.7" @@ -209,9 +228,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.1.16" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -344,12 +363,6 @@ dependencies = [ "libc", ] -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - [[package]] name = "paste" version = "1.0.14" @@ -357,10 +370,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] -name = "ppv-lite86" -version = "0.2.17" +name = "pkcs8" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] [[package]] name = "proc-macro2" @@ -464,47 +481,15 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom", - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core", -] - [[package]] name = "rand_core" -version = "0.5.1" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ "getrandom", ] -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - [[package]] name = "regex" version = "1.9.3" @@ -530,6 +515,15 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustversion" version = "1.0.14" @@ -628,6 +622,12 @@ dependencies = [ "cc", ] +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + [[package]] name = "serde" version = "1.0.209" @@ -662,15 +662,13 @@ dependencies = [ [[package]] name = "sha2" -version = "0.9.9" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "block-buffer 0.9.0", "cfg-if", "cpufeatures", - "digest 0.9.0", - "opaque-debug", + "digest", ] [[package]] @@ -679,15 +677,28 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "digest 0.10.7", + "digest", "keccak", ] [[package]] name = "signature" -version = "1.6.4" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "rand_core", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "strum" @@ -768,15 +779,15 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "zeroize" -version = "1.3.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ "zeroize_derive", ] diff --git a/radix-engine/src/system/transaction/intent_processor.rs b/radix-engine/src/system/transaction/intent_processor.rs index 2d29cdba7af..76ee509a72a 100644 --- a/radix-engine/src/system/transaction/intent_processor.rs +++ b/radix-engine/src/system/transaction/intent_processor.rs @@ -15,7 +15,6 @@ use radix_engine_interface::blueprints::transaction_processor::*; use radix_native_sdk::resource::{NativeBucket, NativeNonFungibleBucket, Worktop}; use radix_native_sdk::runtime::LocalAuthZone; use radix_transactions::data::TransformHandler; -use radix_transactions::model::*; use radix_transactions::validation::*; use sbor::rust::prelude::*; diff --git a/radix-engine/src/utils/native_blueprint_call_validator.rs b/radix-engine/src/utils/native_blueprint_call_validator.rs index c1cdd430894..5deec4dd478 100644 --- a/radix-engine/src/utils/native_blueprint_call_validator.rs +++ b/radix-engine/src/utils/native_blueprint_call_validator.rs @@ -15,7 +15,6 @@ use radix_engine_interface::object_modules::metadata::*; use radix_engine_interface::object_modules::role_assignment::*; use radix_engine_interface::object_modules::royalty::*; use radix_transactions::manifest::*; -use radix_transactions::prelude::*; pub fn validate_call_arguments_to_native_components( manifest: &impl ReadableManifest, diff --git a/radix-transaction-scenarios/src/scenarios/account_authorized_depositors.rs b/radix-transaction-scenarios/src/scenarios/account_authorized_depositors.rs index 5bca570eddc..007607db86a 100644 --- a/radix-transaction-scenarios/src/scenarios/account_authorized_depositors.rs +++ b/radix-transaction-scenarios/src/scenarios/account_authorized_depositors.rs @@ -130,7 +130,7 @@ impl ScenarioCreator for AccountAuthorizedDepositorsScenarioCreator { config.destination_account.address, ACCOUNT_TRY_DEPOSIT_OR_REFUND_IDENT, AccountTryDepositOrRefundManifestInput { - authorized_depositor_badge: Some(badge), + authorized_depositor_badge: Some(badge.into()), bucket } ) @@ -156,7 +156,7 @@ impl ScenarioCreator for AccountAuthorizedDepositorsScenarioCreator { config.destination_account.address, ACCOUNT_TRY_DEPOSIT_OR_REFUND_IDENT, AccountTryDepositOrRefundManifestInput { - authorized_depositor_badge: Some(badge), + authorized_depositor_badge: Some(badge.into()), bucket } ) @@ -182,7 +182,7 @@ impl ScenarioCreator for AccountAuthorizedDepositorsScenarioCreator { config.destination_account.address, ACCOUNT_TRY_DEPOSIT_OR_REFUND_IDENT, AccountTryDepositOrRefundManifestInput { - authorized_depositor_badge: Some(ResourceOrNonFungible::Resource(ACCOUNT_OWNER_BADGE)), + authorized_depositor_badge: Some(ResourceOrNonFungible::Resource(ACCOUNT_OWNER_BADGE).into()), bucket } ) diff --git a/radix-transaction-scenarios/src/scenarios/account_locker.rs b/radix-transaction-scenarios/src/scenarios/account_locker.rs index 5abd6ec756f..d757c97e286 100644 --- a/radix-transaction-scenarios/src/scenarios/account_locker.rs +++ b/radix-transaction-scenarios/src/scenarios/account_locker.rs @@ -207,7 +207,7 @@ impl ScenarioCreator for AccountLockerScenarioCreator { state.account_rejecting_fungible_resource.unwrap(), ACCOUNT_SET_RESOURCE_PREFERENCE_IDENT, AccountSetResourcePreferenceInput { - resource_address: state.fungible_resource.unwrap(), + resource_address: state.fungible_resource.unwrap().into(), resource_preference: ResourcePreference::Disallowed, }, ) @@ -215,7 +215,7 @@ impl ScenarioCreator for AccountLockerScenarioCreator { state.account_rejecting_non_fungible_resource.unwrap(), ACCOUNT_SET_RESOURCE_PREFERENCE_IDENT, AccountSetResourcePreferenceInput { - resource_address: state.non_fungible_resource.unwrap(), + resource_address: state.non_fungible_resource.unwrap().into(), resource_preference: ResourcePreference::Disallowed, }, ) @@ -259,7 +259,10 @@ impl ScenarioCreator for AccountLockerScenarioCreator { ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant: state.account_accepting_all_resources.unwrap(), + claimant: state + .account_accepting_all_resources + .unwrap() + .into(), try_direct_send: true, }, ) @@ -288,7 +291,8 @@ impl ScenarioCreator for AccountLockerScenarioCreator { bucket, claimant: state .account_rejecting_fungible_resource - .unwrap(), + .unwrap() + .into(), try_direct_send: true, }, ) @@ -315,7 +319,10 @@ impl ScenarioCreator for AccountLockerScenarioCreator { ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant: state.account_accepting_all_resources.unwrap(), + claimant: state + .account_accepting_all_resources + .unwrap() + .into(), try_direct_send: false, }, ) @@ -351,7 +358,7 @@ impl ScenarioCreator for AccountLockerScenarioCreator { .into_iter() .map(|account| { ( - account.unwrap(), + account.unwrap().into(), ResourceSpecifier::Fungible(dec!(100)), ) }) @@ -390,7 +397,7 @@ impl ScenarioCreator for AccountLockerScenarioCreator { .into_iter() .map(|account| { ( - account.unwrap(), + account.unwrap().into(), ResourceSpecifier::Fungible(dec!(100)), ) }) @@ -423,7 +430,10 @@ impl ScenarioCreator for AccountLockerScenarioCreator { ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant: state.account_accepting_all_resources.unwrap(), + claimant: state + .account_accepting_all_resources + .unwrap() + .into(), try_direct_send: true, }, ) @@ -455,7 +465,8 @@ impl ScenarioCreator for AccountLockerScenarioCreator { bucket, claimant: state .account_rejecting_fungible_resource - .unwrap(), + .unwrap() + .into(), try_direct_send: true, }, ) @@ -485,7 +496,10 @@ impl ScenarioCreator for AccountLockerScenarioCreator { ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant: state.account_accepting_all_resources.unwrap(), + claimant: state + .account_accepting_all_resources + .unwrap() + .into(), try_direct_send: false, }, ) @@ -527,7 +541,10 @@ impl ScenarioCreator for AccountLockerScenarioCreator { ] .into_iter() .map(|account| { - (account.unwrap(), ResourceSpecifier::Fungible(dec!(1))) + ( + account.unwrap().into(), + ResourceSpecifier::Fungible(dec!(1)), + ) }) .collect(), }, @@ -570,7 +587,10 @@ impl ScenarioCreator for AccountLockerScenarioCreator { ] .into_iter() .map(|account| { - (account.unwrap(), ResourceSpecifier::Fungible(dec!(1))) + ( + account.unwrap().into(), + ResourceSpecifier::Fungible(dec!(1)), + ) }) .collect(), }, @@ -614,7 +634,7 @@ impl ScenarioCreator for AccountLockerScenarioCreator { .into_iter() .map(|(account, id)| { ( - account.unwrap(), + account.unwrap().into(), ResourceSpecifier::NonFungible(indexset![ NonFungibleLocalId::integer(id) ]), @@ -662,7 +682,7 @@ impl ScenarioCreator for AccountLockerScenarioCreator { .into_iter() .map(|(account, id)| { ( - account.unwrap(), + account.unwrap().into(), ResourceSpecifier::NonFungible(indexset![ NonFungibleLocalId::integer(id) ]), @@ -695,7 +715,10 @@ impl ScenarioCreator for AccountLockerScenarioCreator { ACCOUNT_LOCKER_STORE_IDENT, AccountLockerStoreManifestInput { bucket, - claimant: state.account_rejecting_all_deposits.unwrap(), + claimant: state + .account_rejecting_all_deposits + .unwrap() + .into(), try_direct_send: true, }, ) @@ -739,9 +762,12 @@ impl ScenarioCreator for AccountLockerScenarioCreator { state.account_locker.unwrap(), ACCOUNT_LOCKER_CLAIM_IDENT, AccountLockerClaimManifestInput { - claimant: state.account_rejecting_fungible_resource.unwrap(), + claimant: state + .account_rejecting_fungible_resource + .unwrap() + .into(), amount: dec!(1), - resource_address: state.fungible_resource.unwrap(), + resource_address: state.fungible_resource.unwrap().into(), }, ) .deposit_entire_worktop( @@ -760,9 +786,12 @@ impl ScenarioCreator for AccountLockerScenarioCreator { state.account_locker.unwrap(), ACCOUNT_LOCKER_CLAIM_IDENT, AccountLockerClaimManifestInput { - claimant: state.account_rejecting_fungible_resource.unwrap(), + claimant: state + .account_rejecting_fungible_resource + .unwrap() + .into(), amount: dec!(1), - resource_address: state.non_fungible_resource.unwrap(), + resource_address: state.non_fungible_resource.unwrap().into(), }, ) .deposit_entire_worktop( @@ -781,8 +810,8 @@ impl ScenarioCreator for AccountLockerScenarioCreator { state.account_locker.unwrap(), ACCOUNT_LOCKER_CLAIM_NON_FUNGIBLES_IDENT, AccountLockerClaimNonFungiblesManifestInput { - claimant: state.account_accepting_all_resources.unwrap(), - resource_address: state.non_fungible_resource.unwrap(), + claimant: state.account_accepting_all_resources.unwrap().into(), + resource_address: state.non_fungible_resource.unwrap().into(), ids: indexset![NonFungibleLocalId::integer(3)], }, ) @@ -805,9 +834,12 @@ impl ScenarioCreator for AccountLockerScenarioCreator { state.account_locker.unwrap(), ACCOUNT_LOCKER_RECOVER_IDENT, AccountLockerRecoverManifestInput { - claimant: state.account_rejecting_fungible_resource.unwrap(), + claimant: state + .account_rejecting_fungible_resource + .unwrap() + .into(), amount: dec!(1), - resource_address: state.fungible_resource.unwrap(), + resource_address: state.fungible_resource.unwrap().into(), }, ) .deposit_entire_worktop( @@ -834,9 +866,12 @@ impl ScenarioCreator for AccountLockerScenarioCreator { state.account_locker.unwrap(), ACCOUNT_LOCKER_RECOVER_IDENT, AccountLockerRecoverManifestInput { - claimant: state.account_rejecting_fungible_resource.unwrap(), + claimant: state + .account_rejecting_fungible_resource + .unwrap() + .into(), amount: dec!(1), - resource_address: state.non_fungible_resource.unwrap(), + resource_address: state.non_fungible_resource.unwrap().into(), }, ) .deposit_entire_worktop( @@ -865,8 +900,9 @@ impl ScenarioCreator for AccountLockerScenarioCreator { AccountLockerRecoverNonFungiblesManifestInput { claimant: state .account_rejecting_non_fungible_resource - .unwrap(), - resource_address: state.non_fungible_resource.unwrap(), + .unwrap() + .into(), + resource_address: state.non_fungible_resource.unwrap().into(), ids: indexset![NonFungibleLocalId::integer(15)], }, ) diff --git a/radix-transaction-scenarios/src/scenarios/basic_subintents.rs b/radix-transaction-scenarios/src/scenarios/basic_subintents.rs index 7e11e684da7..d445252afa2 100644 --- a/radix-transaction-scenarios/src/scenarios/basic_subintents.rs +++ b/radix-transaction-scenarios/src/scenarios/basic_subintents.rs @@ -94,7 +94,10 @@ impl ScenarioCreator for BasicSubintentsScenarioCreator { ) .get_free_xrd_from_faucet() .take_all_from_worktop(XRD, "free_xrd") - .deposit("parent_account", "free_xrd") + .then(|builder| { + let parent_account = builder.named_address("parent_account"); + builder.deposit(parent_account, "free_xrd") + }) .create_fungible_resource( OwnerRole::Fixed(rule!(require( config.child_account_key.public_key().signature_proof() @@ -121,7 +124,10 @@ impl ScenarioCreator for BasicSubintentsScenarioCreator { config.child_account_key.public_key().signature_proof() ))), ) - .try_deposit_entire_worktop_or_abort("child_account", None) + .then(|builder| { + let child_account = builder.named_address("child_account"); + builder.try_deposit_entire_worktop_or_abort(child_account, None) + }) }) .sign(&config.parent_account_key) .complete(core) diff --git a/radix-transactions/src/builder/manifest_builder.rs b/radix-transactions/src/builder/manifest_builder.rs index e9a909b4baf..1fbb66fb5a0 100644 --- a/radix-transactions/src/builder/manifest_builder.rs +++ b/radix-transactions/src/builder/manifest_builder.rs @@ -2156,7 +2156,7 @@ where ACCOUNT_TRY_DEPOSIT_BATCH_OR_ABORT_IDENT, AccountTryDepositBatchOrAbortManifestInput { buckets, - authorized_depositor_badge, + authorized_depositor_badge: authorized_depositor_badge.map(Into::into), }, ) } @@ -2208,7 +2208,7 @@ where ACCOUNT_TRY_DEPOSIT_BATCH_OR_REFUND_IDENT, AccountTryDepositBatchOrAbortManifestInput { buckets, - authorized_depositor_badge, + authorized_depositor_badge: authorized_depositor_badge.map(Into::into), }, ) } diff --git a/radix-transactions/src/builder/manifest_namer.rs b/radix-transactions/src/builder/manifest_namer.rs index 5d265e929f3..4be6e391c89 100644 --- a/radix-transactions/src/builder/manifest_namer.rs +++ b/radix-transactions/src/builder/manifest_namer.rs @@ -978,25 +978,11 @@ pub trait ResolvableComponentAddress { fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicComponentAddress; } -impl<'a> ResolvableComponentAddress for &'a str { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicComponentAddress { - registrar.name_lookup().named_address_id(self).into() - } -} - -impl<'a> ResolvableComponentAddress for &'a String { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicComponentAddress { - registrar.name_lookup().named_address_id(self).into() - } -} - -impl<'a> ResolvableComponentAddress for String { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicComponentAddress { - registrar.name_lookup().named_address_id(self).into() - } -} - -impl, E: Debug> ResolvableComponentAddress for A { +impl ResolvableComponentAddress for A +where + A: TryInto, + E: Debug, +{ fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicComponentAddress { let address = self .try_into() @@ -1031,24 +1017,6 @@ impl, E: Debug> ResolvableResource } } -impl<'a> ResolvableResourceAddress for &'a str { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicResourceAddress { - registrar.name_lookup().named_address_id(self).into() - } -} - -impl<'a> ResolvableResourceAddress for &'a String { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicResourceAddress { - registrar.name_lookup().named_address_id(self).into() - } -} - -impl<'a> ResolvableResourceAddress for String { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicResourceAddress { - registrar.name_lookup().named_address_id(self).into() - } -} - pub trait ResolvablePackageAddress: Sized { fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicPackageAddress; @@ -1074,29 +1042,15 @@ impl, E: Debug> ResolvablePackageAd } } -impl<'a> ResolvablePackageAddress for &'a str { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicPackageAddress { - registrar.name_lookup().named_address_id(self).into() - } -} - -impl<'a> ResolvablePackageAddress for &'a String { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicPackageAddress { - registrar.name_lookup().named_address_id(self).into() - } -} - -impl<'a> ResolvablePackageAddress for String { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicPackageAddress { - registrar.name_lookup().named_address_id(self).into() - } -} - pub trait ResolvableGlobalAddress { fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicGlobalAddress; } -impl, E: Debug> ResolvableGlobalAddress for A { +impl ResolvableGlobalAddress for A +where + A: TryInto, + E: Debug, +{ fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicGlobalAddress { let address = self .try_into() @@ -1106,24 +1060,6 @@ impl, E: Debug> ResolvableGlobalAddr } } -impl<'a> ResolvableGlobalAddress for &'a str { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicGlobalAddress { - registrar.name_lookup().named_address_id(self).into() - } -} - -impl<'a> ResolvableGlobalAddress for &'a String { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicGlobalAddress { - registrar.name_lookup().named_address_id(self).into() - } -} - -impl<'a> ResolvableGlobalAddress for String { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicGlobalAddress { - registrar.name_lookup().named_address_id(self).into() - } -} - //===================== // DECIMAL //===================== diff --git a/radix-transactions/src/manifest/static_resource_movements/effect.rs b/radix-transactions/src/manifest/static_resource_movements/effect.rs index 015ecf06706..740278683a7 100644 --- a/radix-transactions/src/manifest/static_resource_movements/effect.rs +++ b/radix-transactions/src/manifest/static_resource_movements/effect.rs @@ -356,8 +356,15 @@ impl StaticInvocationResourcesOutput for AccountWithdrawManifestInput { &self, details: InvocationDetails, ) -> Result { + let DynamicResourceAddress::Static(resource_address) = self.resource_address else { + return Ok( + TrackedResources::new_with_possible_balance_of_unspecified_resources([ + details.source + ]), + ); + }; TrackedResources::new_empty().add_resource( - self.resource_address, + resource_address, TrackedResource::exact_amount(self.amount, [details.source])?, ) } @@ -368,8 +375,15 @@ impl StaticInvocationResourcesOutput for AccountWithdrawNonFungiblesManifestInpu &self, details: InvocationDetails, ) -> Result { + let DynamicResourceAddress::Static(resource_address) = self.resource_address else { + return Ok( + TrackedResources::new_with_possible_balance_of_unspecified_resources([ + details.source + ]), + ); + }; TrackedResources::new_empty().add_resource( - self.resource_address, + resource_address, TrackedResource::exact_non_fungibles(self.ids.clone(), [details.source]), ) } @@ -380,8 +394,15 @@ impl StaticInvocationResourcesOutput for AccountLockFeeAndWithdrawManifestInput &self, details: InvocationDetails, ) -> Result { + let DynamicResourceAddress::Static(resource_address) = self.resource_address else { + return Ok( + TrackedResources::new_with_possible_balance_of_unspecified_resources([ + details.source + ]), + ); + }; TrackedResources::new_empty().add_resource( - self.resource_address, + resource_address, TrackedResource::exact_amount(self.amount, [details.source])?, ) } @@ -392,8 +413,15 @@ impl StaticInvocationResourcesOutput for AccountLockFeeAndWithdrawNonFungiblesMa &self, details: InvocationDetails, ) -> Result { + let DynamicResourceAddress::Static(resource_address) = self.resource_address else { + return Ok( + TrackedResources::new_with_possible_balance_of_unspecified_resources([ + details.source + ]), + ); + }; TrackedResources::new_empty().add_resource( - self.resource_address, + resource_address, TrackedResource::exact_non_fungibles(self.ids.clone(), [details.source]), ) } @@ -540,8 +568,15 @@ impl StaticInvocationResourcesOutput for AccountLockerRecoverManifestInput { &self, details: InvocationDetails, ) -> Result { + let DynamicResourceAddress::Static(resource_address) = self.resource_address else { + return Ok( + TrackedResources::new_with_possible_balance_of_unspecified_resources([ + details.source + ]), + ); + }; TrackedResources::new_empty().add_resource( - self.resource_address, + resource_address, TrackedResource::exact_amount(self.amount, [details.source])?, ) } @@ -552,8 +587,15 @@ impl StaticInvocationResourcesOutput for AccountLockerRecoverNonFungiblesManifes &self, details: InvocationDetails, ) -> Result { + let DynamicResourceAddress::Static(resource_address) = self.resource_address else { + return Ok( + TrackedResources::new_with_possible_balance_of_unspecified_resources([ + details.source + ]), + ); + }; TrackedResources::new_empty().add_resource( - self.resource_address, + resource_address, TrackedResource::exact_non_fungibles(self.ids.clone(), [details.source]), ) } @@ -564,8 +606,15 @@ impl StaticInvocationResourcesOutput for AccountLockerClaimManifestInput { &self, details: InvocationDetails, ) -> Result { + let DynamicResourceAddress::Static(resource_address) = self.resource_address else { + return Ok( + TrackedResources::new_with_possible_balance_of_unspecified_resources([ + details.source + ]), + ); + }; TrackedResources::new_empty().add_resource( - self.resource_address, + resource_address, TrackedResource::exact_amount(self.amount, [details.source])?, ) } @@ -576,8 +625,15 @@ impl StaticInvocationResourcesOutput for AccountLockerClaimNonFungiblesManifestI &self, details: InvocationDetails, ) -> Result { + let DynamicResourceAddress::Static(resource_address) = self.resource_address else { + return Ok( + TrackedResources::new_with_possible_balance_of_unspecified_resources([ + details.source + ]), + ); + }; TrackedResources::new_empty().add_resource( - self.resource_address, + resource_address, TrackedResource::exact_non_fungibles(self.ids.clone(), [details.source]), ) } @@ -614,8 +670,15 @@ impl StaticInvocationResourcesOutput for TwoResourcePoolProtectedWithdrawManifes &self, details: InvocationDetails, ) -> Result { + let DynamicResourceAddress::Static(resource_address) = self.resource_address else { + return Ok( + TrackedResources::new_with_possible_balance_of_unspecified_resources([ + details.source + ]), + ); + }; TrackedResources::new_empty().add_resource( - self.resource_address, + resource_address, TrackedResource::exact_amount(self.amount, [details.source])?, ) } @@ -628,8 +691,15 @@ impl StaticInvocationResourcesOutput for MultiResourcePoolProtectedWithdrawManif &self, details: InvocationDetails, ) -> Result { + let DynamicResourceAddress::Static(resource_address) = self.resource_address else { + return Ok( + TrackedResources::new_with_possible_balance_of_unspecified_resources([ + details.source + ]), + ); + }; TrackedResources::new_empty().add_resource( - self.resource_address, + resource_address, TrackedResource::exact_amount(self.amount, [details.source])?, ) } diff --git a/radix-transactions/src/model/v1/mod.rs b/radix-transactions/src/model/v1/mod.rs index 47ae33ac25e..18a11d877ce 100644 --- a/radix-transactions/src/model/v1/mod.rs +++ b/radix-transactions/src/model/v1/mod.rs @@ -1,7 +1,6 @@ use super::*; mod blobs; -mod dynamic_addresses; mod flash_transaction; mod header; mod instruction_v1; @@ -20,7 +19,6 @@ mod system_transaction; mod validated_notarized_transaction; pub use blobs::*; -pub use dynamic_addresses::*; pub use flash_transaction::*; pub use header::*; pub use instruction_v1::*; diff --git a/scrypto-test/src/ledger_simulator/ledger_simulator.rs b/scrypto-test/src/ledger_simulator/ledger_simulator.rs index d682fa18567..7a8c4b9bb23 100644 --- a/scrypto-test/src/ledger_simulator/ledger_simulator.rs +++ b/scrypto-test/src/ledger_simulator/ledger_simulator.rs @@ -2041,7 +2041,7 @@ impl LedgerSimulator { ONE_RESOURCE_POOL_BLUEPRINT_IDENT, ONE_RESOURCE_POOL_INSTANTIATE_IDENT, OneResourcePoolInstantiateManifestInput { - resource_address, + resource_address: resource_address.into(), pool_manager_rule, owner_role: OwnerRole::None, address_reservation: None, From 1494b759ddaad32b95863de240c3dbe1223a5460 Mon Sep 17 00:00:00 2001 From: David Edey Date: Thu, 31 Oct 2024 16:36:54 +0000 Subject: [PATCH 2/6] tweak: Make the genesis assets non-buildable --- .../tests/dec_macros/Cargo.lock | 819 ------------------ radix-engine/assets/README.MD | 58 ++ radix-engine/assets/blueprints/Cargo.lock | 804 ----------------- radix-engine/assets/blueprints/Cargo.toml | 14 - .../assets/blueprints/faucet/Cargo.toml | 10 - .../blueprints/genesis_helper/Cargo.toml | 10 - 6 files changed, 58 insertions(+), 1657 deletions(-) delete mode 100644 radix-engine-tests/tests/dec_macros/Cargo.lock create mode 100644 radix-engine/assets/README.MD delete mode 100644 radix-engine/assets/blueprints/Cargo.lock delete mode 100644 radix-engine/assets/blueprints/Cargo.toml delete mode 100644 radix-engine/assets/blueprints/faucet/Cargo.toml delete mode 100644 radix-engine/assets/blueprints/genesis_helper/Cargo.toml diff --git a/radix-engine-tests/tests/dec_macros/Cargo.lock b/radix-engine-tests/tests/dec_macros/Cargo.lock deleted file mode 100644 index 400774eac9a..00000000000 --- a/radix-engine-tests/tests/dec_macros/Cargo.lock +++ /dev/null @@ -1,819 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "autocfg" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" - -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - -[[package]] -name = "bech32" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "blst" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4378725facc195f1a538864863f6de233b500a8862747e7f165078a419d5e874" -dependencies = [ - "cc", - "glob", - "threadpool", - "zeroize", -] - -[[package]] -name = "bnum" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e31ea183f6ee62ac8b8a8cf7feddd766317adfb13ff469de57ce033efd6a790" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "cc" -version = "1.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" -dependencies = [ - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - -[[package]] -name = "const-sha1" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8a42181e0652c2997ae4d217f25b63c5337a52fd2279736e97b832fa0a3cff" - -[[package]] -name = "cpufeatures" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" -dependencies = [ - "libc", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "curve25519-dalek" -version = "4.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" -dependencies = [ - "cfg-if", - "cpufeatures", - "curve25519-dalek-derive", - "digest", - "fiat-crypto", - "rustc_version", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.85", -] - -[[package]] -name = "dec_macros" -version = "1.0.0-rc1" -dependencies = [ - "radix-common", - "radix-engine-interface", -] - -[[package]] -name = "der" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" -dependencies = [ - "const-oid", - "zeroize", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", - "subtle", -] - -[[package]] -name = "ed25519" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" -dependencies = [ - "pkcs8", - "signature", -] - -[[package]] -name = "ed25519-dalek" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" -dependencies = [ - "curve25519-dalek", - "ed25519", - "serde", - "sha2", - "subtle", - "zeroize", -] - -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "fiat-crypto" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash", -] - -[[package]] -name = "hashbrown" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "indexmap" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" -dependencies = [ - "equivalent", - "hashbrown 0.15.0", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "keccak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -dependencies = [ - "spin", -] - -[[package]] -name = "libc" -version = "0.2.161" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "once_cell" -version = "1.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - -[[package]] -name = "proc-macro2" -version = "1.0.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radix-blueprint-schema-init" -version = "1.3.0-dev" -dependencies = [ - "bitflags", - "radix-common", - "sbor", - "serde", -] - -[[package]] -name = "radix-common" -version = "1.3.0-dev" -dependencies = [ - "bech32", - "blake2", - "blst", - "bnum", - "ed25519-dalek", - "hex", - "lazy_static", - "num-bigint", - "num-integer", - "num-traits", - "paste", - "radix-rust", - "radix-sbor-derive", - "sbor", - "secp256k1", - "sha3", - "strum", - "zeroize", -] - -[[package]] -name = "radix-common-derive" -version = "1.3.0-dev" -dependencies = [ - "paste", - "proc-macro2", - "quote", - "radix-common", - "syn 1.0.109", -] - -[[package]] -name = "radix-engine-interface" -version = "1.3.0-dev" -dependencies = [ - "bitflags", - "const-sha1", - "hex", - "lazy_static", - "paste", - "radix-blueprint-schema-init", - "radix-common", - "radix-common-derive", - "radix-rust", - "regex", - "sbor", - "serde", - "serde_json", - "strum", -] - -[[package]] -name = "radix-rust" -version = "1.3.0-dev" -dependencies = [ - "hashbrown 0.13.2", - "indexmap", -] - -[[package]] -name = "radix-sbor-derive" -version = "1.3.0-dev" -dependencies = [ - "proc-macro2", - "quote", - "sbor-derive-common", - "syn 1.0.109", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "regex" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" -dependencies = [ - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" -dependencies = [ - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" - -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - -[[package]] -name = "rustversion" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "sbor" -version = "1.3.0-dev" -dependencies = [ - "const-sha1", - "hex", - "lazy_static", - "paste", - "radix-rust", - "sbor-derive", - "serde", -] - -[[package]] -name = "sbor-derive" -version = "1.3.0-dev" -dependencies = [ - "proc-macro2", - "sbor-derive-common", - "syn 1.0.109", -] - -[[package]] -name = "sbor-derive-common" -version = "1.3.0-dev" -dependencies = [ - "const-sha1", - "indexmap", - "itertools", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "secp256k1" -version = "0.28.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" -dependencies = [ - "secp256k1-sys", -] - -[[package]] -name = "secp256k1-sys" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" -dependencies = [ - "cc", -] - -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" - -[[package]] -name = "serde" -version = "1.0.214" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.214" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.85", -] - -[[package]] -name = "serde_json" -version = "1.0.132" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest", - "keccak", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signature" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" -dependencies = [ - "rand_core", -] - -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - -[[package]] -name = "spki" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "strum" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn 1.0.109", -] - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.85" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "unicode-ident" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.85", -] - -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.85", -] diff --git a/radix-engine/assets/README.MD b/radix-engine/assets/README.MD new file mode 100644 index 00000000000..967cdf48a26 --- /dev/null +++ b/radix-engine/assets/README.MD @@ -0,0 +1,58 @@ +## Radix Engine - Scrypto Assets + +## Genesis assets + +The Genesis Helper and Faucet were compiled with the v1 deterministic scrypto builder, and deployed +as part of genesis to the ledger. + +The exact assets can can rebuilt with the following script, checked out against the babylon +version of the ledger: https://github.com/radixdlt/radixdlt-scrypto/tree/release/babylon + +For now, to avoid confusing automated tooling, we have deleted the `Cargo.toml` files and the +`Cargo.lock` file for these genesis assets, and just kept the `lib.rs` source files around for +reference. + +```bash +#!/bin/bash +set -e + +cd "$(dirname "$0")" + +# The genesis blueprints were compiled with Scrypto v1.0.0. To reproduce the same +# wasm files, the Scrypto source code must be placed at `/src` and the blueprints workspace +# source code must be placed at `/src/assets/blueprints`. +SCRYTPO_SOURCE_DIR="/tmp/radixdlt-scrypto-v1.0.0" +if [ ! -d $SCRYTPO_SOURCE_DIR ]; then + git clone https://github.com/radixdlt/radixdlt-scrypto $SCRYTPO_SOURCE_DIR + (cd $SCRYTPO_SOURCE_DIR; git checkout v1.0.0) +fi + +IMAGE_NAME="radixdlt/scrypto-builder" +IMAGE_TAG="v1.0.0" +WORKSPACE_DIR="blueprints" +DESTINATION_DIR="." +for PACKAGE_NAME in "faucet" "genesis_helper" +do + # Run scrypto build + docker run \ + --platform=linux/amd64 \ + --entrypoint=scrypto \ + -v $(realpath $SCRYTPO_SOURCE_DIR):/src \ + -v $(realpath $WORKSPACE_DIR):/src/assets/blueprints \ + $IMAGE_NAME:$IMAGE_TAG \ + build --path /src/assets/blueprints/$PACKAGE_NAME + + # Copy artifacts + cp \ + $WORKSPACE_DIR/target/wasm32-unknown-unknown/release/$PACKAGE_NAME.{wasm,rpd} \ + $DESTINATION_DIR/ +done + +sha256sum *.{wasm,rpd} + +# SHA256 from v1.0.0 +# d35039222f6f6ea015d9fd8df6734937a64089dfcafc291071e6756b474e8775 faucet.wasm +# 87c5bef35a6e702827ef454695dbd59281b0ad76730d6aae310359b8af02e5da genesis_helper.wasm +# 477bef3ff0d36a722e2de59670e40d85b499d57ef837fce6752523dc34809246 faucet.rpd +# b9090167a62cb8f2e15fa69e515530f050a01ec35ccf2b576e151a5ca4252994 genesis_helper.rpd +``` \ No newline at end of file diff --git a/radix-engine/assets/blueprints/Cargo.lock b/radix-engine/assets/blueprints/Cargo.lock deleted file mode 100644 index 0c99706cd3e..00000000000 --- a/radix-engine/assets/blueprints/Cargo.lock +++ /dev/null @@ -1,804 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - -[[package]] -name = "bech32" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "blst" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c94087b935a822949d3291a9989ad2b2051ea141eda0fd4e478a75f6aa3e604b" -dependencies = [ - "cc", - "glob", - "threadpool", - "zeroize", -] - -[[package]] -name = "bnum" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e31ea183f6ee62ac8b8a8cf7feddd766317adfb13ff469de57ce033efd6a790" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - -[[package]] -name = "const-sha1" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8a42181e0652c2997ae4d217f25b63c5337a52fd2279736e97b832fa0a3cff" - -[[package]] -name = "cpufeatures" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" -dependencies = [ - "libc", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "curve25519-dalek" -version = "4.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" -dependencies = [ - "cfg-if", - "cpufeatures", - "curve25519-dalek-derive", - "digest", - "fiat-crypto", - "rustc_version", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.76", -] - -[[package]] -name = "der" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" -dependencies = [ - "const-oid", - "zeroize", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", - "subtle", -] - -[[package]] -name = "ed25519" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" -dependencies = [ - "pkcs8", - "signature", -] - -[[package]] -name = "ed25519-dalek" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" -dependencies = [ - "curve25519-dalek", - "ed25519", - "serde", - "sha2", - "subtle", - "zeroize", -] - -[[package]] -name = "either" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "faucet" -version = "1.0.0" -dependencies = [ - "scrypto", -] - -[[package]] -name = "fiat-crypto" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "genesis-helper" -version = "1.0.0" -dependencies = [ - "scrypto", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "hashbrown" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -dependencies = [ - "serde", -] - -[[package]] -name = "indexmap" -version = "2.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" -dependencies = [ - "equivalent", - "hashbrown", - "serde", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" - -[[package]] -name = "keccak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.158" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "num-bigint" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "paste" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" - -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radix-blueprint-schema-init" -version = "1.3.0-dev" -dependencies = [ - "bitflags", - "radix-common", - "sbor", - "serde", -] - -[[package]] -name = "radix-common" -version = "1.3.0-dev" -dependencies = [ - "bech32", - "blake2", - "blst", - "bnum", - "ed25519-dalek", - "hex", - "lazy_static", - "num-bigint", - "num-integer", - "num-traits", - "paste", - "radix-rust", - "radix-sbor-derive", - "sbor", - "secp256k1", - "serde", - "sha3", - "strum", - "zeroize", -] - -[[package]] -name = "radix-common-derive" -version = "1.3.0-dev" -dependencies = [ - "paste", - "proc-macro2", - "quote", - "radix-common", - "syn 1.0.109", -] - -[[package]] -name = "radix-engine-interface" -version = "1.3.0-dev" -dependencies = [ - "bitflags", - "const-sha1", - "hex", - "lazy_static", - "paste", - "radix-blueprint-schema-init", - "radix-common", - "radix-common-derive", - "radix-rust", - "regex", - "sbor", - "serde", - "serde_json", - "strum", -] - -[[package]] -name = "radix-rust" -version = "1.3.0-dev" -dependencies = [ - "indexmap", - "serde", -] - -[[package]] -name = "radix-sbor-derive" -version = "1.3.0-dev" -dependencies = [ - "proc-macro2", - "quote", - "sbor-derive-common", - "syn 1.0.109", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "regex" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" -dependencies = [ - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" -dependencies = [ - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" - -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - -[[package]] -name = "rustversion" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" - -[[package]] -name = "ryu" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" - -[[package]] -name = "sbor" -version = "1.3.0-dev" -dependencies = [ - "const-sha1", - "hex", - "lazy_static", - "paste", - "radix-rust", - "sbor-derive", - "serde", -] - -[[package]] -name = "sbor-derive" -version = "1.3.0-dev" -dependencies = [ - "proc-macro2", - "sbor-derive-common", - "syn 1.0.109", -] - -[[package]] -name = "sbor-derive-common" -version = "1.3.0-dev" -dependencies = [ - "const-sha1", - "indexmap", - "itertools", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "scrypto" -version = "1.3.0-dev" -dependencies = [ - "bech32", - "const-sha1", - "hex", - "num-bigint", - "num-traits", - "paste", - "radix-blueprint-schema-init", - "radix-common", - "radix-engine-interface", - "radix-rust", - "sbor", - "scrypto-derive", - "strum", -] - -[[package]] -name = "scrypto-derive" -version = "1.3.0-dev" -dependencies = [ - "proc-macro2", - "quote", - "radix-blueprint-schema-init", - "radix-common", - "regex", - "sbor", - "serde", - "serde_json", - "syn 1.0.109", -] - -[[package]] -name = "secp256k1" -version = "0.28.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" -dependencies = [ - "secp256k1-sys", -] - -[[package]] -name = "secp256k1-sys" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" -dependencies = [ - "cc", -] - -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" - -[[package]] -name = "serde" -version = "1.0.209" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.209" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.76", -] - -[[package]] -name = "serde_json" -version = "1.0.127" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest", - "keccak", -] - -[[package]] -name = "signature" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" -dependencies = [ - "rand_core", -] - -[[package]] -name = "spki" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "strum" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn 1.0.109", -] - -[[package]] -name = "subtle" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.76" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - -[[package]] -name = "typenum" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" - -[[package]] -name = "unicode-ident" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.76", -] diff --git a/radix-engine/assets/blueprints/Cargo.toml b/radix-engine/assets/blueprints/Cargo.toml deleted file mode 100644 index c84909eefeb..00000000000 --- a/radix-engine/assets/blueprints/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[workspace] -members = [ - "faucet", - "genesis_helper" -] -resolver = "2" - -[profile.release] -opt-level = 'z' # Optimize for size. -lto = true # Enable Link Time Optimization. -codegen-units = 1 # Reduce number of codegen units to increase optimizations. -panic = 'abort' # Abort on panic. -strip = true # Strip the symbols. -overflow-checks = true # Panic in the case of an overflow. diff --git a/radix-engine/assets/blueprints/faucet/Cargo.toml b/radix-engine/assets/blueprints/faucet/Cargo.toml deleted file mode 100644 index 1ffb50e4d37..00000000000 --- a/radix-engine/assets/blueprints/faucet/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "faucet" -version = "1.0.0" -edition = "2021" - -[dependencies] -scrypto = { path = "../../../../scrypto" } - -[lib] -crate-type = ["cdylib", "lib"] \ No newline at end of file diff --git a/radix-engine/assets/blueprints/genesis_helper/Cargo.toml b/radix-engine/assets/blueprints/genesis_helper/Cargo.toml deleted file mode 100644 index 9d26c0e8cf6..00000000000 --- a/radix-engine/assets/blueprints/genesis_helper/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "genesis-helper" -version = "1.0.0" -edition = "2021" - -[dependencies] -scrypto = { path = "../../../../scrypto" } - -[lib] -crate-type = ["cdylib", "lib"] From 1aacdf0815387c7f8d42d84b15fc4be064f6abed Mon Sep 17 00:00:00 2001 From: David Edey Date: Thu, 31 Oct 2024 17:11:39 +0000 Subject: [PATCH 3/6] fix: Add back the ability to resolve named addresses from strings --- .../data/manifest/model/manifest_address.rs | 7 + .../model/manifest_dynamic_addresses.rs | 174 ++++++++++++++++++ .../src/scenarios/basic_subintents.rs | 10 +- .../src/builder/manifest_namer.rs | 92 ++------- 4 files changed, 195 insertions(+), 88 deletions(-) diff --git a/radix-common/src/data/manifest/model/manifest_address.rs b/radix-common/src/data/manifest/model/manifest_address.rs index e9707e92a82..a596b6c081a 100644 --- a/radix-common/src/data/manifest/model/manifest_address.rs +++ b/radix-common/src/data/manifest/model/manifest_address.rs @@ -45,6 +45,13 @@ pub struct ManifestNamedAddress(pub u32); pub const MANIFEST_ADDRESS_DISCRIMINATOR_STATIC: u8 = 0u8; pub const MANIFEST_ADDRESS_DISCRIMINATOR_NAMED: u8 = 1u8; +/// This is for use with the `ResolvableXAddress` traits, and is allowed to panic if the +/// parameters aren't valid. +pub trait NamedAddressResolver { + fn assert_named_address_exists(&self, named_address: ManifestNamedAddress); + fn resolve_named_address(&self, address_name: &str) -> ManifestNamedAddress; +} + //======== // binary //======== diff --git a/radix-common/src/data/manifest/model/manifest_dynamic_addresses.rs b/radix-common/src/data/manifest/model/manifest_dynamic_addresses.rs index eb51edf158b..18e0b785861 100644 --- a/radix-common/src/data/manifest/model/manifest_dynamic_addresses.rs +++ b/radix-common/src/data/manifest/model/manifest_dynamic_addresses.rs @@ -214,6 +214,44 @@ impl TryFrom for DynamicGlobalAddress { } } +pub trait ResolvableGlobalAddress: Sized { + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicGlobalAddress; +} + +impl ResolvableGlobalAddress for A +where + A: TryInto, + E: Debug, +{ + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicGlobalAddress { + let address = self + .try_into() + .expect("Address was not a valid DynamicGlobalAddress"); + if let DynamicGlobalAddress::Named(named_address) = address { + resolver.assert_named_address_exists(named_address); + } + address + } +} + +impl<'a> ResolvableGlobalAddress for &'a str { + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicGlobalAddress { + resolver.resolve_named_address(self).into() + } +} + +impl<'a> ResolvableGlobalAddress for &'a String { + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicGlobalAddress { + resolver.resolve_named_address(self.as_str()).into() + } +} + +impl ResolvableGlobalAddress for String { + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicGlobalAddress { + resolver.resolve_named_address(self.as_str()).into() + } +} + #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum DynamicPackageAddress { Static(PackageAddress), @@ -339,6 +377,55 @@ impl TryFrom for DynamicPackageAddress { } } +pub trait ResolvablePackageAddress: Sized { + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicPackageAddress; + + /// Note - this can be removed when all the static package addresses in the + /// manifest instructions are gone + fn resolve_static(self, resolver: &impl NamedAddressResolver) -> PackageAddress { + match self.resolve(resolver) { + DynamicPackageAddress::Static(address) => address, + DynamicPackageAddress::Named(_) => { + panic!("This address needs to be a static/fixed address") + } + } + } +} + +impl ResolvablePackageAddress for A +where + A: TryInto, + E: Debug, +{ + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicPackageAddress { + let address = self + .try_into() + .expect("Address was not a valid DynamicPackageAddress"); + if let DynamicPackageAddress::Named(named_address) = address { + resolver.assert_named_address_exists(named_address); + } + address + } +} + +impl<'a> ResolvablePackageAddress for &'a str { + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicPackageAddress { + resolver.resolve_named_address(self).into() + } +} + +impl<'a> ResolvablePackageAddress for &'a String { + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicPackageAddress { + resolver.resolve_named_address(self.as_str()).into() + } +} + +impl ResolvablePackageAddress for String { + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicPackageAddress { + resolver.resolve_named_address(self.as_str()).into() + } +} + #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum DynamicComponentAddress { Static(ComponentAddress), @@ -441,6 +528,44 @@ impl TryFrom for DynamicComponentAddress { } } +pub trait ResolvableComponentAddress { + fn resolve(self, registrar: &impl NamedAddressResolver) -> DynamicComponentAddress; +} + +impl ResolvableComponentAddress for A +where + A: TryInto, + E: Debug, +{ + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicComponentAddress { + let address = self + .try_into() + .expect("Address was not a valid DynamicComponentAddress"); + if let DynamicComponentAddress::Named(named_address) = address { + resolver.assert_named_address_exists(named_address); + } + address + } +} + +impl<'a> ResolvableComponentAddress for &'a str { + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicComponentAddress { + resolver.resolve_named_address(self).into() + } +} + +impl<'a> ResolvableComponentAddress for &'a String { + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicComponentAddress { + resolver.resolve_named_address(self.as_str()).into() + } +} + +impl ResolvableComponentAddress for String { + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicComponentAddress { + resolver.resolve_named_address(self.as_str()).into() + } +} + #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum DynamicResourceAddress { Static(ResourceAddress), @@ -542,3 +667,52 @@ impl TryFrom for DynamicResourceAddress { }) } } + +pub trait ResolvableResourceAddress: Sized { + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicResourceAddress; + + /// Note - this can be removed when all the static resource addresses in the + /// manifest instructions are gone + fn resolve_static(self, resolver: &impl NamedAddressResolver) -> ResourceAddress { + match self.resolve(resolver) { + DynamicResourceAddress::Static(address) => address, + DynamicResourceAddress::Named(_) => { + panic!("This address needs to be a static/fixed address") + } + } + } +} + +impl ResolvableResourceAddress for A +where + A: TryInto, + E: Debug, +{ + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicResourceAddress { + let address = self + .try_into() + .expect("Address was not a valid DynamicResourceAddress"); + if let DynamicResourceAddress::Named(named_address) = address { + resolver.assert_named_address_exists(named_address); + } + address + } +} + +impl<'a> ResolvableResourceAddress for &'a str { + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicResourceAddress { + resolver.resolve_named_address(self).into() + } +} + +impl<'a> ResolvableResourceAddress for &'a String { + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicResourceAddress { + resolver.resolve_named_address(self.as_str()).into() + } +} + +impl ResolvableResourceAddress for String { + fn resolve(self, resolver: &impl NamedAddressResolver) -> DynamicResourceAddress { + resolver.resolve_named_address(self.as_str()).into() + } +} diff --git a/radix-transaction-scenarios/src/scenarios/basic_subintents.rs b/radix-transaction-scenarios/src/scenarios/basic_subintents.rs index d445252afa2..7e11e684da7 100644 --- a/radix-transaction-scenarios/src/scenarios/basic_subintents.rs +++ b/radix-transaction-scenarios/src/scenarios/basic_subintents.rs @@ -94,10 +94,7 @@ impl ScenarioCreator for BasicSubintentsScenarioCreator { ) .get_free_xrd_from_faucet() .take_all_from_worktop(XRD, "free_xrd") - .then(|builder| { - let parent_account = builder.named_address("parent_account"); - builder.deposit(parent_account, "free_xrd") - }) + .deposit("parent_account", "free_xrd") .create_fungible_resource( OwnerRole::Fixed(rule!(require( config.child_account_key.public_key().signature_proof() @@ -124,10 +121,7 @@ impl ScenarioCreator for BasicSubintentsScenarioCreator { config.child_account_key.public_key().signature_proof() ))), ) - .then(|builder| { - let child_account = builder.named_address("child_account"); - builder.try_deposit_entire_worktop_or_abort(child_account, None) - }) + .try_deposit_entire_worktop_or_abort("child_account", None) }) .sign(&config.parent_account_key) .complete(core) diff --git a/radix-transactions/src/builder/manifest_namer.rs b/radix-transactions/src/builder/manifest_namer.rs index 4be6e391c89..0881ea8a450 100644 --- a/radix-transactions/src/builder/manifest_namer.rs +++ b/radix-transactions/src/builder/manifest_namer.rs @@ -974,91 +974,23 @@ pub struct NamedManifestAddress { name: String, } -pub trait ResolvableComponentAddress { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicComponentAddress; -} - -impl ResolvableComponentAddress for A -where - A: TryInto, - E: Debug, -{ - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicComponentAddress { - let address = self - .try_into() - .expect("Address was not valid ComponentAddress"); - registrar.check_address_exists(address); - address - } -} - -pub trait ResolvableResourceAddress: Sized { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicResourceAddress; - - /// Note - this can be removed when all the static resource addresses in the - /// manifest instructions are gone - fn resolve_static(self, registrar: &ManifestNameRegistrar) -> ResourceAddress { - match self.resolve(registrar) { - DynamicResourceAddress::Static(address) => address, - DynamicResourceAddress::Named(_) => { - panic!("This address needs to be a static/fixed address") - } - } - } -} - -impl, E: Debug> ResolvableResourceAddress for A { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicResourceAddress { - let address = self - .try_into() - .expect("Address was not valid ResourceAddress"); - registrar.check_address_exists(address); - address - } -} - -pub trait ResolvablePackageAddress: Sized { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicPackageAddress; - - /// Note - this can be removed when all the static package addresses in the - /// manifest instructions are gone - fn resolve_static(self, registrar: &ManifestNameRegistrar) -> PackageAddress { - match self.resolve(registrar) { - DynamicPackageAddress::Static(address) => address, - DynamicPackageAddress::Named(_) => { - panic!("This address needs to be a static/fixed address") - } - } +impl NamedAddressResolver for ManifestNameRegistrar { + fn assert_named_address_exists(&self, named_address: ManifestNamedAddress) { + self.check_address_exists(DynamicGlobalAddress::Named(named_address)); } -} -impl, E: Debug> ResolvablePackageAddress for A { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicPackageAddress { - let address = self - .try_into() - .expect("Address was not valid PackageAddress"); - registrar.check_address_exists(address); - address + fn resolve_named_address(&self, address_name: &str) -> ManifestNamedAddress { + self.name_lookup().named_address_id(address_name) } } -pub trait ResolvableGlobalAddress { - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicGlobalAddress; -} - -impl ResolvableGlobalAddress for A -where - A: TryInto, - E: Debug, -{ - fn resolve(self, registrar: &ManifestNameRegistrar) -> DynamicGlobalAddress { - let address = self - .try_into() - .expect("Address was not valid GlobalAddress"); - registrar.check_address_exists(address); - address - } -} +// This has been moved to live alongside the dynamic addresses in radix-common to avoid +// foreign trait impl errors. +// But we still re-export it here to avoid breaking any imports. +pub use radix_common::prelude::{ + ResolvableComponentAddress, ResolvableGlobalAddress, ResolvablePackageAddress, + ResolvableResourceAddress, +}; //===================== // DECIMAL From af29b41b0a0dc556fe4d5518e8ec6c6c6b6eda25 Mon Sep 17 00:00:00 2001 From: David Edey Date: Thu, 31 Oct 2024 17:18:01 +0000 Subject: [PATCH 4/6] tweak: Rename `check.sh` to `format-check.sh` and add `check.sh` to do a compile check. --- .githooks/pre-commit | 2 +- .github/workflows/ci.yml | 2 +- build.sh | 2 +- check.sh | 4 +-- format-check.sh | 43 +++++++++++++++++++++++++++++++++ format.sh | 2 +- test.sh | 2 +- update-cargo-locks-minimally.sh | 2 +- 8 files changed, 51 insertions(+), 8 deletions(-) create mode 100755 format-check.sh diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 70958efb6da..1f6a984eae4 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -9,6 +9,6 @@ cd "$(dirname "$0")" echo "[PRE-COMMIT] Formatting assertion" -../../check.sh --quiet || { echo "[PRE-COMMIT] Formatting check FAIL: Committing aborted"; exit 1; } +../../format-check.sh --quiet || { echo "[PRE-COMMIT] Formatting check FAIL: Committing aborted"; exit 1; } echo "[PRE-COMMIT] Formatting check PASS" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96b604853aa..b7ce9056857 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: - name: Setup environment uses: ./.github/actions/setup-env - name: Check format - run: bash ./check.sh + run: bash ./format-check.sh sbor-unit-tests: name: Run SBOR unit tests diff --git a/build.sh b/build.sh index 3c890c05b43..c747a80334b 100755 --- a/build.sh +++ b/build.sh @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")" -# This should align with format.sh, check.sh, test.sh, clean.sh, update-cargo-locks-minimally.sh +# This should align with format.sh, format-check.sh, check.sh, test.sh, clean.sh, update-cargo-locks-minimally.sh echo "Building the workspace packages and tests (with all extended features)..." (set -x; cargo build; cargo test --no-run; cargo bench --no-run) diff --git a/check.sh b/check.sh index 20dbe232413..da5b44bbb96 100755 --- a/check.sh +++ b/check.sh @@ -36,8 +36,8 @@ packages+="$(find examples -mindepth 2 -maxdepth 2 -type f \( -name Cargo.toml \ for package in $packages; do folder=$(dirname $package) - (cd $folder; cargo fmt --check $quiet_flag) || { echo "$lf>> Code format check FAILED for $package$lf"; failed=1; } + (cd $folder; cargo check $quiet_flag) || { echo "$lf>> Code compile check FAILED for $package$lf"; failed=1; } done -[ $failed -eq 0 ] && echo "Code format check passed!" +[ $failed -eq 0 ] && echo "Code compile check passed!" exit $failed diff --git a/format-check.sh b/format-check.sh new file mode 100755 index 00000000000..20dbe232413 --- /dev/null +++ b/format-check.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set -eE + +err_report() { + echo "Something went wrong on line $1" +} + +quiet_flag="" + +if [ "$1" = "--quiet" ] + then quiet_flag="--quiet" +fi + +trap 'err_report $LINENO' ERR + +failed=0 +lf=$'\n' + +cd "$(dirname "$0")" + +# We use the cd trick to avoid issues like this: https://github.com/rust-lang/rustfmt/issues/4432 + +# This should align with format.sh, build.sh, test.sh, clean.sh, update-cargo-locks-minimally.sh +# ... and at some point, we should replace all these with a shared +# workspace lister function which returns this list stripped of Cargo.tomls +# and can be used by all these scripts to save duplication. +packages="Cargo.toml$lf" +packages+="radix-engine-tests/assets/blueprints/Cargo.toml$lf" +packages+="radix-clis/tests/blueprints/Cargo.toml$lf" +packages+="scrypto-test/tests/blueprints/Cargo.toml$lf" +packages+="scrypto-test/assets/blueprints/Cargo.toml$lf" +packages+="scrypto-compiler/tests/assets/scenario_1/Cargo.toml$lf" +packages+="scrypto-compiler/tests/assets/scenario_2/Cargo.toml$lf" +packages+="$(find examples -mindepth 2 -maxdepth 2 -type f \( -name Cargo.toml \))$lf" + +for package in $packages; do + folder=$(dirname $package) + (cd $folder; cargo fmt --check $quiet_flag) || { echo "$lf>> Code format check FAILED for $package$lf"; failed=1; } +done + +[ $failed -eq 0 ] && echo "Code format check passed!" +exit $failed diff --git a/format.sh b/format.sh index 1261ea07aef..22333793234 100755 --- a/format.sh +++ b/format.sh @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")" -# This should align with check.sh, build.sh, test.sh, clean.sh, update-cargo-locks-minimally.sh +# This should align with format-check.sh, check.sh, build.sh, test.sh, clean.sh, update-cargo-locks-minimally.sh (set -x; cd .; cargo fmt) (set -x; cd radix-engine-tests/assets/blueprints; cargo fmt) diff --git a/test.sh b/test.sh index 77b26cc4555..f02ded073ca 100755 --- a/test.sh +++ b/test.sh @@ -15,7 +15,7 @@ if cargo help nextest 2>/dev/null >&2 ; then doc_test_separately=1 fi -# This should align with check.sh, build.sh, format.sh, clean.sh, update-cargo-locks-minimally.sh +# This should align with format-check.sh, check.sh, build.sh, format.sh, clean.sh, update-cargo-locks-minimally.sh echo "Running tests..." (set -x; cd .; cargo $cargo_test_runner) diff --git a/update-cargo-locks-minimally.sh b/update-cargo-locks-minimally.sh index e633f9f8ff4..9a95cffb264 100755 --- a/update-cargo-locks-minimally.sh +++ b/update-cargo-locks-minimally.sh @@ -8,7 +8,7 @@ set -e # > the lock file [PATH]/Cargo.lock needs to be updated but --locked was passed to prevent this # > If you want to try to generate the lock file without accessing the network, remove the --locked flag and use --offline instead. -# This should align with format.sh, check.sh, build.sh, test.sh +# This should align with format.sh, format-check.sh, check.sh, build.sh, test.sh (set -x; cd .; cargo update --workspace) From e0b21842bd3b332cbcf1e9d4d944d2c46de643e5 Mon Sep 17 00:00:00 2001 From: Omar Date: Thu, 31 Oct 2024 20:26:27 +0300 Subject: [PATCH 5/6] Typed invocation decoding errors are ignored by the resource static analyzer --- .../fungible/fungible_resource_manager.rs | 2 +- .../manifest/static_resource_movements/visitor.rs | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/radix-engine-interface/src/blueprints/resource/fungible/fungible_resource_manager.rs b/radix-engine-interface/src/blueprints/resource/fungible/fungible_resource_manager.rs index 6ce2a7fb9fa..7626bae504f 100644 --- a/radix-engine-interface/src/blueprints/resource/fungible/fungible_resource_manager.rs +++ b/radix-engine-interface/src/blueprints/resource/fungible/fungible_resource_manager.rs @@ -79,7 +79,7 @@ pub struct FungibleResourceManagerCreateInput { } #[cfg_attr(feature = "fuzzing", derive(Arbitrary))] -#[derive(Debug, Clone, Eq, PartialEq, ManifestSbor)] +#[derive(Debug, Clone, Eq, PartialEq, ManifestSbor, ScryptoDescribe)] pub struct FungibleResourceManagerCreateManifestInput { pub owner_role: OwnerRole, pub track_total_supply: bool, diff --git a/radix-transactions/src/manifest/static_resource_movements/visitor.rs b/radix-transactions/src/manifest/static_resource_movements/visitor.rs index 1a30c718ed3..badc1ee6a3d 100644 --- a/radix-transactions/src/manifest/static_resource_movements/visitor.rs +++ b/radix-transactions/src/manifest/static_resource_movements/visitor.rs @@ -87,17 +87,22 @@ impl StaticResourceMovementsVisitor { instruction_index: current_instruction.index, }; - let mut invocation_output = match self.resolve_native_invocation(invocation_kind, args)? { - Some((matched_invocation, receiver)) => { + // TODO: In the future we should propagate errors from the native instruction conversion. + // We do not do it at the moment as we have found issues when decoding valid invocations as + // their manifest SBOR types. + let mut invocation_output = match self.resolve_native_invocation(invocation_kind, args) { + Ok(Some((matched_invocation, receiver))) => { matched_invocation.output(InvocationDetails { receiver, sent_resources: &invocation_input, source: change_source, })? } - None => TrackedResources::new_with_possible_balance_of_unspecified_resources([ - change_source, - ]), + Err(..) | Ok(None) => { + TrackedResources::new_with_possible_balance_of_unspecified_resources([ + change_source, + ]) + } }; if let Some((assertion, change_source)) = self.next_invocation_assertion.take() { From a74e5fec5ee09dbc1abfc0aeb563325d038e8aa8 Mon Sep 17 00:00:00 2001 From: Omar Date: Thu, 31 Oct 2024 23:16:52 +0300 Subject: [PATCH 6/6] Make `AccountLocker::get_amount` manifest input use dyn address --- radix-engine-interface/src/blueprints/locker/invocations.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radix-engine-interface/src/blueprints/locker/invocations.rs b/radix-engine-interface/src/blueprints/locker/invocations.rs index 2011eb23a42..c9a6b08e4f2 100644 --- a/radix-engine-interface/src/blueprints/locker/invocations.rs +++ b/radix-engine-interface/src/blueprints/locker/invocations.rs @@ -168,8 +168,8 @@ define_invocation! { }, output: type Decimal, manifest_input: struct { - claimant: ComponentAddress, - resource_address: ResourceAddress, + claimant: DynamicComponentAddress, + resource_address: DynamicResourceAddress, } }