Skip to content

[monad] Reserve balance precompile fallback cost#2109

Merged
jhunsaker merged 2 commits intomainfrom
dhil/rb-fallback-cost
Mar 4, 2026
Merged

[monad] Reserve balance precompile fallback cost#2109
jhunsaker merged 2 commits intomainfrom
dhil/rb-fallback-cost

Conversation

@dhil
Copy link
Contributor

@dhil dhil commented Feb 27, 2026

Monad Foundation has specified the cost of the fallback method on the reserve balance precompile should be a 100 (which is same as the dippedIntoReserve method). Previously, the cost was set to 40'000 (modelled after the staking contract's fallback method) as a placeholder value.

Copilot AI review requested due to automatic review settings February 27, 2026 16:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the gas cost for the reserve balance precompile's fallback method from 40,000 to 100, aligning it with the cost of the dippedIntoReserve method as specified by Monad Foundation. The previous value of 40,000 was a placeholder modeled after the staking contract.

Changes:

  • Updated FALLBACK_COST constant from 40,000 to 100 to match the specification
  • Restructured and enhanced test coverage to validate the new gas cost with both sufficient and insufficient gas scenarios
  • Added explicit out-of-gas (OOG) test cases for both fallback and dippedIntoReserve methods

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
category/execution/monad/reserve_balance/reserve_balance_contract.cpp Updated FALLBACK_COST constant from 40,000 to 100
category/execution/monad/reserve_balance/reserve_balance_contract_test.cpp Restructured fallback test with proper gas amounts (100 and 99); added OOG test for dippedIntoReserve method; corrected gas values in all related tests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dhil dhil force-pushed the dhil/rb-fallback-cost branch from 74367e7 to f6423fc Compare February 27, 2026 20:21
@bhuan bhuan requested a review from a team February 27, 2026 22:30
@dhil dhil force-pushed the dhil/rb-fallback-cost branch from f6423fc to 945ab05 Compare March 3, 2026 12:10
Monad Foundation has specified the cost of the `fallback` method on the
reserve balance precompile should be a `100` (which is same as the
`dippedIntoReserve` method). Previously, the cost was set to `40'000`
(modelled after the staking contract's fallback method) as a placeholder
value.
@dhil dhil force-pushed the dhil/rb-fallback-cost branch from 945ab05 to 3807751 Compare March 3, 2026 15:33
@dhil dhil requested a review from Copilot March 3, 2026 20:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dhil dhil force-pushed the dhil/rb-fallback-cost branch from ced05b7 to a37b706 Compare March 3, 2026 21:08
This patch adds tests, which checks that the order of wellformedness
checks for calling the reserve contract is consistent with the order
specified by the Monad Foundation.
@dhil dhil force-pushed the dhil/rb-fallback-cost branch from a37b706 to 3b7d52d Compare March 4, 2026 00:42
@jhunsaker jhunsaker merged commit 9f2c9a2 into main Mar 4, 2026
14 checks passed
@jhunsaker jhunsaker deleted the dhil/rb-fallback-cost branch March 4, 2026 02:28
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