Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion contracts/contracts/ccip/fee_quoter/contract.tolk
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,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 {
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/ccip/fee_quoter/messages.tolk
Original file line number Diff line number Diff line change
Expand Up @@ -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.03");
}
29 changes: 29 additions & 0 deletions contracts/tests/ccip/feequoter/FeeQuoter.updatePrices.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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

})

afterAll(async () => {
if (process.env['COVERAGE'] === 'true') {
const testSuitePrefix = 'feeQuoter_update_prices_suite'
Expand Down
4 changes: 2 additions & 2 deletions pkg/ccip/ocr/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ type Config struct {
}

var DefaultConfigSet = Config{
CommitPriceUpdateOnlyCostTON: 0.03,
CommitPriceAndRootCostTON: 0.05,
CommitPriceUpdateOnlyCostTON: 0.05,
CommitPriceAndRootCostTON: 0.07,
ExecuteCostTON: 0.085,
}

Expand Down
Loading