diff --git a/contrib-contracts/modules/EthStateVerifier.move b/contrib-contracts/modules/EthStateVerifier.move index e164fd1816..c60006353b 100644 --- a/contrib-contracts/modules/EthStateVerifier.move +++ b/contrib-contracts/modules/EthStateVerifier.move @@ -28,35 +28,35 @@ module RLP { /// Nested arrays are not supported. public fun decode_list(data: &vector): vector> { let (decoded, consumed) = decode(data, 0); - assert(consumed == Vector::length(data), INVALID_RLP_DATA); + assert!(consumed == Vector::length(data), INVALID_RLP_DATA); decoded } fun decode(data: &vector, offset: u64): (vector>, u64) { let data_len = Vector::length(data); - assert(offset < data_len, DATA_TOO_SHORT); + assert!(offset < data_len, DATA_TOO_SHORT); let first_byte = *Vector::borrow(data, offset); if (first_byte >= 248u8) { // 0xf8 let length_of_length = ((first_byte - 247u8) as u64); - assert(offset + length_of_length < data_len, DATA_TOO_SHORT); + assert!(offset + length_of_length < data_len, DATA_TOO_SHORT); let length = unarrayify_integer(data, offset + 1, (length_of_length as u8)); - assert(offset + length_of_length + length < data_len, DATA_TOO_SHORT); + assert!(offset + length_of_length + length < data_len, DATA_TOO_SHORT); decode_children(data, offset, offset + 1 + length_of_length, length_of_length + length) } else if (first_byte >= 192u8) { // 0xc0 let length = ((first_byte - 192u8) as u64); - assert(offset + length < data_len, DATA_TOO_SHORT); + assert!(offset + length < data_len, DATA_TOO_SHORT); decode_children(data, offset, offset + 1, length) } else if (first_byte >= 184u8) { // 0xb8 let length_of_length = ((first_byte - 183u8) as u64); - assert(offset + length_of_length < data_len, DATA_TOO_SHORT); + assert!(offset + length_of_length < data_len, DATA_TOO_SHORT); let length = unarrayify_integer(data, offset + 1, (length_of_length as u8)); - assert(offset + length_of_length + length < data_len, DATA_TOO_SHORT); + assert!(offset + length_of_length + length < data_len, DATA_TOO_SHORT); let bytes = Bytes::slice(data, offset + 1 + length_of_length, offset + 1 + length_of_length + length); (Vector::singleton(bytes), 1+length_of_length+length) } else if (first_byte >= 128u8) { // 0x80 let length = ((first_byte - 128u8) as u64); - assert(offset + length < data_len, DATA_TOO_SHORT); + assert!(offset + length < data_len, DATA_TOO_SHORT); let bytes = Bytes::slice(data, offset + 1, offset + 1 + length); (Vector::singleton(bytes), 1+length) } else { @@ -72,7 +72,7 @@ module RLP { let (decoded, consumed) = decode(data, child_offset); Vector::append(&mut result, decoded); child_offset = child_offset + consumed; - assert(child_offset <= offset + 1 + length, DATA_TOO_SHORT); + assert!(child_offset <= offset + 1 + length, DATA_TOO_SHORT); }; (result, 1 + length) } diff --git a/contrib-contracts/modules/MerkleDistributor.move b/contrib-contracts/modules/MerkleDistributor.move index d5d2ebf0cf..8621c6b069 100644 --- a/contrib-contracts/modules/MerkleDistributor.move +++ b/contrib-contracts/modules/MerkleDistributor.move @@ -115,11 +115,11 @@ module MerkleDistributor { fun internal_claim(distribution: &mut MerkleDistribution, index: u64, account: address, amount: u128, merkle_proof: vector>): Token { let claimed = is_claimed_(distribution, index); - assert(!claimed, Errors::custom(ALREADY_CLAIMED)); + assert!(!claimed, Errors::custom(ALREADY_CLAIMED)); let leaf_data = encode_leaf(&index, &account, &amount); let verified = MerkleProof::verify(&merkle_proof, &distribution.merkle_root, Hash::sha3_256(leaf_data)); - assert(verified, Errors::custom(INVALID_PROOF)); + assert!(verified, Errors::custom(INVALID_PROOF)); set_claimed_(distribution, index); diff --git a/vm/types/src/account_address.rs b/vm/types/src/account_address.rs index 9c66d286fd..f924ed55bf 100644 --- a/vm/types/src/account_address.rs +++ b/vm/types/src/account_address.rs @@ -43,7 +43,7 @@ mod test { #[test] fn address_hash() { - let address: AccountAddress = "ca843279e3427144cead5e4d5999a3d0".parse().unwrap(); + let address: AccountAddress = "0xca843279e3427144cead5e4d5999a3d0".parse().unwrap(); let hash_vec = Vec::from_hex("7d39654178dd4758d0bc33b26e3e06051f04a215fd7ad270d4fb5e4988c8e5d2")