From d951916d4001a7ab1bb6a39e130e4782056ffd16 Mon Sep 17 00:00:00 2001 From: Ruud van Asseldonk Date: Mon, 26 Apr 2021 13:02:27 +0200 Subject: [PATCH] Make test_hash_stored_account pass in release mode The hash differs between debug and release mode, which makes the test fail when running under "cargo test --release". Use cfg! to include a different expected hash in release mode. --- runtime/src/accounts_db.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 3a21df4db5..10768b75d1 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -8706,8 +8706,12 @@ pub mod tests { hash: &hash, }; let account = stored_account.clone_account(); - let expected_account_hash = - Hash::from_str("4StuvYHFd7xuShVXB94uHHvpqGMCaacdZnYB74QQkPA1").unwrap(); + + let expected_account_hash = if cfg!(debug_assertions) { + Hash::from_str("4StuvYHFd7xuShVXB94uHHvpqGMCaacdZnYB74QQkPA1").unwrap() + } else { + Hash::from_str("33ruy7m3Xto7irYfsBSN74aAzQwCQxsfoZxXuZy2Rra3").unwrap() + }; assert_eq!( AccountsDb::hash_stored_account(slot, &stored_account),