Skip to content

fix: on-chain update prices return excess send mode#626

Open
vicentevieytes wants to merge 8 commits intomainfrom
vv/fix-update-prices-return-excess-send-mode
Open

fix: on-chain update prices return excess send mode#626
vicentevieytes wants to merge 8 commits intomainfrom
vv/fix-update-prices-return-excess-send-mode

Conversation

@vicentevieytes
Copy link
Copy Markdown
Collaborator

No description provided.

@vicentevieytes vicentevieytes requested a review from a team as a code owner February 25, 2026 21:08
Copilot AI review requested due to automatic review settings February 25, 2026 21:08
@github-actions
Copy link
Copy Markdown

👋 vicentevieytes, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

Copy link
Copy Markdown
Contributor

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 adjusts TON fee/cost parameters and fixes how the FeeQuoter contract returns excess TON after UpdatePrices, so excess value is sent back without risking draining the contract’s existing balance.

Changes:

  • Bumped default OCR ContractTransmitter TON cost constants for commit (price-only / price+root).
  • Increased on-chain FeeQuoter_Costs.updatePrices() value requirement from 0.01 TON to 0.02 TON.
  • Updated FeeQuoter’s excess-return mechanism to reserve the original balance and send excess using SEND_MODE_CARRY_ALL_BALANCE.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
pkg/ccip/ocr/config.go Updates default TON cost constants used by the OCR contract transmitter.
contracts/contracts/ccip/fee_quoter/messages.tolk Increases the declared TON cost for updatePrices().
contracts/contracts/ccip/fee_quoter/contract.tolk Changes excess return to reserve original balance and carry all remaining balance to the refund recipient.

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

@smartcontractkit smartcontractkit deleted a comment from Copilot AI Feb 25, 2026
Copy link
Copy Markdown
Collaborator

@patricios-space patricios-space left a comment

Choose a reason for hiding this comment

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

Looks good, but if you plan to run an in-place upgrade, you'll need a migrate function.

@vicentevieytes vicentevieytes force-pushed the vv/fix-update-prices-return-excess-send-mode branch from ea68bda to 0ddf173 Compare February 25, 2026 22:07

@method_id(1000)
fun migrate(storage: cell, version: slice): cell { throw Upgradeable_Error.VersionMismatch; }
fun migrate(storage: cell, version: slice): cell {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@patricios-space so here I should check that a PREVIOUS_VERSION matches the value passed in the version parameter right?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes! In other contracts we added const CONTRACT_VERSION_PREV = "1.6.0"; at the top of the contract.tolk file and then we assert version.bitEquals(CONTRACT_VERSION_PREV)

})

const finalBalance = (await blockchain.getContract(setup.bind.feeQuoter.address)).balance
expect(finalBalance).toEqual(initialBalance)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is flaky as storagefee could change the balance. See

const storageFees = tx.description.storagePhase?.storageFeesCollected || toNano('0')
for the fix

Copy link
Copy Markdown
Collaborator

@patricios-space patricios-space left a comment

Choose a reason for hiding this comment

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

lgtm

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.

3 participants