aptos_update: Fix aptos errors

This commit is contained in:
Josh Siegel 2022-12-13 20:17:34 +00:00 committed by Csongor Kiss
parent 38b1d1c350
commit c8da62e383
14 changed files with 38 additions and 38 deletions

View File

@ -7,4 +7,4 @@ $(TARGETS):
$(foreach dir,$(CONTRACT_DIRS), make -C $(dir) $@ &&) true
test-docker:
DOCKER_BUILDKIT=1 docker build -f Dockerfile --target tests .
DOCKER_BUILDKIT=1 docker build --progress plain -f Dockerfile --target tests .

View File

@ -118,7 +118,7 @@ module token_bridge::attest_token_test {
}
#[test(token_bridge=@token_bridge, deployer=@deployer)]
#[expected_failure(abort_code = 1)]
#[expected_failure(abort_code = 1, location=token_bridge::attest_token)]
fun test_attest_wrapped_token(token_bridge: &signer, deployer: &signer) {
setup(token_bridge, deployer);
wrapped_test::init_wrapped_token();

View File

@ -218,7 +218,7 @@ module token_bridge::complete_transfer_test {
deployer = @deployer,
token_bridge = @token_bridge,
)]
#[expected_failure(abort_code = 65542)] // EINSUFFICIENT_BALANCE
#[expected_failure(abort_code = 65542, location = 0000000000000000000000000000000000000000000000000000000000000001::coin)] // EINSUFFICIENT_BALANCE
public fun test_native_too_much_fee(
deployer: &signer,
token_bridge: &signer
@ -249,7 +249,7 @@ module token_bridge::complete_transfer_test {
deployer = @deployer,
token_bridge = @token_bridge,
)]
#[expected_failure(abort_code = 1)] // E_ORIGIN_ADDRESS_MISMATCH
#[expected_failure(abort_code = 1, location = token_bridge::state)] // E_ORIGIN_ADDRESS_MISMATCH
public fun test_native_wrong_coin(
deployer: &signer,
token_bridge: &signer
@ -281,7 +281,7 @@ module token_bridge::complete_transfer_test {
deployer = @deployer,
token_bridge = @token_bridge,
)]
#[expected_failure(abort_code = 0)] // E_ORIGIN_CHAIN_MISMATCH
#[expected_failure(abort_code = 0, location = token_bridge::state)] // E_ORIGIN_CHAIN_MISMATCH
public fun test_native_wrong_origin_address(
deployer: &signer,
token_bridge: &signer

View File

@ -197,7 +197,7 @@ module token_bridge::contract_upgrade_test {
}
#[test(deployer = @deployer)]
#[expected_failure(abort_code = 0x6407)]
#[expected_failure(abort_code = 0x6407, location = 0x1::table)]
public fun test_contract_upgrade_double(deployer: &signer) {
setup(deployer);
@ -207,7 +207,7 @@ module token_bridge::contract_upgrade_test {
}
#[test(deployer = @deployer)]
#[expected_failure(abort_code = 4)]
#[expected_failure(abort_code = 4, location = token_bridge::contract_upgrade)]
public fun test_contract_upgrade_wrong_chain(deployer: &signer) {
setup(deployer);

View File

@ -126,7 +126,7 @@ module token_bridge::string32_test {
}
#[test]
#[expected_failure(abort_code = 0)]
#[expected_failure(abort_code = 0, location = token_bridge::string32)]
public fun test_right_pad_fail() {
let too_long = string::utf8(b"this string is very very very very very very very very very very very very very very very long");
string32::right_pad(&too_long);

View File

@ -124,7 +124,7 @@ module token_bridge::register_chain_test {
}
#[test]
#[expected_failure(abort_code = 0)]
#[expected_failure(abort_code = 0, location = token_bridge::register_chain)]
public fun test_parse_fail() {
let vaa = vaa::parse_test(ETHEREUM_NFT_REG);
// this should fail because it's an NFT registration
@ -142,7 +142,7 @@ module token_bridge::register_chain_test {
}
#[test(deployer = @deployer)]
#[expected_failure(abort_code = 25607)]
#[expected_failure(abort_code = 25607, location = 0x1::table)]
public fun test_replay_protect(deployer: &signer) {
setup(deployer);

View File

@ -269,7 +269,7 @@ module token_bridge::transfer_tokens_test {
}
#[test(aptos_framework = @aptos_framework, token_bridge=@token_bridge, deployer=@deployer)]
#[expected_failure(abort_code = 0)]
#[expected_failure(abort_code = 0, location = token_bridge::transfer_tokens)]
fun test_transfer_wrapped_token_too_much_relayer_fee(
aptos_framework: &signer,
token_bridge: &signer,

View File

@ -82,7 +82,7 @@ module token_bridge::vaa_test {
}
#[test(deployer = @deployer)]
#[expected_failure(abort_code = 0)] // E_UNKNOWN_CHAIN
#[expected_failure(abort_code = 0, location = token_bridge::vaa)] // E_UNKNOWN_CHAIN
public fun test_unknown_chain(deployer: &signer) {
setup(deployer);
let vaa = vaa::parse_verify_and_replay_protect(VAA);
@ -90,7 +90,7 @@ module token_bridge::vaa_test {
}
#[test(deployer = @deployer)]
#[expected_failure(abort_code = 1)] // E_UNKNOWN_EMITTER
#[expected_failure(abort_code = 1, location = token_bridge::vaa)] // E_UNKNOWN_EMITTER
public fun test_unknown_emitter(deployer: &signer) {
setup(deployer);
state::set_registered_emitter(
@ -113,7 +113,7 @@ module token_bridge::vaa_test {
}
#[test(deployer = @deployer)]
#[expected_failure(abort_code = 25607)] // add_box error
#[expected_failure(abort_code = 25607, location = 0x1::table)] // add_box error
public fun test_replay_protect(deployer: &signer) {
setup(deployer);
state::set_registered_emitter(

View File

@ -200,7 +200,7 @@ module token_bridge::wrapped_test {
#[test(deployer=@deployer)]
#[expected_failure(abort_code = 0)]
#[expected_failure(abort_code = 0, location = token_bridge::vaa)]
fun test_create_wrapped_coin_unregistered(deployer: &signer) {
setup(deployer);
@ -216,7 +216,7 @@ module token_bridge::wrapped_test {
// This upgrade policy is not enabled in the VM as of writing, but that
// might well change in the future, so we future proof ourselves here.
#[test(deployer=@deployer)]
#[expected_failure(abort_code = 65537)] // ECOIN_INFO_ADDRESS_MISMATCH
#[expected_failure(abort_code = 65537, location = 0000000000000000000000000000000000000000000000000000000000000001::coin)] // ECOIN_INFO_ADDRESS_MISMATCH
fun test_create_wrapped_coin_bad_type(deployer: &signer) {
setup(deployer);
register_chain::submit_vaa(ETHEREUM_TOKEN_REG);

View File

@ -189,7 +189,7 @@ module wormhole::contract_upgrade_test {
}
#[test]
#[expected_failure(abort_code = 0x6407)]
#[expected_failure(abort_code = 0x6407, location = 0x1::table)]
public fun test_contract_upgrade_double() {
setup();
@ -199,7 +199,7 @@ module wormhole::contract_upgrade_test {
}
#[test]
#[expected_failure(abort_code = 4)]
#[expected_failure(abort_code = 4, location = contract_upgrade)]
public fun test_contract_upgrade_wrong_chain() {
setup();

View File

@ -75,7 +75,7 @@ module wormhole::external_address_test {
}
#[test]
#[expected_failure(abort_code = 0)]
#[expected_failure(abort_code = 0, location = wormhole::external_address)]
public fun test_left_pad_vector_too_long() {
let v = x"123456789123456789123456789123451234567891234567891234567891234500"; //33 bytes
let res = left_pad(&v);
@ -94,7 +94,7 @@ module wormhole::external_address_test {
}
#[test]
#[expected_failure(abort_code = 0)]
#[expected_failure(abort_code = 0, location = wormhole::external_address)]
public fun test_from_bytes_over_32_bytes() {
let v = x"00000000000000000000000000000000000000000000000000000000000000001234";
let ea = from_bytes(v);
@ -116,7 +116,7 @@ module wormhole::external_address_test {
}
#[test]
#[expected_failure(abort_code = 0)]
#[expected_failure(abort_code = 0, location = wormhole::external_address)]
fun test_pad_left_long() {
let v = x"665555555555555555555555555555555555555555555555555555555555555555";
pad_left_32(&v);

View File

@ -519,7 +519,7 @@ module wormhole::u256 {
}
#[test]
#[expected_failure(abort_code = 1)]
#[expected_failure(abort_code = 1, location = Self)]
fun test_get_d_overflow() {
let a = DU256 {
v0: 1,
@ -568,7 +568,7 @@ module wormhole::u256 {
}
#[test]
#[expected_failure(abort_code = 1)]
#[expected_failure(abort_code = 1, location = Self)]
fun test_put_d_overflow() {
let a = DU256 {
v0: 1,
@ -631,7 +631,7 @@ module wormhole::u256 {
}
#[test]
#[expected_failure(abort_code = 1)]
#[expected_failure(abort_code = 1, location = Self)]
fun test_get_aborts() {
let _ = get(&zero(), 4);
}
@ -656,7 +656,7 @@ module wormhole::u256 {
}
#[test]
#[expected_failure(abort_code = 1)]
#[expected_failure(abort_code = 1, location = Self)]
fun test_put_overflow() {
let a = zero();
put(&mut a, 6, 255);
@ -688,7 +688,7 @@ module wormhole::u256 {
}
#[test]
#[expected_failure(abort_code = 2)]
#[expected_failure(abort_code = 2, location = Self)]
fun test_add_overflow() {
let max = (U64_MAX as u64);
@ -712,7 +712,7 @@ module wormhole::u256 {
}
#[test]
#[expected_failure(abort_code = 2)]
#[expected_failure(abort_code = 2, location = Self)]
fun test_sub_overflow() {
let a = from_u128(0);
let b = from_u128(1);
@ -721,7 +721,7 @@ module wormhole::u256 {
}
#[test]
#[expected_failure(abort_code = 0)]
#[expected_failure(abort_code = 0, location = Self)]
fun test_too_big_to_cast_to_u128() {
let a = from_u128(U128_MAX);
let b = from_u128(U128_MAX);
@ -798,7 +798,7 @@ module wormhole::u256 {
}
#[test]
#[expected_failure(abort_code = 2)]
#[expected_failure(abort_code = 2, location = Self)]
fun test_mul_overflow() {
let max = (U64_MAX as u64);
@ -880,7 +880,7 @@ module wormhole::u256 {
}
#[test]
#[expected_failure(abort_code=0)]
#[expected_failure(abort_code=0, location = Self)]
fun test_as_u64_overflow() {
let _ = as_u64(from_u128(U128_MAX));
}

View File

@ -286,7 +286,7 @@ module wormhole::vaa_test {
}
#[test]
#[expected_failure(abort_code = 3)] // E_GUARDIAN_SET_EXPIRED
#[expected_failure(abort_code = 3, location = wormhole::vaa)] // E_GUARDIAN_SET_EXPIRED
/// Ensures that the GOV_VAA can no longer be verified after the guardian set
/// upgrade after expiry
public fun test_guardian_set_expired() {
@ -305,7 +305,7 @@ module wormhole::vaa_test {
}
#[test]
#[expected_failure(abort_code = 8)] // E_OLD_GUARDIAN_SET_GOVERNANCE
#[expected_failure(abort_code = 8, location = wormhole::vaa)] // E_OLD_GUARDIAN_SET_GOVERNANCE
/// Ensures that governance GOV_VAAs can only be verified by the latest guardian
/// set, even if the signer hasn't expired yet
public fun test_governance_guardian_set_latest() {
@ -328,7 +328,7 @@ module wormhole::vaa_test {
}
#[test]
#[expected_failure(abort_code = 5)] // E_INVALID_GOVERNANCE_EMITTER
#[expected_failure(abort_code = 5, location = wormhole::vaa)] // E_INVALID_GOVERNANCE_EMITTER
/// Ensures that governance GOV_VAAs can only be sent from the correct governance emitter
public fun test_invalid_governance_emitter() {
let aptos_framework = std::account::create_account_for_test(@aptos_framework);
@ -351,7 +351,7 @@ module wormhole::vaa_test {
}
#[test]
#[expected_failure(abort_code = 4)] // E_INVALID_GOVERNANCE_CHAIN
#[expected_failure(abort_code = 4, location = wormhole::vaa)] // E_INVALID_GOVERNANCE_CHAIN
/// Ensures that governance GOV_VAAs can only be sent from the correct governance chain
public fun test_invalid_governance_chain() {
let aptos_framework = std::account::create_account_for_test(@aptos_framework);
@ -389,7 +389,7 @@ module wormhole::vaa_test {
}
#[test]
#[expected_failure(abort_code = 0)] // NO_QUORUM
#[expected_failure(abort_code = 0, location = wormhole::vaa)] // NO_QUORUM
public fun test_no_quorum() {
setup();
// do an upgrade
@ -406,7 +406,7 @@ module wormhole::vaa_test {
}
#[test]
#[expected_failure(abort_code = 7)] // E_NON_INCREASING_SIGNERS
#[expected_failure(abort_code = 7, location = wormhole::vaa)] // E_NON_INCREASING_SIGNERS
public fun test_double_signed() {
setup();
// do an upgrade
@ -423,7 +423,7 @@ module wormhole::vaa_test {
}
#[test]
#[expected_failure(abort_code = 2)] // E_INVALID_SIGNATURE
#[expected_failure(abort_code = 2, location = wormhole::vaa)] // E_INVALID_SIGNATURE
public fun test_out_of_order_signers() {
setup();
// do an upgrade

View File

@ -194,7 +194,7 @@ module wormhole::wormhole_test {
}
#[test]
#[expected_failure(abort_code = 0x0)]
#[expected_failure(abort_code = 0x0, location = wormhole::wormhole)]
public fun test_publish_message_insufficient_fee() {
setup(100);
let emitter_cap = wormhole::register_emitter();