Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenwang1996 committed Jan 17, 2023
1 parent 7338b2c commit 7b6e31b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions chain/chain/src/tests/simple_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn build_chain() {
// cargo insta test --accept -p near-chain --features nightly -- tests::simple_chain::build_chain
let hash = chain.head().unwrap().last_block_hash;
if cfg!(feature = "nightly") {
insta::assert_display_snapshot!(hash, @"HTpETHnBkxcX1h3eD87uC5YP5nV66E6UYPrJGnQHuRqt");
insta::assert_display_snapshot!(hash, @"96KiRJdbMN8A9cFPXarZdaRQ8U2HvYcrGTGC8a4EgFzM");
} else {
insta::assert_display_snapshot!(hash, @"2iGtRFjF6BcqPF6tDcfLLojRaNax2PKDLxRqRc3RxRn7");
}
Expand Down Expand Up @@ -73,7 +73,7 @@ fn build_chain() {

let hash = chain.head().unwrap().last_block_hash;
if cfg!(feature = "nightly") {
insta::assert_display_snapshot!(hash, @"HyDYbjs5tgeEDf1N1XB4m312VdCeKjHqeGQ7dc7Lqwv8");
insta::assert_display_snapshot!(hash, @"4eW4jvyu1Ek6WmY3EuUoFFkrascC7svRww5UcZbNMkUf");
} else {
insta::assert_display_snapshot!(hash, @"7BkghFM7ZA8piYHAWYu4vTY6vE1pkTwy14bqQnS138qE");
}
Expand Down
3 changes: 3 additions & 0 deletions integration-tests/src/tests/standard_cases/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ pub fn test_create_account_failure_no_funds(node: impl Node) {
let transaction_result = node_user
.create_account(account_id.clone(), eve_dot_alice_account(), node.signer().public_key(), 0)
.unwrap();
#[cfg(not(feature = "protocol_feature_zero_balance_account"))]
assert_matches!(
&transaction_result.status,
FinalExecutionStatus::Failure(e) => match &e {
Expand All @@ -631,6 +632,8 @@ pub fn test_create_account_failure_no_funds(node: impl Node) {
},
_ => panic!("should be ActionError")
});
#[cfg(feature = "protocol_feature_zero_balance_account")]
assert_matches!(transaction_result.status, FinalExecutionStatus::SuccessValue(_));
}

pub fn test_create_account_failure_already_exists(node: impl Node) {
Expand Down
5 changes: 3 additions & 2 deletions runtime/runtime/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ fn is_zero_balance_account(
return Ok(false);
}
// Check whether the account has any data in contract storage
for _ in
state_update.iter(&trie_key_parsers::get_raw_prefix_for_contract_data(account_id, &[]))?
if let Some(_) = state_update
.iter(&trie_key_parsers::get_raw_prefix_for_contract_data(account_id, &[]))?
.next()
{
return Ok(false);
}
Expand Down

0 comments on commit 7b6e31b

Please sign in to comment.