diff --git a/examples/oft-evm-move-adapters/sources/shared_oft/oft_impl_config.move b/examples/oft-evm-move-adapters/sources/shared_oft/oft_impl_config.move index e16406822a..259066e5a6 100644 --- a/examples/oft-evm-move-adapters/sources/shared_oft/oft_impl_config.move +++ b/examples/oft-evm-move-adapters/sources/shared_oft/oft_impl_config.move @@ -1,6 +1,5 @@ module oft::oft_impl_config { use std::event::emit; - use std::math64::min; use std::string::utf8; use std::table::{Self, Table}; use std::timestamp; @@ -250,7 +249,8 @@ module oft::oft_impl_config { let rate_limit = *table::borrow(&store().rate_limit_by_eid, eid); if (timestamp > rate_limit.last_update) { // If the timestamp is greater than the last update, calculate the decayed in-flight amount - let elapsed = min(timestamp - rate_limit.last_update, rate_limit.window_seconds); + // Remove min() cap to allow decay beyond one window when needed + let elapsed = timestamp - rate_limit.last_update; let decay = ((((elapsed as u128) * (rate_limit.limit as u128)) / (rate_limit.window_seconds as u128)) as u64); // Ensure the decayed in-flight amount is not negative diff --git a/examples/oft-evm-move-adapters/tests/implementations/move_oft_adapter_tests.move b/examples/oft-evm-move-adapters/tests/implementations/move_oft_adapter_tests.move index a79dd9bdba..caac04e1c5 100644 --- a/examples/oft-evm-move-adapters/tests/implementations/move_oft_adapter_tests.move +++ b/examples/oft-evm-move-adapters/tests/implementations/move_oft_adapter_tests.move @@ -33,6 +33,8 @@ module oft::move_oft_adapter_tests { remove_pauser, set_fee_bps, set_fee_deposit_address, + EPAUSED, + EUNAUTHORIZED, }; use oft::oft_impl_config; use oft::oft_store; @@ -85,7 +87,7 @@ module oft::move_oft_adapter_tests { } #[test] - #[expected_failure(abort_code = 5)] // EUNAUTHORIZED + #[expected_failure(abort_code = EUNAUTHORIZED, location = move_oft_adapter)] fun test_only_pauser_or_admin_can_toggle() { setup(); @@ -97,7 +99,7 @@ module oft::move_oft_adapter_tests { } #[test] - #[expected_failure(abort_code = 4)] // EPAUSED + #[expected_failure(abort_code = EPAUSED, location = move_oft_adapter)] fun test_paused_blocks_debit() { let mint_ref = setup(); let admin = &create_signer_for_test(@oft_admin); @@ -149,7 +151,7 @@ module oft::move_oft_adapter_tests { } #[test] - #[expected_failure(abort_code = 5)] // EUNAUTHORIZED + #[expected_failure(abort_code = EUNAUTHORIZED, location = move_oft_adapter)] fun test_non_pauser_still_unauthorized() { setup(); let admin = &create_signer_for_test(@oft_admin); @@ -160,7 +162,7 @@ module oft::move_oft_adapter_tests { } #[test] - #[expected_failure(abort_code = 4)] // EPAUSED + #[expected_failure(abort_code = EPAUSED, location = move_oft_adapter)] fun test_credit_blocked_when_paused() { let mint_ref = setup(); let amount_ld = 500u64; @@ -181,7 +183,7 @@ module oft::move_oft_adapter_tests { } #[test] - #[expected_failure(abort_code = 5)] // EUNAUTHORIZED + #[expected_failure(abort_code = EUNAUTHORIZED, location = move_oft_adapter)] fun test_removed_pauser_loses_ability() { setup();