-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compiler v2 framework 08- Fixed part of integration testsuit (#4293)
* [compiler-v2 framework] Fixed some DAO config integration test * [compiler-v2 framework] Fixed some DAO config integration test * [compiler-v2 framework] Add all integration tests that without process into repo * [compiler-v2 framework] add some debug information * [compiler-v2 framework] Add integration test for test block meta data deserialize code * [compiler-v2 framework] fixed the testcase: test_dao_propose.move * [compiler-v2 framework] fixed the testcase: test_dao_propose.move * [compiler-v2 framework] fixed the testcase: test_dao_failure.move after fixed open block * [compiler-v2 framework] fixed the block-metadata * [compiler-v2 framework] fixed on_chain_config * [compiler-v2 framework] remove unsupport testcase * [compiler-v2 framework] fixed on_chain_config * [compiler-v2 framework] fixed fixedpoint32 * [compiler-v2 framework] framework testsuite: fixed debug module * [compiler-v2 framework] framework testsuite: fixed epoch module * [compiler-v2 framework] framework testsuite: removed the code implemented by stdlib * [compiler-v2 framework] framework testsuite: removed the code implemented by stdlib * [compiler-v2 framework] framework testsuite: fixed natives module * [compiler-v2 framework] framework testsuite: fixed epilogue module * [compiler-v2 framework] framework testsuite: fixed oracle module * [compiler-v2 framework] framework testsuite: fixed oracle module * [compiler-v2 framework] framework testsuite: removed the code implemented by stdlib * [compiler-v2 framework] framework testsuite: removed the code implemented by stdlib * [compiler-v2 framework] framework testsuite: fixed package_txn_manager module * [compiler-v2 framework] framework testsuite: fixed resource module * [compiler-v2 framework] framework testsuite: fixed transaction_fee module * [compiler-v2 framework] fixed some integration-test for merge * [compiler-v2 framework] test testcase for crytpo changed * [compiler-v2 framework] framework testsuite: fixed token module test -- join_and_split.move * [compiler-v2 framework] framework testsuite: fixed `token` module test -- mint_stc.move, my_token.move * [compiler-v2 framework] framework testsuite: fixed `token` module test * revert BlockMetadata parent_hash with HashValue * [compiler-v2 framework] framework testsuite: fixed `treasury` module test * [compiler-v2 framework] framework testsuite: fixed part of `transaction_scripts` module test * [compiler-v2 framework] framework testsuite: fixed part of `transaction_scripts` module test * [compiler-v2 framework] framework testsuite: fixed part of `stc_block.move` module test --------- Co-authored-by: nk_ysg <[email protected]>
- Loading branch information
Showing
189 changed files
with
11,333 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
use log::info; | ||
use starcoin_types::account_address::AccountAddress; | ||
use starcoin_vm_types::account_config::genesis_address; | ||
use starcoin_vm_types::{ | ||
event::{EventHandle, EventKey}, | ||
on_chain_resource::BlockMetadata, | ||
state_view::StateReaderExt, | ||
}; | ||
use test_helper::executor::prepare_genesis; | ||
|
||
#[stest::test] | ||
fn test_block_metadata_bcs_deserialize() -> anyhow::Result<()> { | ||
let (chain_state, _net) = prepare_genesis(); | ||
|
||
let block_metadata = BlockMetadata { | ||
number: 0, | ||
parent_hash: Default::default(), | ||
author: AccountAddress::ONE, | ||
uncles: 0, | ||
parents_hash: vec![], | ||
new_block_events: EventHandle::new(EventKey::new(1, AccountAddress::ONE), 1), | ||
}; | ||
let bcs_block_metadata = bcs_ext::to_bytes(&block_metadata)?; | ||
info!( | ||
"block_metadata: {:?}, length: {}", | ||
bcs_block_metadata, | ||
bcs_block_metadata.len() | ||
); | ||
|
||
let onchain_data = chain_state.get_resource_type_bytes::<BlockMetadata>(genesis_address())?; | ||
info!( | ||
"onchain block_metadata: {:?}, data len: {}", | ||
onchain_data.to_vec(), | ||
onchain_data.len() | ||
); | ||
let on_chain_block_data = | ||
bcs_ext::from_bytes::<BlockMetadata>(onchain_data.to_vec().as_slice())?; | ||
assert_eq!(on_chain_block_data.number, 0); | ||
|
||
assert_eq!( | ||
chain_state | ||
.get_resource_type::<BlockMetadata>(genesis_address())? | ||
.number, | ||
0 | ||
); | ||
|
||
// let output = bcs_ext::from_bytes::<BlockMetadata>(bcs.as_slice())?; | ||
// assert_eq!(output.number, block_metadata.number); | ||
// | ||
// let data = chain_state.get_resource_type::<BlockMetadata>(genesis_address())?; | ||
// assert_ne!(data.number, 0); | ||
// assert!(!block_metadata.number > 0); | ||
|
||
Ok(()) | ||
} |
Binary file not shown.
Oops, something went wrong.