Skip to content

modify rate limit behavior on incoming funds#16

Merged
andygolay merged 4 commits intomainfrom
modify-rate-limiter
Dec 18, 2025
Merged

modify rate limit behavior on incoming funds#16
andygolay merged 4 commits intomainfrom
modify-rate-limiter

Conversation

@Primata
Copy link
Copy Markdown
Collaborator

@Primata Primata commented Dec 15, 2025

Goals:

  • incoming rate limit of 100m
  • remove the possibility of the rate limiting being offset

Changes behavior on incoming funds by removing release_rate_limit_capacity and adding try_consume_rate_limit_capacity on the Movement endpoint.

Copy link
Copy Markdown
Collaborator

@andygolay andygolay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Primata the change makes sense and appears to fit option 2 in the Slack discussion. New tests appear to be valid.

A couple thing to fix:

  1. On main all tests pass with movement move test --dev

on this PR's branch we get the following failure:

Test failures:

Failures in 0x302814823::oft_using_move_oft_adapter_tests:

┌── test_send_rate_limit_netted_by_receive ──────
│ error[E11001]: test failure
│     ┌─ /Users/andygmove/Downloads/repos/layerzero-devtools/examples/oft-evm-move-adapters/sources/shared_oft/oft_impl_config.move:301:9
│     │
│ 294 │     public(friend) fun try_consume_rate_limit_capacity_at_time(
│     │                        --------------------------------------- In this function in 0x302814823::oft_impl_config
│     ·
│ 301 │         assert!(rate_limit.in_flight_on_last_update + amount <= rate_limit.limit, EEXCEEDED_RATE_LIMIT);
│     │         ^^^^^^ Test was not expected to error, but it aborted with code 4 originating in the module 0000000000000000000000000000000000000000000000000000000302814823::oft_impl_config rooted here
│ 
│ 
│ stack trace
│       oft_impl_config::try_consume_rate_limit_capacity(/Users/andygmove/Downloads/repos/layerzero-devtools/examples/oft-evm-move-adapters/sources/shared_oft/oft_impl_config.move:290)
│       move_oft_adapter::debit_fungible_asset(/Users/andygmove/Downloads/repos/layerzero-devtools/examples/oft-evm-move-adapters/sources/oft_implementation/move_oft_adapter.move:103)
│       oft::send_internal(/Users/andygmove/Downloads/repos/layerzero-devtools/examples/oft-evm-move-adapters/sources/shared_oft/oft.move:117)
│       oft::send_withdraw(/Users/andygmove/Downloads/repos/layerzero-devtools/examples/oft-evm-move-adapters/sources/shared_oft/oft.move:86-89)
│       oft_using_move_oft_adapter_tests::test_send_rate_limit_netted_by_receive(/Users/andygmove/Downloads/repos/layerzero-devtools/examples/oft-evm-move-adapters/tests/oft_using_move_oft_adapter_tests.move:320)
│ 
└──────────────────

Test result: FAILED. Total tests: 66; passed: 65; failed: 1
{
  "Error": "Move unit tests failed"
}

Please ensure all tests pass and logic is correct.

  1. Clean up this Move warning:
warning: Unused value of parameter `src_eid`. Consider removing the parameter, or prefixing with an underscore (e.g., `_src_eid`), or binding to `_`
   ┌─ /Users/andygmove/Downloads/repos/layerzero-devtools/examples/oft-evm-move-adapters/sources/oft_implementation/move_oft_adapter.move:56:9
   │
56 │         src_eid: u32,
   │         ^^^^^^^

Thanks!

Copy link
Copy Markdown

@apenzk apenzk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the changes match the propossal option 2 in PR 126, reference the PR to give context

movementlabsxyz/MIP#126

@Primata
Copy link
Copy Markdown
Collaborator Author

Primata commented Dec 16, 2025

@Primata the change makes sense and appears to fit option 2 in the Slack discussion. New tests appear to be valid.

A couple thing to fix:

  1. On main all tests pass with movement move test --dev

on this PR's branch we get the following failure:

Test failures:

Failures in 0x302814823::oft_using_move_oft_adapter_tests:

┌── test_send_rate_limit_netted_by_receive ──────
│ error[E11001]: test failure
│     ┌─ /Users/andygmove/Downloads/repos/layerzero-devtools/examples/oft-evm-move-adapters/sources/shared_oft/oft_impl_config.move:301:9
│     │
│ 294 │     public(friend) fun try_consume_rate_limit_capacity_at_time(
│     │                        --------------------------------------- In this function in 0x302814823::oft_impl_config
│     ·
│ 301 │         assert!(rate_limit.in_flight_on_last_update + amount <= rate_limit.limit, EEXCEEDED_RATE_LIMIT);
│     │         ^^^^^^ Test was not expected to error, but it aborted with code 4 originating in the module 0000000000000000000000000000000000000000000000000000000302814823::oft_impl_config rooted here
│ 
│ 
│ stack trace
│       oft_impl_config::try_consume_rate_limit_capacity(/Users/andygmove/Downloads/repos/layerzero-devtools/examples/oft-evm-move-adapters/sources/shared_oft/oft_impl_config.move:290)
│       move_oft_adapter::debit_fungible_asset(/Users/andygmove/Downloads/repos/layerzero-devtools/examples/oft-evm-move-adapters/sources/oft_implementation/move_oft_adapter.move:103)
│       oft::send_internal(/Users/andygmove/Downloads/repos/layerzero-devtools/examples/oft-evm-move-adapters/sources/shared_oft/oft.move:117)
│       oft::send_withdraw(/Users/andygmove/Downloads/repos/layerzero-devtools/examples/oft-evm-move-adapters/sources/shared_oft/oft.move:86-89)
│       oft_using_move_oft_adapter_tests::test_send_rate_limit_netted_by_receive(/Users/andygmove/Downloads/repos/layerzero-devtools/examples/oft-evm-move-adapters/tests/oft_using_move_oft_adapter_tests.move:320)
│ 
└──────────────────

Test result: FAILED. Total tests: 66; passed: 65; failed: 1
{
  "Error": "Move unit tests failed"
}

Please ensure all tests pass and logic is correct.

  1. Clean up this Move warning:
warning: Unused value of parameter `src_eid`. Consider removing the parameter, or prefixing with an underscore (e.g., `_src_eid`), or binding to `_`
   ┌─ /Users/andygmove/Downloads/repos/layerzero-devtools/examples/oft-evm-move-adapters/sources/oft_implementation/move_oft_adapter.move:56:9
   │
56 │         src_eid: u32,
   │         ^^^^^^^

Thanks!

Oh okay, seems like we need to change previous tests, on it.

Copy link
Copy Markdown
Collaborator

@andygolay andygolay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@andygolay andygolay merged commit c4f82be into main Dec 18, 2025
0 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants