Skip to content

Commit 17d5829

Browse files
committed
update tokenPriceStalenessThreshold type on-chain to uint32
1 parent a0c563c commit 17d5829

File tree

5 files changed

+5
-11
lines changed

5 files changed

+5
-11
lines changed

contracts/contracts/ccip/fee_quoter/contract.tolk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ get fun destChainConfig(destChainSelector: uint64): DestChainConfig {
602602
return st.destChainConfigs.mustGet(destChainSelector, FeeQuoter_Error.DestChainNotEnabled as int);
603603
}
604604

605-
get fun staticConfig(): (uint96, address, uint64) {
605+
get fun staticConfig(): (uint96, address, uint32) {
606606
val st = lazy Storage.load();
607607
return (st.maxFeeJuelsPerMsg, st.linkToken, st.tokenPriceStalenessThreshold);
608608
}

contracts/contracts/ccip/fee_quoter/storage.tolk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ struct Storage {
88

99
maxFeeJuelsPerMsg: uint96;
1010
linkToken: address;
11-
tokenPriceStalenessThreshold: uint64;
11+
tokenPriceStalenessThreshold: uint32;
1212

1313
// NOTE: usdPerUnitGasByDestChain is on DestChainConfig instead (same as Solana)
1414
usdPerToken: map<address, TimestampedPrice>;

pkg/ccip/bindings/feequoter/fee_quoter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ type StaticConfig struct {
311311
MaxFeeJuelsPerMsg *big.Int
312312
LinkToken *address.Address
313313
// TODO: Consider changing to uint32 for EVM compatibility once on-chain is updated.
314-
StalenessThreshold uint64
314+
StalenessThreshold uint32
315315
}
316316

317317
// Deprecated: Use GetStaticConfig getter instead.

pkg/ccip/bindings/feequoter/reader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ var GetStaticConfig = tvm.NewNoArgsGetter(tvm.NoArgsOpts[StaticConfig]{
197197
return StaticConfig{
198198
MaxFeeJuelsPerMsg: maxFeeJuelsPerMsg,
199199
LinkToken: linkTokenAddress,
200-
StalenessThreshold: tokenPriceStalenessThreshold.Uint64(),
200+
StalenessThreshold: uint32(tokenPriceStalenessThreshold.Uint64()),
201201
}, nil
202202
}),
203203
})

pkg/ccip/chainaccessor/config.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"errors"
66
"fmt"
7-
"math"
87
"math/big"
98

109
"github.com/xssnick/tonutils-go/address"
@@ -214,15 +213,10 @@ func (a *TONAccessor) GetFeeQuoterStaticConfig(ctx context.Context, block *ton.B
214213
if err != nil {
215214
return ccipocr3.FeeQuoterStaticConfig{}, err
216215
}
217-
// TODO: The on-chain stores tokenPriceStalenessThreshold as uint64, but ccipocr3.FeeQuoterStaticConfig
218-
// expects uint32 for EVM compatibility. Consider changing on-chain to uint32.
219-
if cfg.StalenessThreshold > math.MaxUint32 {
220-
return ccipocr3.FeeQuoterStaticConfig{}, fmt.Errorf("staleness threshold %d overflows uint32", cfg.StalenessThreshold)
221-
}
222216
return ccipocr3.FeeQuoterStaticConfig{
223217
MaxFeeJuelsPerMsg: ccipocr3.NewBigInt(cfg.MaxFeeJuelsPerMsg),
224218
LinkToken: addrToBytes(cfg.LinkToken),
225-
StalenessThreshold: uint32(cfg.StalenessThreshold),
219+
StalenessThreshold: cfg.StalenessThreshold,
226220
}, nil
227221
}
228222

0 commit comments

Comments
 (0)