Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
0xOmarA committed Dec 14, 2024
1 parent 7978a88 commit c4f95e9
Show file tree
Hide file tree
Showing 34 changed files with 1,050 additions and 902 deletions.
11 changes: 7 additions & 4 deletions crates/radix-engine-toolkit-uniffi/src/blueprints/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ impl ToNative for MetadataInit {
None => None,
};

Ok((key, NativeKeyValueStoreInitEntry::<NativeMetadataValue> {
lock: value.lock,
value: metadata,
}))
Ok((
key,
NativeKeyValueStoreInitEntry::<NativeMetadataValue> {
lock: value.lock,
value: metadata,
},
))
})
.collect::<Result<
IndexMap<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#![allow(clippy::too_many_arguments)]

use crate::prelude::*;
use radix_common::prelude::{FromPublicKey, to_manifest_value};
use radix_common::prelude::{to_manifest_value, FromPublicKey};

#[derive(Debug, Clone, Object, Default)]
pub struct ManifestV1Builder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#![allow(clippy::too_many_arguments)]

use crate::prelude::*;
use radix_common::prelude::{FromPublicKey, to_manifest_value};
use radix_common::prelude::{to_manifest_value, FromPublicKey};

#[derive(Debug, Clone, Object)]
pub struct ManifestV2Builder {
Expand Down
4 changes: 3 additions & 1 deletion crates/radix-engine-toolkit-uniffi/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ pub enum RadixEngineToolkitError {
#[error("The static analysis of the manifest failed: {error}")]
StaticAnalysisFailed { error: String },

#[error("Not all of the builder items were specified, progressing failed.")]
#[error(
"Not all of the builder items were specified, progressing failed."
)]
NotAllBuilderItemsWereSpecified,

#[error("Validation of manifest failed: {error}")]
Expand Down
2 changes: 1 addition & 1 deletion crates/radix-engine-toolkit-uniffi/src/manifest/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ impl From<NativeManifestBlobRef> for ManifestBlobRef {

impl From<ManifestBlobRef> for NativeManifestBlobRef {
fn from(value: ManifestBlobRef) -> Self {
Self(value.value.0.0)
Self(value.value.0 .0)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,20 +218,24 @@ impl InstructionV1 {
)),
ids: ids.iter().cloned().map(Into::into).collect(),
},
NativeInstructionV1::PopFromAuthZone(..) => Self::PopFromAuthZone,
NativeInstructionV1::PopFromAuthZone { .. } => {
Self::PopFromAuthZone
}
NativeInstructionV1::PushToAuthZone(NativePushToAuthZone {
proof_id,
}) => Self::PushToAuthZone {
proof_id: (*proof_id).into(),
},
NativeInstructionV1::DropNamedProofs(..) => Self::DropNamedProofs,
NativeInstructionV1::DropAuthZoneProofs(..) => {
NativeInstructionV1::DropNamedProofs { .. } => {
Self::DropNamedProofs
}
NativeInstructionV1::DropAuthZoneProofs { .. } => {
Self::DropAuthZoneProofs
}
NativeInstructionV1::DropAuthZoneRegularProofs(..) => {
NativeInstructionV1::DropAuthZoneRegularProofs { .. } => {
Self::DropAuthZoneRegularProofs
}
NativeInstructionV1::DropAuthZoneSignatureProofs(..) => {
NativeInstructionV1::DropAuthZoneSignatureProofs { .. } => {
Self::DropAuthZoneSignatureProofs
}
NativeInstructionV1::CreateProofFromAuthZoneOfAll(
Expand Down Expand Up @@ -298,7 +302,7 @@ impl InstructionV1 {
proof_id: (*proof_id).into(),
}
}
NativeInstructionV1::DropAllProofs(..) => Self::DropAllProofs,
NativeInstructionV1::DropAllProofs { .. } => Self::DropAllProofs,
NativeInstructionV1::AllocateGlobalAddress(
NativeAllocateGlobalAddress {
package_address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,20 +248,24 @@ impl InstructionV2 {
)),
ids: ids.iter().cloned().map(Into::into).collect(),
},
NativeInstructionV2::PopFromAuthZone(..) => Self::PopFromAuthZone,
NativeInstructionV2::PopFromAuthZone { .. } => {
Self::PopFromAuthZone
}
NativeInstructionV2::PushToAuthZone(NativePushToAuthZone {
proof_id,
}) => Self::PushToAuthZone {
proof_id: (*proof_id).into(),
},
NativeInstructionV2::DropNamedProofs(..) => Self::DropNamedProofs,
NativeInstructionV2::DropAuthZoneProofs(..) => {
NativeInstructionV2::DropNamedProofs { .. } => {
Self::DropNamedProofs
}
NativeInstructionV2::DropAuthZoneProofs { .. } => {
Self::DropAuthZoneProofs
}
NativeInstructionV2::DropAuthZoneRegularProofs(..) => {
NativeInstructionV2::DropAuthZoneRegularProofs { .. } => {
Self::DropAuthZoneRegularProofs
}
NativeInstructionV2::DropAuthZoneSignatureProofs(..) => {
NativeInstructionV2::DropAuthZoneSignatureProofs { .. } => {
Self::DropAuthZoneSignatureProofs
}
NativeInstructionV2::CreateProofFromAuthZoneOfAll(
Expand Down Expand Up @@ -328,7 +332,7 @@ impl InstructionV2 {
proof_id: (*proof_id).into(),
}
}
NativeInstructionV2::DropAllProofs(..) => Self::DropAllProofs,
NativeInstructionV2::DropAllProofs { .. } => Self::DropAllProofs,
NativeInstructionV2::AllocateGlobalAddress(
NativeAllocateGlobalAddress {
package_address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ fn subintent_transaction_hash_is_derived_correctly() -> Result<()> {
}

#[test]
fn partial_transaction_builder_produces_valid_partial_transactions()
-> Result<()> {
fn partial_transaction_builder_produces_valid_partial_transactions(
) -> Result<()> {
// Arrange
let [signer_private_key] = private_keys();

Expand Down Expand Up @@ -105,8 +105,8 @@ fn partial_transaction_builder_produces_valid_partial_transactions()
}

#[test]
fn partial_transaction_builder_produces_valid_partial_transactions_with_child_subintents()
-> Result<()> {
fn partial_transaction_builder_produces_valid_partial_transactions_with_child_subintents(
) -> Result<()> {
// Arrange
let [signer_private_key] = private_keys();
let child_partial_transaction = SignedPartialTransactionV2Builder::new()
Expand Down Expand Up @@ -172,8 +172,8 @@ fn partial_transaction_builder_produces_valid_partial_transactions_with_child_su
}

#[test]
fn partial_transaction_builder_produces_valid_partial_transactions_with_multiple_layers_of_child_subintents()
-> Result<()> {
fn partial_transaction_builder_produces_valid_partial_transactions_with_multiple_layers_of_child_subintents(
) -> Result<()> {
// Arrange
let [signer_private_key] = private_keys();
let child_child_partial_transaction =
Expand Down Expand Up @@ -314,8 +314,8 @@ fn transaction_builder_v2_produces_statically_valid_transactions() -> Result<()>
}

#[test]
fn transaction_builder_v2_produces_statically_valid_transactions_with_multiple_layers_of_child_subintents()
-> Result<()> {
fn transaction_builder_v2_produces_statically_valid_transactions_with_multiple_layers_of_child_subintents(
) -> Result<()> {
// Arrange
let [notary_private_key, signer_private_key] = private_keys();
let child_child_partial_transaction =
Expand Down
2 changes: 1 addition & 1 deletion crates/radix-engine-toolkit/src/functions/manifest_sbor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// under the License.

use radix_transactions::data::{
ManifestDecompilationDisplayContext, format_manifest_value,
format_manifest_value, ManifestDecompilationDisplayContext,
};
use sbor::prelude::ContextualSerialize;
use sbor::representations::{SerializationMode, SerializationParameters};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
use radix_common::prelude::*;
use radix_engine_toolkit_common::receipt::RuntimeToolkitTransactionReceipt;
use radix_transactions::errors::*;
use radix_transactions::manifest::BuildableManifest;
use radix_transactions::manifest::static_resource_movements::StaticResourceMovementsError;
use radix_transactions::manifest::BuildableManifest;
use radix_transactions::prelude::*;
use radix_transactions::validation::*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,10 @@ pub fn as_enclosed(
object_names,
}: &SubintentManifestV2,
) -> Option<TransactionManifestV2> {
let [
assert_worktop_empty_instruction @ InstructionV2::AssertWorktopResourcesOnly(AssertWorktopResourcesOnly {
let [assert_worktop_empty_instruction @ InstructionV2::AssertWorktopResourcesOnly(AssertWorktopResourcesOnly {
constraints,
}),
other_instructions @ ..,
InstructionV2::YieldToParent(..),
] = instructions.as_slice()
}), other_instructions @ .., InstructionV2::YieldToParent { .. }] =
instructions.as_slice()
else {
return None;
};
Expand All @@ -73,7 +70,8 @@ pub fn as_enclosed(
let is_enclosed = !other_instructions.iter().any(|instruction| {
matches!(
instruction,
InstructionV2::YieldToChild(..) | InstructionV2::YieldToParent(..)
InstructionV2::YieldToChild { .. }
| InstructionV2::YieldToParent { .. }
)
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,14 @@ mod tests {
let input = "account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q";

let x = CanonicalAccountAddress::from_str(input).unwrap();
assert_eq!(x.node_id.as_bytes(), [
193, 24, 131, 70, 47, 57, 121, 109, 168, 63, 47, 130, 202, 239,
166, 121, 170, 241, 241, 137, 37, 126, 189, 60, 140, 39, 125, 90,
225, 153
]);
assert_eq!(
x.node_id.as_bytes(),
[
193, 24, 131, 70, 47, 57, 121, 109, 168, 63, 47, 130, 202, 239,
166, 121, 170, 241, 241, 137, 37, 126, 189, 60, 140, 39, 125,
90, 225, 153
]
);
assert_eq!(x.network_id, 0xf2);
assert_eq!(x.to_string(), input);

Expand Down
19 changes: 11 additions & 8 deletions crates/radix-engine-toolkit/src/transaction_types/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,14 +513,17 @@ pub fn dynamically_analyze<M: ReadableManifest>(
k,
v.into_iter()
.map(|(badge, operation)| {
(badge, match operation {
Update::Set(()) => {
Operation::Added
}
Update::Remove => {
Operation::Removed
}
})
(
badge,
match operation {
Update::Set(()) => {
Operation::Added
}
Update::Remove => {
Operation::Removed
}
},
)
})
.collect(),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,34 +311,38 @@ pub mod dynamic_analysis {
}
}
/* Non-sink methods */
InstructionV2::TakeAllFromWorktop(..)
| InstructionV2::TakeFromWorktop(..)
| InstructionV2::TakeNonFungiblesFromWorktop(..)
| InstructionV2::AssertWorktopContainsAny(..)
| InstructionV2::AssertWorktopContains(..)
| InstructionV2::AssertWorktopContainsNonFungibles(..)
| InstructionV2::PopFromAuthZone(..)
| InstructionV2::PushToAuthZone(..)
| InstructionV2::CreateProofFromAuthZoneOfAmount(..)
| InstructionV2::CreateProofFromAuthZoneOfNonFungibles(..)
| InstructionV2::CreateProofFromAuthZoneOfAll(..)
| InstructionV2::DropAuthZoneProofs(..)
| InstructionV2::DropAuthZoneRegularProofs(..)
| InstructionV2::DropAuthZoneSignatureProofs(..)
| InstructionV2::CreateProofFromBucketOfAmount(..)
| InstructionV2::CreateProofFromBucketOfNonFungibles(..)
| InstructionV2::CreateProofFromBucketOfAll(..)
| InstructionV2::CloneProof(..)
| InstructionV2::DropProof(..)
| InstructionV2::DropNamedProofs(..)
| InstructionV2::DropAllProofs(..)
| InstructionV2::AllocateGlobalAddress(..)
| InstructionV2::VerifyParent(..)
| InstructionV2::AssertWorktopResourcesOnly(..)
| InstructionV2::AssertWorktopResourcesInclude(..)
| InstructionV2::AssertNextCallReturnsOnly(..)
| InstructionV2::AssertNextCallReturnsInclude(..)
| InstructionV2::AssertBucketContents(..) => { /* No-Op */ }
InstructionV2::TakeAllFromWorktop { .. }
| InstructionV2::TakeFromWorktop { .. }
| InstructionV2::TakeNonFungiblesFromWorktop { .. }
| InstructionV2::AssertWorktopContainsAny { .. }
| InstructionV2::AssertWorktopContains { .. }
| InstructionV2::AssertWorktopContainsNonFungibles { .. }
| InstructionV2::PopFromAuthZone { .. }
| InstructionV2::PushToAuthZone { .. }
| InstructionV2::CreateProofFromAuthZoneOfAmount { .. }
| InstructionV2::CreateProofFromAuthZoneOfNonFungibles {
..
}
| InstructionV2::CreateProofFromAuthZoneOfAll { .. }
| InstructionV2::DropAuthZoneProofs { .. }
| InstructionV2::DropAuthZoneRegularProofs { .. }
| InstructionV2::DropAuthZoneSignatureProofs { .. }
| InstructionV2::CreateProofFromBucketOfAmount { .. }
| InstructionV2::CreateProofFromBucketOfNonFungibles {
..
}
| InstructionV2::CreateProofFromBucketOfAll { .. }
| InstructionV2::CloneProof { .. }
| InstructionV2::DropProof { .. }
| InstructionV2::DropNamedProofs { .. }
| InstructionV2::DropAllProofs { .. }
| InstructionV2::AllocateGlobalAddress { .. }
| InstructionV2::VerifyParent { .. }
| InstructionV2::AssertWorktopResourcesOnly { .. }
| InstructionV2::AssertWorktopResourcesInclude { .. }
| InstructionV2::AssertNextCallReturnsOnly { .. }
| InstructionV2::AssertNextCallReturnsInclude { .. }
| InstructionV2::AssertBucketContents { .. } => { /* No-Op */ }
};

inputs
Expand Down Expand Up @@ -741,31 +745,31 @@ pub mod dynamic_analysis {
}
}
/* Neither */
InstructionV2::AssertWorktopContainsAny(..)
| InstructionV2::AssertWorktopContains(..)
| InstructionV2::AssertWorktopContainsNonFungibles(..)
| InstructionV2::PopFromAuthZone(..)
| InstructionV2::PushToAuthZone(..)
| InstructionV2::CreateProofFromAuthZoneOfAmount(..)
| InstructionV2::CreateProofFromAuthZoneOfNonFungibles(..)
| InstructionV2::CreateProofFromAuthZoneOfAll(..)
| InstructionV2::DropAuthZoneProofs(..)
| InstructionV2::DropAuthZoneRegularProofs(..)
| InstructionV2::DropAuthZoneSignatureProofs(..)
| InstructionV2::CreateProofFromBucketOfAmount(..)
| InstructionV2::CreateProofFromBucketOfNonFungibles(..)
| InstructionV2::CreateProofFromBucketOfAll(..)
| InstructionV2::CloneProof(..)
| InstructionV2::DropProof(..)
| InstructionV2::DropNamedProofs(..)
| InstructionV2::DropAllProofs(..)
| InstructionV2::AllocateGlobalAddress(..)
| InstructionV2::VerifyParent(..)
| InstructionV2::AssertWorktopResourcesOnly(..)
| InstructionV2::AssertWorktopResourcesInclude(..)
| InstructionV2::AssertNextCallReturnsOnly(..)
| InstructionV2::AssertNextCallReturnsInclude(..)
| InstructionV2::AssertBucketContents(..) => { /* No-op */ }
InstructionV2::AssertWorktopContainsAny { .. }
| InstructionV2::AssertWorktopContains { .. }
| InstructionV2::AssertWorktopContainsNonFungibles { .. }
| InstructionV2::PopFromAuthZone { .. }
| InstructionV2::PushToAuthZone { .. }
| InstructionV2::CreateProofFromAuthZoneOfAmount { .. }
| InstructionV2::CreateProofFromAuthZoneOfNonFungibles { .. }
| InstructionV2::CreateProofFromAuthZoneOfAll { .. }
| InstructionV2::DropAuthZoneProofs { .. }
| InstructionV2::DropAuthZoneRegularProofs { .. }
| InstructionV2::DropAuthZoneSignatureProofs { .. }
| InstructionV2::CreateProofFromBucketOfAmount { .. }
| InstructionV2::CreateProofFromBucketOfNonFungibles { .. }
| InstructionV2::CreateProofFromBucketOfAll { .. }
| InstructionV2::CloneProof { .. }
| InstructionV2::DropProof { .. }
| InstructionV2::DropNamedProofs { .. }
| InstructionV2::DropAllProofs { .. }
| InstructionV2::AllocateGlobalAddress { .. }
| InstructionV2::VerifyParent { .. }
| InstructionV2::AssertWorktopResourcesOnly { .. }
| InstructionV2::AssertWorktopResourcesInclude { .. }
| InstructionV2::AssertNextCallReturnsOnly { .. }
| InstructionV2::AssertNextCallReturnsInclude { .. }
| InstructionV2::AssertBucketContents { .. } => { /* No-op */ }
}
}

Expand Down
Loading

0 comments on commit c4f95e9

Please sign in to comment.