Skip to content

Adding changes needed for the SetTokenTransferFee Update#1836

Open
sowgandhi11 wants to merge 14 commits intomainfrom
fix/set-token-transfer-fee-fq2.0
Open

Adding changes needed for the SetTokenTransferFee Update#1836
sowgandhi11 wants to merge 14 commits intomainfrom
fix/set-token-transfer-fee-fq2.0

Conversation

@sowgandhi11
Copy link

  • Removed the upper bound for identifying the latest FQ address

  • Returning the AddressRef data for the FeeQuoter

  • Added a new method GetFeeContractRef(e cldf.Environment, src uint64, dst uint64) (AddressRef, error)

  • Added a fees.go adapter implementation for CCIP 2.0

@github-actions
Copy link

👋 sowgandhi11, 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
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 updates the fee deployment flow to support SetTokenTransferFee across newer CCIP FeeQuoter versions by (a) discovering the deployed fee contract/version from the datastore, (b) returning AddressRef for fee contracts, and (c) adding an EVM CCIP 2.0 fee adapter implementation.

Changes:

  • Extend the FeeAdapter interface with GetFeeContractRef(...) (datastore.AddressRef, error) and update EVM adapters to return AddressRef data.
  • Update the SetTokenTransferFee changeset to select an adapter based on the discovered on-chain fee contract version.
  • Add a CCIP 2.0 EVM fees adapter and adjust v1.6 FeeQuoter “latest address” selection logic.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
deployment/fees/set_token_transfer_fee.go Selects fee adapter based on discovered fee contract ref/version before executing the update sequence.
deployment/fees/product.go Extends FeeAdapter interface to expose fee contract AddressRef.
chains/evm/deployment/v2_0_0/adapters/fees.go New CCIP 2.0 EVM fees adapter implementation (FeeQuoter-based).
chains/evm/deployment/v1_6_0/sequences/adapter.go Updates FeeQuoter “latest version” selection to remove the previous upper bound.
chains/evm/deployment/v1_5_0/adapters/fees.go Updates v1.5 fee adapter to return a fee contract AddressRef (OnRamp-based).
Comments suppressed due to low confidence (1)

deployment/fees/set_token_transfer_fee.go:132

  • inferTokenTransferFeeArgs is called with adapter (resolved from cfg.Version), but the actual sequence execution uses updater (resolved from the on-chain fee contract ref version). If cfg.Version differs from the deployed contract version, inference may query the wrong ABI/contract and fail or infer incorrect defaults. Consider selecting a single adapter based on the discovered contract ref version and using it consistently for inference and updates (or error if versions disagree).
				settings[dst.Selector] = map[string]*TokenTransferFeeArgs{}
				for _, feeCfg := range dst.Settings {
					if args, err := inferTokenTransferFeeArgs(adapter, e, src.Selector, dst.Selector, feeCfg); err != nil {
						return cldf.ChangesetOutput{}, fmt.Errorf("failed to infer token transfer fee args for token %s: %w", feeCfg.Address, err)
					} else {

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

@sowgandhi11 sowgandhi11 marked this pull request as ready for review March 13, 2026 15:57
@sowgandhi11 sowgandhi11 requested a review from a team as a code owner March 13, 2026 15:57
@github-actions
Copy link

Metric fix/set-token-transfer-fee-fq2.0 main
Coverage 70.1% 69.8%

version *semver.Version
adapter FeeAdapter
settings map[uint64]map[string]*TokenTransferFeeArgs
}{}
Copy link
Collaborator

Choose a reason for hiding this comment

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

mind if we add a type for this under line 102?

batchOps := make([]mcms_types.BatchOperation, 0)
reports := make([]cldf_ops.Report[any, any], 0)

type FeeGroup struct {
	version  *semver.Version
	adapter  FeeAdapter
	settings map[uint64]map[string]*TokenTransferFeeArgs
}

// ...

versionGroups := map[string]FeeGroup{}

Comment on lines +120 to +121
for dst, dstCfg := range input.Settings {

Copy link
Collaborator

Choose a reason for hiding this comment

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

small nit: is it possible to revert the formatting changes on this so the diff is smaller? For context, sometimes when debugging we need to look at past PRs to see where the issue got introduced and having a smaller diff always helps!


feeContractRef, err := adapter.GetFeeContractRef(e, src.Selector, dst.Selector)
if err != nil {
return cldf.ChangesetOutput{}, fmt.Errorf("failed to get fee contract ref for src %d and dst %d: %w", src.Selector, src.Settings[0].Selector, err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return cldf.ChangesetOutput{}, fmt.Errorf("failed to get fee contract ref for src %d and dst %d: %w", src.Selector, src.Settings[0].Selector, err)
return cldf.ChangesetOutput{}, fmt.Errorf("failed to get fee contract ref for src %d and dst %d: %w", src.Selector, dst.Selector, err)

adapter FeeAdapter
settings map[uint64]map[string]*TokenTransferFeeArgs
}{
version: feeContractRef.Version,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this field used/needed? If so, should we be storing lookupVersion here?

)

if err != nil {
return datastore.AddressRef{}, fmt.Errorf("failed to find FeeQuoter address ref for chain selector %d: %w", src, err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return datastore.AddressRef{}, fmt.Errorf("failed to find FeeQuoter address ref for chain selector %d: %w", src, err)
return datastore.AddressRef{}, fmt.Errorf("failed to find EVM2EVMOnRamp address ref for chain selector %d: %w", src, err)

Comment on lines +171 to +172
ChainSelector: input.Selector,
ExistingAddresses: []datastore.AddressRef{fqRef},
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we need to pass more things here right? i.e. updatesByChain?

Comment on lines +40 to +50
feecontractref := e.DataStore.Addresses().Filter(
datastore.AddressRefByAddress(solana.PublicKeyFromBytes(fqAddr).String()),
datastore.AddressRefByType(datastore.ContractType(fee_quoter_operations.ContractType)),
datastore.AddressRefByChainSelector(src),
)

if len(feecontractref) == 0 {
return datastore.AddressRef{}, fmt.Errorf("no address ref found for FeeQuoter contract at address %s on chain selector %d", fqAddr, src)
}

return feecontractref[0], nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably meant to use FindAndFormatRef?

Address: common.BytesToAddress(fqAddr).Hex(),
ChainSelector: src,
}
feecontractref, err := datastore_utils.FindAndFormatRef(
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: camel case

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