Skip to content

Commit

Permalink
Merge pull request #101 from radixdlt/develop
Browse files Browse the repository at this point in the history
Merge develop into main
  • Loading branch information
mstrug-rdx authored Feb 7, 2024
2 parents 4cf0179 + de0bb8f commit 9dc3dee
Show file tree
Hide file tree
Showing 17 changed files with 255 additions and 36 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ jobs:
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "AR=aarch64-linux-gnu-gcc-ar" >> $GITHUB_ENV
echo "HOST_CC=x86_64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Build Dependencies (android)
uses: nttld/setup-ndk@v1
id: setup-ndk
Expand Down Expand Up @@ -154,6 +155,7 @@ jobs:
echo "CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc" >> $GITHUB_ENV
echo "CC=x86_64-w64-mingw32-gcc" >> $GITHUB_ENV
echo "AR=x86_64-w64-mingw32-gcc-ar" >> $GITHUB_ENV
echo "HOST_CC=x86_64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Build
working-directory: crates/${{ matrix.build-target.crate }}
Expand Down
2 changes: 1 addition & 1 deletion crates/generator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "generator"
version = "1.0.9"
version = "1.0.10"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/radix-engine-toolkit-json/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "radix-engine-toolkit-json"
version = "1.0.9"
version = "1.0.10"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/radix-engine-toolkit-uniffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "radix-engine-toolkit-uniffi"
version = "1.0.9"
version = "1.0.10"
edition = "2021"
build = "build.rs"

Expand Down
38 changes: 28 additions & 10 deletions crates/radix-engine-toolkit-uniffi/src/transaction/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ impl DetailedManifestClass {
pub struct ExecutionSummary {
pub account_withdraws: HashMap<String, Vec<ResourceIndicator>>,
pub account_deposits: HashMap<String, Vec<ResourceIndicator>>,
pub presented_proofs: Vec<Arc<Address>>,
pub presented_proofs: HashMap<String, Vec<ResourceSpecifier>>,
pub new_entities: NewEntities,
pub encountered_entities: Vec<Arc<Address>>,
pub accounts_requiring_auth: Vec<Arc<Address>>,
Expand Down Expand Up @@ -753,10 +753,19 @@ impl ExecutionSummary {
.presented_proofs
.into_iter()
.map(|item| {
Arc::new(Address::unsafe_from_raw(
item.into_node_id(),
network_id,
))
(
Address::unsafe_from_raw(
item.0.into_node_id(),
network_id,
)
.address_string(),
item.1
.iter()
.map(|i| {
ResourceSpecifier::from_native(i, network_id)
})
.collect(),
)
})
.collect(),
new_entities: NewEntities::from_native(
Expand Down Expand Up @@ -826,7 +835,7 @@ impl ExecutionSummary {

#[derive(Clone, Debug, Record)]
pub struct ManifestSummary {
pub presented_proofs: Vec<Arc<Address>>,
pub presented_proofs: HashMap<String, Vec<ResourceSpecifier>>,
pub accounts_withdrawn_from: Vec<Arc<Address>>,
pub accounts_deposited_into: Vec<Arc<Address>>,
pub encountered_entities: Vec<Arc<Address>>,
Expand All @@ -843,10 +852,19 @@ impl ManifestSummary {
.presented_proofs
.into_iter()
.map(|item| {
Arc::new(Address::unsafe_from_raw(
item.into_node_id(),
network_id,
))
(
Address::unsafe_from_raw(
item.0.into_node_id(),
network_id,
)
.address_string(),
item.1
.iter()
.map(|i| {
ResourceSpecifier::from_native(i, network_id)
})
.collect(),
)
})
.collect(),
accounts_withdrawn_from: native
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import com.radixdlt.ret.*;
val information = buildInformation();

// Assert
assert(information.version == "1.0.9");
assert(information.version == "1.0.10");
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
build_info = build_information()

# Assert
assert build_info.version == "1.0.9"
assert build_info.version == "1.0.10"
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ do {
let buildInformation = radix_engine_toolkit_uniffi.buildInformation()

// Assert
assert(buildInformation.version == "1.0.9")
assert(buildInformation.version == "1.0.10")
}
2 changes: 1 addition & 1 deletion crates/radix-engine-toolkit/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "radix-engine-toolkit"
version = "1.0.9"
version = "1.0.10"
edition = "2021"
build = "build.rs"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,32 @@
// specific language governing permissions and limitations
// under the License.

use radix_engine::system::system_modules::execution_trace::*;
use scrypto::prelude::*;

use crate::transaction_types::*;

#[derive(Default)]
pub struct PresentedProofsDetector {
presented_proofs: IndexSet<ResourceAddress>,
presented_proofs: IndexMap<ComponentAddress, Vec<ResourceSpecifier>>,
}

impl PresentedProofsDetector {
pub fn output(self) -> IndexSet<ResourceAddress> {
pub fn output(self) -> IndexMap<ComponentAddress, Vec<ResourceSpecifier>> {
self.presented_proofs
}
}

impl ManifestSummaryCallback for PresentedProofsDetector {
fn on_create_proof(&mut self, resource_address: &ResourceAddress) {
self.presented_proofs.insert(*resource_address);
fn on_create_proof(
&mut self,
account: &ComponentAddress,
resource: &ResourceSpecifier,
) {
self.presented_proofs
.entry(*account)
.and_modify(|res_vector| res_vector.push(resource.clone()))
.or_insert(vec![resource.clone()]);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ pub trait ManifestSummaryCallback {

/// Called when a proof is created out of an account.
#[inline]
fn on_create_proof(&mut self, _resource_address: &ResourceAddress) {}
fn on_create_proof(
&mut self,
_account: &ComponentAddress,
_resource: &ResourceSpecifier,
) {
}

/// Called when a global entity is encountered in the manifest
#[inline]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub mod manifest_summary {
use crate::sbor::indexed_manifest_value::*;
use crate::transaction_types::*;
use crate::utils::*;
use radix_engine::system::system_modules::execution_trace::*;
use radix_engine_interface::blueprints::account::*;
use transaction::prelude::*;

Expand Down Expand Up @@ -67,7 +68,7 @@ pub mod manifest_summary {
instruction: &InstructionV1,
) {
if let InstructionV1::CallMethod {
address: dynamic_address @ DynamicGlobalAddress::Static(_address),
address: dynamic_address @ DynamicGlobalAddress::Static(address),
method_name,
args,
} = instruction
Expand All @@ -76,25 +77,40 @@ pub mod manifest_summary {
return;
}

let account =
ComponentAddress::try_from(*address).expect("Must succeed");

if method_name == ACCOUNT_CREATE_PROOF_OF_AMOUNT_IDENT {
if let Some(AccountCreateProofOfAmountInput {
resource_address,
..
amount,
}) = to_manifest_type(args)
{
callbacks.iter_mut().for_each(|callback| {
callback.on_create_proof(&resource_address)
callback.on_create_proof(
&account,
&ResourceSpecifier::Amount(
resource_address,
amount,
),
)
});
}
} else if method_name == ACCOUNT_CREATE_PROOF_OF_NON_FUNGIBLES_IDENT
{
if let Some(AccountCreateProofOfNonFungiblesInput {
resource_address,
..
ids,
}) = to_manifest_type(args)
{
callbacks.iter_mut().for_each(|callback| {
callback.on_create_proof(&resource_address)
callback.on_create_proof(
&account,
&ResourceSpecifier::Ids(
resource_address,
ids.clone(),
),
)
});
}
}
Expand Down
10 changes: 4 additions & 6 deletions crates/radix-engine-toolkit/src/transaction_types/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ use super::*;
/// A summary of the manifest
#[derive(Clone, Debug)]
pub struct ManifestSummary {
/// The set of the resource addresses of proofs that were presented in
/// the manifest.
pub presented_proofs: IndexSet<ResourceAddress>,
/// The list of the resources of proofs that were presented in the manifest.
pub presented_proofs: IndexMap<ComponentAddress, Vec<ResourceSpecifier>>,
/// The set of accounts withdrawn from observed in the manifest.
pub accounts_withdrawn_from: IndexSet<ComponentAddress>,
/// The set of accounts deposited into observed in the manifest.
Expand Down Expand Up @@ -65,9 +64,8 @@ pub struct ExecutionSummary {
pub account_withdraws: IndexMap<ComponentAddress, Vec<ResourceIndicator>>,
/// The deposits done in the manifest.
pub account_deposits: IndexMap<ComponentAddress, Vec<ResourceIndicator>>,
/// The set of the resource addresses of proofs that were presented in
/// the manifest.
pub presented_proofs: IndexSet<ResourceAddress>,
/// The list of the resources of proofs that were presented in the manifest.
pub presented_proofs: IndexMap<ComponentAddress, Vec<ResourceSpecifier>>,
/// Information on the global entities created in the transaction.
pub new_entities: NewEntities,
/// The set of all the global entities encountered in the manifest. This is
Expand Down
Loading

0 comments on commit 9dc3dee

Please sign in to comment.