Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[transactional-tests] Publish correct framework based on protocol version in the transactional test runner #12867

Merged
merged 1 commit into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/sui-transactional-test-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ sui-types = { workspace = true, features = ["test-utils"]}
workspace-hack = { version = "0.1", path = "../workspace-hack" }
sui-json-rpc-types.workspace = true
sui-json-rpc.workspace = true
sui-framework-snapshot.workspace = true

[target.'cfg(msim)'.dependencies]
msim.workspace = true
19 changes: 13 additions & 6 deletions crates/sui-transactional-test-runner/src/test_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use sui_json_rpc::api::QUERY_MAX_RESULT_LIMIT;
use sui_json_rpc_types::{
DevInspectResults, EventFilter, SuiExecutionStatus, SuiTransactionBlockEffectsAPI,
};
use sui_protocol_config::{Chain, ProtocolConfig};
use sui_protocol_config::{Chain, ProtocolConfig, ProtocolVersion};
use sui_types::transaction::Command;
use sui_types::transaction::ProgrammableTransaction;
use sui_types::DEEPBOOK_PACKAGE_ID;
Expand Down Expand Up @@ -156,14 +156,21 @@ pub fn clone_genesis_compiled_modules() -> Vec<Vec<CompiledModule>> {
GENESIS.modules.clone()
}

pub fn clone_genesis_packages() -> Vec<Object> {
GENESIS.packages.clone()
}

pub fn clone_genesis_objects() -> Vec<Object> {
GENESIS.objects.clone()
}

fn genesis_module_objects_for_protocol_version(protocol_version: ProtocolVersion) -> Vec<Object> {
if protocol_version == ProtocolVersion::max() {
return GENESIS.packages.clone();
}
sui_framework_snapshot::load_bytecode_snapshot(protocol_version.as_u64())
.expect("Unable to load bytecode snapshot")
.into_iter()
.map(|pkg| pkg.genesis_object())
.collect()
}

/// Create and return objects wrapping the genesis modules for sui
fn create_genesis_module_objects() -> Genesis {
Genesis {
Expand Down Expand Up @@ -270,7 +277,7 @@ impl<'a> MoveTestAdapter<'a> for SuiTestAdapter<'a> {

let mut named_address_mapping = NAMED_ADDRESSES.clone();

let mut objects = clone_genesis_packages();
let mut objects = genesis_module_objects_for_protocol_version(protocol_config.version);
objects.extend(clone_genesis_objects());
let mut account_objects = BTreeMap::new();
let mut accounts = BTreeMap::new();
Expand Down