Skip to content

Commit

Permalink
[crypto] SuiAddress algorithm changed test
Browse files Browse the repository at this point in the history
  • Loading branch information
kchalkias committed Apr 20, 2022
1 parent 8f3d7a8 commit 512f2ed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions sui_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ serde-reflection = "0.3.5"
serde_yaml = "0.8.23"
pretty_assertions = "1.2.0"
temp_testdir = "0.2"
hex = "0.4.3"

test_utils = { path = "../test_utils" }

Expand Down
15 changes: 15 additions & 0 deletions sui_core/src/unit_tests/gateway_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,21 @@ async fn init_local_client_and_fund_account_bad(
client
}

#[cfg(test)]
const ADMIN_SENTINEL: &str = "ee0437cf625b77af4d12bff98af1a88332b00638";

// Required to capture address creation algorithm updates that break some tests.
#[test]
fn test_admin_address_consistency() {
use hex;
let (admin_address, _) = make_admin_account();
assert_eq!(admin_address.to_vec(), hex::decode(ADMIN_SENTINEL).expect("Decoding failed"),
"If this test broke, then the algorithm for deriving addresses from public keys has \
changed. Please compute the new admin address in hex format from `make_admin_account`\
and update both the ADMIN_SENTINEL const above, but also the ADMIN address to \
Hero.move with the new admin account hex value.");
}

#[tokio::test]
async fn test_initiating_valid_transfer() {
let recipient = get_new_address();
Expand Down

0 comments on commit 512f2ed

Please sign in to comment.