diff --git a/account/src/account_test.rs b/account/src/account_test.rs index 88aa5bef3e..0b4cd4c324 100644 --- a/account/src/account_test.rs +++ b/account/src/account_test.rs @@ -239,7 +239,7 @@ pub fn test_wallet_account() -> Result<()> { address: CORE_CODE_ADDRESS, module: Identifier::from(IdentStr::new("Account")?), name: Identifier::from(IdentStr::new("Account")?), - type_params: vec![], + type_args: vec![], }; let access_path = AccessPath::resource_access_path(address, struct_tag); println!("access path is {:?}", access_path); diff --git a/contrib-contracts/src/starcoin_merkle_test.rs b/contrib-contracts/src/starcoin_merkle_test.rs index 293c13f80f..2e20f2f624 100644 --- a/contrib-contracts/src/starcoin_merkle_test.rs +++ b/contrib-contracts/src/starcoin_merkle_test.rs @@ -7,6 +7,7 @@ use starcoin_types::identifier::Identifier; use starcoin_types::language_storage::ModuleId; use starcoin_vm_types::access_path::AccessPath; use starcoin_vm_types::account_config::association_address; +use starcoin_vm_types::state_store::state_key::StateKey; use starcoin_vm_types::transaction::{EntryFunction, Package, TransactionPayload}; use starcoin_vm_types::value::MoveValue; use test_helper::executor::{ @@ -15,8 +16,9 @@ use test_helper::executor::{ #[stest::test] fn test_starcoin_merkle() -> Result<()> { let (chain_state, net) = prepare_genesis(); + let state_key = StateKey::resource(&association_address(), &account_struct_tag())?; let ap = AccessPath::resource_access_path(association_address(), account_struct_tag()); - let state_with_proof = chain_state.get_with_proof(&ap)?; + let state_with_proof = chain_state.get_with_proof(&state_key)?; state_with_proof.proof.verify( chain_state.state_root(), ap, @@ -66,7 +68,7 @@ fn test_starcoin_merkle() -> Result<()> { // let state_root = chain_state.state_root(); let _expected_root = MoveValue::vector_u8(state_root.to_vec()); - let ap = AccessPath::resource_access_path(association_address(), account_struct_tag()); + let ap = StateKey::resource(&association_address(), &account_struct_tag())?; let state_with_proof = old_chain_state.get_with_proof(&ap)?; let account_address = MoveValue::vector_u8(association_address().to_vec()); let account_state_hash = MoveValue::vector_u8( diff --git a/genesis/src/lib.rs b/genesis/src/lib.rs index 568343b3fb..e97201c729 100644 --- a/genesis/src/lib.rs +++ b/genesis/src/lib.rs @@ -466,29 +466,29 @@ mod tests { "chain id in Move resource should equals ChainNetwork's chain_id." ); let genesis_account_resource = - account_state_reader.get_account_resource(&genesis_address())?; + account_state_reader.get_account_resource(&genesis_address()); assert!( - genesis_account_resource.is_some(), + genesis_account_resource.is_ok(), "genesis account must exist in genesis state." ); - let genesis_balance = account_state_reader.get_balance(&genesis_address())?; + let genesis_balance = account_state_reader.get_balance(&genesis_address()); assert!( - genesis_balance.is_some(), + genesis_balance.is_ok(), "genesis account balance must exist in genesis state." ); let association_account_resource = - account_state_reader.get_account_resource(&association_address())?; + account_state_reader.get_account_resource(&association_address()); assert!( - association_account_resource.is_some(), + association_account_resource.is_ok(), "association account must exist in genesis state." ); - let association_balance = account_state_reader.get_balance(&association_address())?; + let association_balance = account_state_reader.get_balance(&association_address()); assert!( - association_balance.is_some(), + association_balance.is_ok(), "association account balance must exist in genesis state." ); @@ -500,7 +500,7 @@ mod tests { // assert_eq!(vm_config.as_ref().unwrap(), &net.genesis_config().vm_config); let vm_publish_option = - account_state_reader.get_on_chain_config::()?; + account_state_reader.get_on_chain_config::(); assert!( vm_publish_option.is_some(), "vm_publish_option on_chain_config should exist." @@ -510,7 +510,7 @@ mod tests { &net.genesis_config().publishing_option ); - let consensus_config = account_state_reader.get_on_chain_config::()?; + let consensus_config = account_state_reader.get_on_chain_config::(); assert!( consensus_config.is_some(), "ConsensusConfig on_chain_config should exist." @@ -527,7 +527,7 @@ mod tests { // "DaoConfig on_chain_config should exist." // ); - let version = account_state_reader.get_on_chain_config::()?; + let version = account_state_reader.get_on_chain_config::(); assert!(version.is_some(), "Version on_chain_config should exist."); assert_eq!( version.as_ref().unwrap().major, @@ -535,9 +535,9 @@ mod tests { ); let module_upgrade_strategy = - account_state_reader.get_resource::(genesis_address())?; + account_state_reader.get_resource::(genesis_address()); assert!( - module_upgrade_strategy.is_some(), + module_upgrade_strategy.is_ok(), "ModuleUpgradeStrategy should exist." ); assert!( @@ -581,8 +581,8 @@ mod tests { block_accumulator.append(&[HashValue::random()])?; block_accumulator.flush()?; - let epoch = account_state_reader.get_resource::(genesis_address())?; - assert!(epoch.is_some(), "Epoch resource should exist."); + let epoch = account_state_reader.get_resource::(genesis_address()); + assert!(epoch.is_ok(), "Epoch resource should exist."); // test_gas_schedule_in_genesis(net, &state_db)?; @@ -604,7 +604,7 @@ mod tests { ); let account_state_reader = AccountStateReader::new(state_db); let genesis_gas_schedule = - account_state_reader.get_on_chain_config::()?; + account_state_reader.get_on_chain_config::(); assert!( genesis_gas_schedule.is_some(), "GasSchedule config should exist." diff --git a/state/service/src/service.rs b/state/service/src/service.rs index af994da7b5..efab25b6a2 100644 --- a/state/service/src/service.rs +++ b/state/service/src/service.rs @@ -297,8 +297,8 @@ mod tests { registry.put_shared(config).await?; registry.put_shared(storage).await?; let service_ref = registry.register::().await?; - let account_state = service_ref.get_account_state(genesis_address()).await?; - assert!(account_state.is_some()); + let account_state = service_ref.get_account_state(genesis_address()).await; + assert!(account_state.is_ok()); Ok(()) } } diff --git a/vm/starcoin-sdk-builder/tests/generation.rs b/vm/starcoin-sdk-builder/tests/generation.rs index 66efb70d37..d061c27462 100644 --- a/vm/starcoin-sdk-builder/tests/generation.rs +++ b/vm/starcoin-sdk-builder/tests/generation.rs @@ -6,7 +6,7 @@ use serde_generate as serdegen; use serde_generate::SourceInstaller as _; use serde_reflection::Registry; use starcoin_sdk_builder as buildgen; -use starcoin_types::transaction::EntryABI; +use starcoin_vm_types::transaction::EntryABI; use std::{io::Write, process::Command}; use tempfile::tempdir; diff --git a/vm/stdlib/tests/generated_files.rs b/vm/stdlib/tests/generated_files.rs index 4babe8f0ec..7c334242a8 100644 --- a/vm/stdlib/tests/generated_files.rs +++ b/vm/stdlib/tests/generated_files.rs @@ -4,6 +4,7 @@ use move_compiler::construct_pre_compiled_lib; use move_compiler::shared::PackagePaths; use starcoin_move_compiler::starcoin_framework_named_addresses; +use std::collections::BTreeSet; use std::path::PathBuf; use std::process::Command; use stdlib::stdlib_files; @@ -58,6 +59,7 @@ fn test_stdlib_pre_compiled() { }], None, move_compiler::Flags::empty(), + &BTreeSet::new(), ) .unwrap(); assert!(program_res.is_ok()); diff --git a/vm/types/src/account_config/resources/account.rs b/vm/types/src/account_config/resources/account.rs index b0e4a06a81..58eccfe8ac 100644 --- a/vm/types/src/account_config/resources/account.rs +++ b/vm/types/src/account_config/resources/account.rs @@ -1,8 +1,10 @@ // Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 +use crate::account_config::genesis_address; use crate::{account_config::constants::ACCOUNT_MODULE_NAME, event::EventHandle}; use move_core_types::account_address::AccountAddress; +use move_core_types::language_storage::{StructTag, CORE_CODE_ADDRESS}; use move_core_types::{ ident_str, identifier::IdentStr,