Conversation
| AllowedPriceUpdaters *cell.Dictionary `tlb:"dict 267"` | ||
| MaxFeeJuelsPerMsg *big.Int `tlb:"## 96"` | ||
| LinkToken *address.Address `tlb:"addr"` | ||
| // TODO: Consider changing to uint32 for EVM compatibility. Currently uint64 on-chain. |
There was a problem hiding this comment.
@vicentevieytes why are we using uint64 on-chain for TokenPriceStalenessThreshold ?
There was a problem hiding this comment.
Pull request overview
This PR addresses inconsistencies between the Go bindings and on-chain TON contract schemas by updating TLB (Type-Length-Value) encodings, opcodes, and error codes to match the current on-chain implementation.
Changes:
- Updated TLB opcodes and field encodings (Context, FeeToken, PendingOwner, TokenAmount) to match on-chain schema changes
- Added comprehensive input validation and error handling to PackGasPrice/UnpackGasPrice functions with nil checks, negative value checks, and bit overflow checks
- Restructured types to eliminate duplication by reusing feequoter package types in ccipsendexecutor, and updated UpdateTokenTransferFeeConfig to match on-chain dictionary format
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/ccip/codec/commitcodec.go | Updated to handle new error returns from PackGasPrice/UnpackGasPrice functions |
| pkg/ccip/chainaccessor/ton_accessor.go | Added error handling for PackGasPrice calls |
| pkg/ccip/chainaccessor/config.go | Added overflow check for uint64 to uint32 conversion of StalenessThreshold |
| pkg/ccip/bindings/router/router.go | Changed TokenAmount.Amount from *big.Int to tlb.Coins and FeeToken to optional address |
| pkg/ccip/bindings/ownable2step/storage.go | Updated PendingOwner encoding to use "maybe addr" for optional addresses |
| pkg/ccip/bindings/onramp/onramp_test.go | Added test cases to verify CRC32 values for event topics |
| pkg/ccip/bindings/onramp/onramp.go | Updated event topics, renamed structs, removed obsolete WithdrawJettons, and fixed WithdrawFeeTokens encoding |
| pkg/ccip/bindings/offramp/offramp.go | Updated error codes by renaming ErrorSenderIsNotRouter to ErrorInsufficientFee and adding ErrorTooManyMessagesInReport |
| pkg/ccip/bindings/offramp/exitcode_string.go | Regenerated string representations for updated error codes |
| pkg/ccip/bindings/feequoter/reader.go | Updated StalenessThreshold type from uint32 to uint64 and added documentation for GetDestChainConfig |
| pkg/ccip/bindings/feequoter/gaspriceutils_test.go | Added comprehensive error case tests for PackGasPrice/UnpackGasPrice and renamed helper function |
| pkg/ccip/bindings/feequoter/gaspriceutils.go | Added input validation with error returns for nil, negative, and bit overflow checks |
| pkg/ccip/bindings/feequoter/fee_quoter.go | Updated Context field encoding, restructured UpdateTokenTransferFeeConfig, and added documentation |
| pkg/ccip/bindings/ccipsendexecutor/ccipsendexecutor.go | Removed duplicate types and reused feequoter package types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -104,6 +87,6 @@ type StateOnGoingFeeValidation struct { | |||
|
|
|||
| // TokenAmount structure (reused from router package concept) | |||
There was a problem hiding this comment.
The struct name 'TokenAmount' is confusing because it appears in multiple packages (router, ccipsendexecutor) with the same name but potentially different purposes. Consider adding a package-specific prefix (e.g., ExecutorTokenAmount) or documenting why this duplicates the router.TokenAmount type instead of reusing it.
| // TokenAmount structure (reused from router package concept) | |
| // TokenAmount represents an amount of a given token for the CCIP Send Executor. | |
| // It intentionally mirrors the schema and naming of router.TokenAmount instead of | |
| // reusing that type directly, to keep this bindings package self-contained and to | |
| // match the on-chain / TLB schema for executor messages. |
|
Hey @patricios-space, can you help review these off-chain bindings updates |
fcb92d9 to
a0c563c
Compare
| // | ||
| // NOTE: This Go type is named "DestChainConfig" but corresponds to the on-chain "FeeQuoterDestChainConfig" | ||
| // struct (see contracts/contracts/ccip/fee_quoter/types.tolk). The on-chain "DestChainConfig" is a larger | ||
| // struct that wraps FeeQuoterDestChainConfig along with usdPerUnitGas and tokenTransferFeeConfigs fields. |
There was a problem hiding this comment.
Thanks for the comment - imo this is super confusing and the naming is not best we can do.
krebernisak
left a comment
There was a problem hiding this comment.
Looks good! Needs CI fix.
| Value *tlb.Coins `tlb:"."` | ||
| } | ||
|
|
||
| type WithdrawJettons struct { |
There was a problem hiding this comment.
This was stale/unused, right?
Summary