Skip to content

Commit

Permalink
Merge pull request #1913 from radixdlt/feature/subintent-impl-1
Browse files Browse the repository at this point in the history
Feature: Subintent Execution Implementation Part 1
  • Loading branch information
talekhinezh authored Sep 13, 2024
2 parents 5f2d0bb + 76585e4 commit f2d674b
Show file tree
Hide file tree
Showing 28 changed files with 1,111 additions and 316 deletions.
4 changes: 2 additions & 2 deletions radix-clis/src/resim/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ pub fn handle_manifest<O: std::io::Write>(
.map(|e| NonFungibleGlobalId::from_public_key(&e.public_key()))
.collect::<BTreeSet<NonFungibleGlobalId>>();
let nonce = get_nonce()?;
let transaction = TestTransaction::new_v1_from_nonce(manifest, nonce);
let transaction = TestTransaction::new_v1_from_nonce(manifest, nonce, initial_proofs);

let receipt = execute_and_commit_transaction(
&mut db,
Expand All @@ -231,7 +231,7 @@ pub fn handle_manifest<O: std::io::Write>(
transaction
.prepare()
.map_err(Error::TransactionPrepareError)?
.get_executable(initial_proofs),
.get_executable(),
);

if print_receipt {
Expand Down
36 changes: 24 additions & 12 deletions radix-engine-tests/benches/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ fn bench_transfer(c: &mut Criterion) {
&mut substate_db,
&vm_modules,
&ExecutionConfig::for_notarized_transaction(NetworkDefinition::simulator()),
TestTransaction::new_v1_from_nonce(manifest, 1)
.prepare()
.unwrap()
.get_executable(btreeset![NonFungibleGlobalId::from_public_key(&public_key)]),
TestTransaction::new_v1_from_nonce(
manifest,
1,
btreeset![NonFungibleGlobalId::from_public_key(&public_key)],
)
.prepare()
.unwrap()
.get_executable(),
)
.expect_commit(true)
.new_component_addresses()[0];
Expand All @@ -62,10 +66,14 @@ fn bench_transfer(c: &mut Criterion) {
&mut substate_db,
&vm_modules,
&ExecutionConfig::for_notarized_transaction(NetworkDefinition::simulator()),
TestTransaction::new_v1_from_nonce(manifest.clone(), nonce)
.prepare()
.unwrap()
.get_executable(btreeset![NonFungibleGlobalId::from_public_key(&public_key)]),
TestTransaction::new_v1_from_nonce(
manifest.clone(),
nonce,
btreeset![NonFungibleGlobalId::from_public_key(&public_key)],
)
.prepare()
.unwrap()
.get_executable(),
)
.expect_commit(true);
}
Expand All @@ -85,10 +93,14 @@ fn bench_transfer(c: &mut Criterion) {
&mut substate_db,
&vm_modules,
&ExecutionConfig::for_notarized_transaction(NetworkDefinition::simulator()),
TestTransaction::new_v1_from_nonce(manifest.clone(), nonce)
.prepare()
.unwrap()
.get_executable(btreeset![NonFungibleGlobalId::from_public_key(&public_key)]),
TestTransaction::new_v1_from_nonce(
manifest.clone(),
nonce,
btreeset![NonFungibleGlobalId::from_public_key(&public_key)],
)
.prepare()
.unwrap()
.get_executable(),
);
receipt.expect_commit_success();
nonce += 1;
Expand Down
5 changes: 3 additions & 2 deletions radix-engine-tests/tests/blueprints/account_locker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3059,9 +3059,10 @@ pub impl DefaultLedgerSimulator {
});

let nonce = self.next_transaction_nonce();
let test_transaction = TestTransaction::new_v1_from_nonce(manifest, nonce);
let test_transaction =
TestTransaction::new_v1_from_nonce(manifest, nonce, Default::default());
let prepared_transaction = test_transaction.prepare().unwrap();
let executable = prepared_transaction.get_executable(Default::default());
let executable = prepared_transaction.get_executable();
self.execute_transaction(executable, execution_config)
}
}
Expand Down
1 change: 0 additions & 1 deletion radix-engine-tests/tests/blueprints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ mod reentrancy;
mod resource;
mod static_dependencies;
mod time;
mod transaction_tracker;
mod tx_processor;
mod tx_processor_access;
mod validator;
3 changes: 2 additions & 1 deletion radix-engine-tests/tests/kernel/kernel_open_substate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ pub fn test_open_substate_of_invisible_package_address() {
let transaction = TestTransaction::new_v1_from_nonce(
ManifestBuilder::new().lock_fee_from_faucet().build(),
1,
btreeset![],
)
.prepare()
.unwrap();
let executable = transaction.get_executable(btreeset![]);
let executable = transaction.get_executable();

// Create database and bootstrap
let mut database = InMemorySubstateDatabase::standard();
Expand Down
7 changes: 6 additions & 1 deletion radix-engine-tests/tests/kernel/panics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,13 @@ impl<M: SystemCallbackObject> KernelApi for MockKernel<M> {
type CallbackObject = System<M>;
}

impl<M: SystemCallbackObject> KernelThreadApi for MockKernel<M> {
impl<M: SystemCallbackObject> KernelStackApi for MockKernel<M> {
type CallFrameData = Actor;

fn kernel_switch_stack(&mut self, _id: usize) -> Result<(), RuntimeError> {
panic1!()
}

fn kernel_set_call_frame_data(&mut self, _data: Actor) -> Result<(), RuntimeError> {
panic1!()
}
Expand Down
40 changes: 24 additions & 16 deletions radix-engine-tests/tests/kernel/transaction_multi_threaded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ mod multi_threaded_test {
&mut substate_db,
&vm_modules,
&ExecutionConfig::for_test_transaction(),
TestTransaction::new_v1(manifest, hash(format!("Account creation: {i}")))
.prepare()
.unwrap()
.get_executable(btreeset![NonFungibleGlobalId::from_public_key(
&public_key
)]),
TestTransaction::new_v1(
manifest,
hash(format!("Account creation: {i}")),
btreeset![NonFungibleGlobalId::from_public_key(&public_key)],
)
.prepare()
.unwrap()
.get_executable(),
)
.expect_commit(true)
.new_component_addresses()[0];
Expand All @@ -71,10 +73,14 @@ mod multi_threaded_test {
&mut substate_db,
&vm_modules,
&ExecutionConfig::for_test_transaction(),
TestTransaction::new_v1(manifest.clone(), hash(format!("Fill account: {}", nonce)))
.prepare()
.expect("Expected transaction to be preparable")
.get_executable(btreeset![NonFungibleGlobalId::from_public_key(&public_key)]),
TestTransaction::new_v1(
manifest.clone(),
hash(format!("Fill account: {}", nonce)),
btreeset![NonFungibleGlobalId::from_public_key(&public_key)],
)
.prepare()
.expect("Expected transaction to be preparable")
.get_executable(),
)
.expect_commit(true);
}
Expand All @@ -96,12 +102,14 @@ mod multi_threaded_test {
&substate_db,
&vm_modules,
&ExecutionConfig::for_test_transaction(),
TestTransaction::new_v1(manifest.clone(), hash(format!("Transfer")))
.prepare()
.expect("Expected transaction to be preparable")
.get_executable(btreeset![NonFungibleGlobalId::from_public_key(
&public_key,
)]),
TestTransaction::new_v1(
manifest.clone(),
hash(format!("Transfer")),
btreeset![NonFungibleGlobalId::from_public_key(&public_key,)],
)
.prepare()
.expect("Expected transaction to be preparable")
.get_executable(),
);
receipt.expect_commit_success();
println!("receipt = {:?}", receipt);
Expand Down
9 changes: 7 additions & 2 deletions radix-engine-tests/tests/protocol/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@ fn bottlenose_protocol_should_not_support_v2_transactions() {
let manifest = ManifestBuilder::new_v2()
.lock_standard_test_fee(account)
.build();
(manifest, ledger.next_transaction_nonce())
(
manifest,
ledger.next_transaction_nonce(),
vec![],
btreeset![NonFungibleGlobalId::from_public_key(&public_key)],
)
})
.collect();
let receipt = ledger.execute_transaction(
TestTransaction::new_v2_from_nonce(intents)
.prepare()
.expect("expected transaction to be preparable")
.get_executable(btreeset![NonFungibleGlobalId::from_public_key(&public_key)]),
.get_executable(),
ExecutionConfig::for_test_transaction(),
);

Expand Down
4 changes: 4 additions & 0 deletions radix-engine-tests/tests/system/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ mod royalty;
mod royalty_auth;
mod royalty_edge_cases;
mod schema_sanity_check;
mod subintent_auth;
mod subintent_leaks;
mod subintent_txn_shape;
mod system;
mod system_access_rule;
mod system_actor_collection;
Expand All @@ -68,6 +71,7 @@ mod toolkit_receipt;
mod track;
mod transaction_limits;
mod transaction_runtime;
mod transaction_tracker;
mod typed_substate_layout;
mod vault;
mod vault_burn;
Expand Down
Loading

0 comments on commit f2d674b

Please sign in to comment.