From 5cbc8ad335b78df587c80b118d5a748447f5c3c5 Mon Sep 17 00:00:00 2001 From: vicente Date: Wed, 25 Feb 2026 18:04:01 -0300 Subject: [PATCH 1/5] fix updatePrices sendExcessTo send mode --- .../contracts/ccip/fee_quoter/contract.tolk | 3 +- .../feequoter/FeeQuoter.updatePrices.spec.ts | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/contracts/contracts/ccip/fee_quoter/contract.tolk b/contracts/contracts/ccip/fee_quoter/contract.tolk index 29cf1b1c4..661005515 100644 --- a/contracts/contracts/ccip/fee_quoter/contract.tolk +++ b/contracts/contracts/ccip/fee_quoter/contract.tolk @@ -536,7 +536,8 @@ fun sendExcessesTo(sendExcessesTo: address?, sender: address) { dest: receiver, body: createEmptyCell(), }); - returnExcesses.send(SEND_MODE_CARRY_ALL_REMAINING_MESSAGE_VALUE); + reserveToncoinsOnBalance(0, RESERVE_MODE_INCREASE_BY_ORIGINAL_BALANCE); + returnExcesses.send(SEND_MODE_CARRY_ALL_BALANCE); } get fun tokenPrice(token: address): TimestampedPrice { diff --git a/contracts/tests/ccip/feequoter/FeeQuoter.updatePrices.spec.ts b/contracts/tests/ccip/feequoter/FeeQuoter.updatePrices.spec.ts index 24fcfe087..f697136ba 100644 --- a/contracts/tests/ccip/feequoter/FeeQuoter.updatePrices.spec.ts +++ b/contracts/tests/ccip/feequoter/FeeQuoter.updatePrices.spec.ts @@ -319,6 +319,35 @@ describe('FeeQuoter UpdatePrices', () => { }) }) + it('should not end up with lower balance than initial balance after returning excess', async () => { + const contract = await blockchain.getContract(setup.bind.feeQuoter.address) + const initialBalance = contract.balance + + const priceUpdates: feeQuoter.PriceUpdates = { + tokenPricesUpdates: [{ token: FeeQuoterSetup.NATIVE_TON.token, price: 4000000000000000000n }], + gasPricesUpdates: [], + } + + const updateResult = await setup.bind.feeQuoter.sendUpdatePrices(setup.acc.owner.getSender(), { + value: toNano('0.01'), + msg: { updates: priceUpdates, sendExcessesTo: setup.acc.deployer.address }, + }) + + expect(updateResult.transactions).toHaveTransaction({ + to: setup.bind.feeQuoter.address, + success: true, + }) + + expect(updateResult.transactions).toHaveTransaction({ + from: setup.bind.feeQuoter.address, + to: setup.acc.deployer.address, + success: true, + }) + + const finalBalance = (await blockchain.getContract(setup.bind.feeQuoter.address)).balance + expect(finalBalance).toEqual(initialBalance) + }) + afterAll(async () => { if (process.env['COVERAGE'] === 'true') { const testSuitePrefix = 'feeQuoter_update_prices_suite' From 0ddf173d7b52c2f3b75ed34ac4baeb03cff3184a Mon Sep 17 00:00:00 2001 From: vicente Date: Wed, 25 Feb 2026 18:04:31 -0300 Subject: [PATCH 2/5] bump value attached to UpdatePrices --- contracts/contracts/ccip/fee_quoter/messages.tolk | 2 +- pkg/ccip/ocr/config.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/contracts/ccip/fee_quoter/messages.tolk b/contracts/contracts/ccip/fee_quoter/messages.tolk index 4a76ffa2a..7b23856fb 100644 --- a/contracts/contracts/ccip/fee_quoter/messages.tolk +++ b/contracts/contracts/ccip/fee_quoter/messages.tolk @@ -80,5 +80,5 @@ fun FeeQuoter_Costs.GetValidatedFee(): int { fun FeeQuoter_Costs.updatePrices(): int { // when we support token transfers the message value amount should depend on the quantity of supported tokens - return ton("0.01"); + return ton("0.02"); } diff --git a/pkg/ccip/ocr/config.go b/pkg/ccip/ocr/config.go index 35a5630f6..61a25da6b 100644 --- a/pkg/ccip/ocr/config.go +++ b/pkg/ccip/ocr/config.go @@ -16,8 +16,8 @@ type Config struct { } var DefaultConfigSet = Config{ - CommitPriceUpdateOnlyCostTON: 0.03, - CommitPriceAndRootCostTON: 0.05, + CommitPriceUpdateOnlyCostTON: 0.04, + CommitPriceAndRootCostTON: 0.06, ExecuteCostTON: 0.085, } From c7eb6e963dabd9d7a83973ba3eb2a157fc8c9bd4 Mon Sep 17 00:00:00 2001 From: vicente Date: Wed, 25 Feb 2026 19:18:14 -0300 Subject: [PATCH 3/5] update migrate function --- contracts/contracts/ccip/fee_quoter/contract.tolk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contracts/contracts/ccip/fee_quoter/contract.tolk b/contracts/contracts/ccip/fee_quoter/contract.tolk index 661005515..93d8e2b64 100644 --- a/contracts/contracts/ccip/fee_quoter/contract.tolk +++ b/contracts/contracts/ccip/fee_quoter/contract.tolk @@ -663,7 +663,9 @@ get fun reserve(): coins { } @method_id(1000) -fun migrate(storage: cell, version: slice): cell { throw Upgradeable_Error.VersionMismatch; } +fun migrate(storage: cell, version: slice): cell { + return storage; +} @method_id(1001) fun version(): slice { return CONTRACT_VERSION; } From abe7d4db34f1fdfc9dcaa4377f40b89592a72b3b Mon Sep 17 00:00:00 2001 From: vicente Date: Thu, 26 Feb 2026 16:16:01 -0300 Subject: [PATCH 4/5] bump feequoter version and fix migrate function --- contracts/contracts/ccip/fee_quoter/contract.tolk | 3 ++- contracts/wrappers/ccip/FeeQuoter.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/contracts/contracts/ccip/fee_quoter/contract.tolk b/contracts/contracts/ccip/fee_quoter/contract.tolk index 93d8e2b64..d31724e99 100644 --- a/contracts/contracts/ccip/fee_quoter/contract.tolk +++ b/contracts/contracts/ccip/fee_quoter/contract.tolk @@ -16,7 +16,7 @@ import "../../lib/math"; import "../router/messages" import "../ccipsend_executor/messages" -const CONTRACT_VERSION = "1.6.0"; +const CONTRACT_VERSION = "1.6.1"; const RESERVE = ton("1"); // TODO: set correct value fun onInternalMessage(in: InMessage) { @@ -664,6 +664,7 @@ get fun reserve(): coins { @method_id(1000) fun migrate(storage: cell, version: slice): cell { + assert(version.bitsEqual(CONTRACT_VERSION), Upgradeable_Error.VersionMismatch); return storage; } diff --git a/contracts/wrappers/ccip/FeeQuoter.ts b/contracts/wrappers/ccip/FeeQuoter.ts index 0626499ad..22818ef44 100644 --- a/contracts/wrappers/ccip/FeeQuoter.ts +++ b/contracts/wrappers/ccip/FeeQuoter.ts @@ -29,7 +29,7 @@ import * as upgradeable from '../libraries/versioning/Upgradeable' import * as typeAndVersion from '../libraries/versioning/TypeAndVersion' import * as rt from './Router' -export const FEE_QUOTER_CONTRACT_VERSION = '1.6.0' +export const FEE_QUOTER_CONTRACT_VERSION = '1.6.1' export const FACILITY_NAME = 'link.chain.ton.ccip.FeeQuoter' export const FACILITY_ID = facilityId(crc32(FACILITY_NAME)) From 4bcae805ea78cca41967ff040ee74724ebd46bda Mon Sep 17 00:00:00 2001 From: vicente Date: Thu, 26 Feb 2026 16:45:41 -0300 Subject: [PATCH 5/5] implement migrate function for offramp --- contracts/contracts/ccip/offramp/contract.tolk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contracts/contracts/ccip/offramp/contract.tolk b/contracts/contracts/ccip/offramp/contract.tolk index 5d9bfdb8a..8c79aaea5 100644 --- a/contracts/contracts/ccip/offramp/contract.tolk +++ b/contracts/contracts/ccip/offramp/contract.tolk @@ -234,7 +234,10 @@ fun onUpgrade(msg: Upgradeable_Upgrade) { } @method_id(1000) -fun migrate(storage: cell, version: slice): cell { throw Upgradeable_Error.VersionMismatch; } +fun migrate(storage: cell, version: slice): cell { + assert(version.bitsEqual(CONTRACT_VERSION), Upgradeable_Error.VersionMismatch); + return storage; +} @method_id(1001) fun version(): slice { return CONTRACT_VERSION; }