Skip to content

Commit 57d765e

Browse files
committed
fix merge
1 parent c3dedc5 commit 57d765e

6 files changed

Lines changed: 56 additions & 51 deletions

File tree

ccv/chains/evm/deployment/v1_7_0/adapters/tokens.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ func (t *TokenAdapter) SetTokenPoolRateLimits() *cldf_ops.Sequence[tokens.TPRLRe
302302
args := []token_pool.RateLimitConfigArgs{
303303
{
304304
RemoteChainSelector: input.RemoteChainSelector,
305-
CustomBlockConfirmations: false,
305+
FastFinality: false,
306306
OutboundRateLimiterConfig: token_pool.Config{
307307
IsEnabled: input.DefaultFinalityOutboundRateLimiterConfig.IsEnabled,
308308
Capacity: input.DefaultFinalityOutboundRateLimiterConfig.Capacity,
@@ -316,7 +316,7 @@ func (t *TokenAdapter) SetTokenPoolRateLimits() *cldf_ops.Sequence[tokens.TPRLRe
316316
},
317317
{
318318
RemoteChainSelector: input.RemoteChainSelector,
319-
CustomBlockConfirmations: true,
319+
FastFinality: true,
320320
OutboundRateLimiterConfig: token_pool.Config{
321321
IsEnabled: input.CustomFinalityOutboundRateLimiterConfig.IsEnabled,
322322
Capacity: input.CustomFinalityOutboundRateLimiterConfig.Capacity,
@@ -351,8 +351,8 @@ func (t *TokenAdapter) MigrateLockReleasePoolLiquiditySequence() *cldf_ops.Seque
351351
return evm_tokens.MigrateLockReleasePoolLiquidity
352352
}
353353

354-
func (t *TokenAdapter) SetMinBlockConfirmations(e *deployment.Environment) *cldf_ops.Sequence[tokens.SetMinBlockConfirmationsSequenceInput, sequences.OnChainOutput, chain.BlockChains] {
355-
return evm_tokens.SetMinBlockConfirmationsForTokenPools
354+
func (t *TokenAdapter) SetAllowedFinalityConfig(e *deployment.Environment) *cldf_ops.Sequence[tokens.SetAllowedFinalityConfigSequenceInput, sequences.OnChainOutput, chain.BlockChains] {
355+
return evm_tokens.SetAllowedFinalityConfigForTokenPools
356356
}
357357

358358
func (t *TokenAdapter) SetTokenTransferFee(e *deployment.Environment) *cldf_ops.Sequence[tokens.SetTokenTransferFeeSequenceInput, sequences.OnChainOutput, chain.BlockChains] {
@@ -394,10 +394,10 @@ func (t *TokenAdapter) GetOnchainTokenTransferFeeConfig(e deployment.Environment
394394
}
395395

396396
return tokens.TokenTransferFeeConfig{
397-
DefaultFinalityTransferFeeBps: report.Output.DefaultBlockConfirmationsTransferFeeBps,
398-
CustomFinalityTransferFeeBps: report.Output.CustomBlockConfirmationsTransferFeeBps,
399-
DefaultFinalityFeeUSDCents: report.Output.DefaultBlockConfirmationsFeeUSDCents,
400-
CustomFinalityFeeUSDCents: report.Output.CustomBlockConfirmationsFeeUSDCents,
397+
DefaultFinalityTransferFeeBps: report.Output.FinalityTransferFeeBps,
398+
CustomFinalityTransferFeeBps: report.Output.FastFinalityTransferFeeBps,
399+
DefaultFinalityFeeUSDCents: report.Output.FinalityFeeUSDCents,
400+
CustomFinalityFeeUSDCents: report.Output.FastFinalityFeeUSDCents,
401401
DestBytesOverhead: report.Output.DestBytesOverhead,
402402
DestGasOverhead: report.Output.DestGasOverhead,
403403
IsEnabled: report.Output.IsEnabled,

ccv/chains/evm/deployment/v1_7_0/sequences/tokens/set_min_block_confirmations_for_token_pools.go renamed to ccv/chains/evm/deployment/v1_7_0/sequences/tokens/set_allowed_finality_config_for_token_pools.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,22 @@ import (
44
"fmt"
55

66
"github.com/ethereum/go-ethereum/common"
7+
cldf_chain "github.com/smartcontractkit/chainlink-deployments-framework/chain"
8+
"github.com/smartcontractkit/chainlink-deployments-framework/operations"
9+
mcms_types "github.com/smartcontractkit/mcms/types"
10+
711
"github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm/deployment/v2_0_0/operations/token_pool"
812
"github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/utils/operations/contract"
913
"github.com/smartcontractkit/chainlink-ccip/deployment/tokens"
1014
"github.com/smartcontractkit/chainlink-ccip/deployment/utils"
1115
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/sequences"
12-
cldf_chain "github.com/smartcontractkit/chainlink-deployments-framework/chain"
13-
"github.com/smartcontractkit/chainlink-deployments-framework/operations"
14-
mcms_types "github.com/smartcontractkit/mcms/types"
1516
)
1617

17-
var SetMinBlockConfirmationsForTokenPools = operations.NewSequence(
18-
"set-min-block-confirmations-for-token-pools",
18+
var SetAllowedFinalityConfigForTokenPools = operations.NewSequence(
19+
"set-finality-config-for-token-pools",
1920
utils.Version_2_0_0,
20-
"Sets the minimum block confirmations for token pools. Takes a map of pool address to min block confirmations.",
21-
func(b operations.Bundle, chains cldf_chain.BlockChains, input tokens.SetMinBlockConfirmationsSequenceInput) (sequences.OnChainOutput, error) {
21+
"Sets the finality config for token pools. Takes a map of pool address to finality configs.",
22+
func(b operations.Bundle, chains cldf_chain.BlockChains, input tokens.SetAllowedFinalityConfigSequenceInput) (sequences.OnChainOutput, error) {
2223
chain, ok := chains.EVMChains()[input.Selector]
2324
if !ok {
2425
return sequences.OnChainOutput{}, fmt.Errorf("chain with selector %d not defined", input.Selector)
@@ -37,15 +38,15 @@ var SetMinBlockConfirmationsForTokenPools = operations.NewSequence(
3738
}
3839

3940
report, err := operations.ExecuteOperation(
40-
b, token_pool.SetMinBlockConfirmations, chain,
41-
contract.FunctionInput[uint16]{
41+
b, token_pool.SetAllowedFinalityConfig, chain,
42+
contract.FunctionInput[[4]byte]{
4243
ChainSelector: src,
4344
Address: addr,
4445
Args: minBlockConfirmations,
4546
},
4647
)
4748
if err != nil {
48-
return sequences.OnChainOutput{}, fmt.Errorf("failed to execute token_pool.SetMinBlockConfirmations for pool %s on src %d: %w", pool, src, err)
49+
return sequences.OnChainOutput{}, fmt.Errorf("failed to execute token_pool.SetAllowedFinalityConfig for pool %s on src %d: %w", pool, src, err)
4950
}
5051

5152
writes = append(writes, report.Output)

ccv/chains/evm/deployment/v1_7_0/sequences/tokens/set_token_transfer_fee_config_for_token_pools.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ import (
44
"fmt"
55

66
"github.com/ethereum/go-ethereum/common"
7+
cldf_chain "github.com/smartcontractkit/chainlink-deployments-framework/chain"
8+
"github.com/smartcontractkit/chainlink-deployments-framework/operations"
9+
mcms_types "github.com/smartcontractkit/mcms/types"
10+
711
"github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm/deployment/v2_0_0/operations/token_pool"
812
"github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/utils/operations/contract"
913
"github.com/smartcontractkit/chainlink-ccip/deployment/tokens"
1014
"github.com/smartcontractkit/chainlink-ccip/deployment/utils"
1115
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/sequences"
12-
cldf_chain "github.com/smartcontractkit/chainlink-deployments-framework/chain"
13-
"github.com/smartcontractkit/chainlink-deployments-framework/operations"
14-
mcms_types "github.com/smartcontractkit/mcms/types"
1516
)
1617

1718
var SetTokenTransferFeeConfigForTokenPools = operations.NewSequence(
@@ -50,13 +51,13 @@ var SetTokenTransferFeeConfigForTokenPools = operations.NewSequence(
5051
token_pool.TokenTransferFeeConfigArgs{
5152
DestChainSelector: dst,
5253
TokenTransferFeeConfig: token_pool.TokenTransferFeeConfig{
53-
DefaultBlockConfirmationsTransferFeeBps: fee.DefaultFinalityTransferFeeBps,
54-
CustomBlockConfirmationsTransferFeeBps: fee.CustomFinalityTransferFeeBps,
55-
DefaultBlockConfirmationsFeeUSDCents: fee.DefaultFinalityFeeUSDCents,
56-
CustomBlockConfirmationsFeeUSDCents: fee.CustomFinalityFeeUSDCents,
57-
DestBytesOverhead: fee.DestBytesOverhead,
58-
DestGasOverhead: fee.DestGasOverhead,
59-
IsEnabled: fee.IsEnabled,
54+
FinalityTransferFeeBps: fee.DefaultFinalityTransferFeeBps,
55+
FastFinalityTransferFeeBps: fee.CustomFinalityTransferFeeBps,
56+
FinalityFeeUSDCents: fee.DefaultFinalityFeeUSDCents,
57+
FastFinalityFeeUSDCents: fee.CustomFinalityFeeUSDCents,
58+
DestBytesOverhead: fee.DestBytesOverhead,
59+
DestGasOverhead: fee.DestGasOverhead,
60+
IsEnabled: fee.IsEnabled,
6061
},
6162
},
6263
)

deployment/tokens/configure_tokens_for_transfers.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ import (
66

77
"github.com/Masterminds/semver/v3"
88
"github.com/ethereum/go-ethereum/common"
9+
910
chain_selectors "github.com/smartcontractkit/chain-selectors"
11+
"github.com/smartcontractkit/chainlink-deployments-framework/datastore"
12+
"github.com/smartcontractkit/chainlink-deployments-framework/deployment"
13+
cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment"
14+
cldf_ops "github.com/smartcontractkit/chainlink-deployments-framework/operations"
1015
mcms_types "github.com/smartcontractkit/mcms/types"
1116

1217
"github.com/smartcontractkit/chainlink-ccip/deployment/finality"
13-
deploy_utils "github.com/smartcontractkit/chainlink-ccip/deployment/utils"
1418
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/changesets"
1519
datastore_utils "github.com/smartcontractkit/chainlink-ccip/deployment/utils/datastore"
1620
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/mcms"
17-
"github.com/smartcontractkit/chainlink-deployments-framework/datastore"
18-
"github.com/smartcontractkit/chainlink-deployments-framework/deployment"
19-
cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment"
20-
cldf_ops "github.com/smartcontractkit/chainlink-deployments-framework/operations"
2121
)
2222

2323
// TokenTransferConfig specifies configuration for a token on one chain to enable transfers with other chains.
@@ -36,8 +36,8 @@ type TokenTransferConfig struct {
3636
// Populate the reference as needed to match the desired registry.
3737
RegistryRef datastore.AddressRef `yaml:"registryRef" json:"registryRef"`
3838
// RemoteChains specifies the remote chains to configure on the token pool.
39-
RemoteChains map[uint64]RemoteChainConfig[*datastore.AddressRef, datastore.AddressRef] `yaml:"remoteChains" json:"remoteChains"`
40-
AllowedFinalityConfig finality.Config `yaml:"allowedFinalityConfig" json:"allowedFinalityConfig"`
39+
RemoteChains map[uint64]RemoteChainConfig[*datastore.AddressRef, datastore.AddressRef] `yaml:"remoteChains" json:"remoteChains"`
40+
AllowedFinalityConfig finality.Config `yaml:"allowedFinalityConfig" json:"allowedFinalityConfig"`
4141
// LiquidityMigrationAmount, if set, specifies an exact token amount to migrate from the old pool (read from the
4242
// TokenAdminRegistry) to the new pool's lockbox. Mutually exclusive with LiquidityMigrationBasisPoints.
4343
// When either LiquidityMigrationAmount or LiquidityMigrationBasisPoints is set, a liquidity migration is triggered.

deployment/tokens/fees.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ import (
66

77
"github.com/Masterminds/semver/v3"
88
chainsel "github.com/smartcontractkit/chain-selectors"
9-
"github.com/smartcontractkit/chainlink-ccip/deployment/utils"
10-
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/changesets"
11-
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/mcms"
129
"github.com/smartcontractkit/chainlink-deployments-framework/deployment"
1310
cldf_ops "github.com/smartcontractkit/chainlink-deployments-framework/operations"
1411
mcms_types "github.com/smartcontractkit/mcms/types"
12+
13+
"github.com/smartcontractkit/chainlink-ccip/deployment/finality"
14+
"github.com/smartcontractkit/chainlink-ccip/deployment/utils"
15+
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/changesets"
16+
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/mcms"
1517
)
1618

1719
// UnresolvedTokenTransferFeeArgs allows for partial specification of token transfer fee configurations.
@@ -131,10 +133,10 @@ func setTokenTransferFeeApply() func(deployment.Environment, SetTokenTransferFee
131133
}
132134

133135
feeConfigSettings := map[string]map[uint64]*TokenTransferFeeConfig{}
134-
minBlocksSettings := map[string]uint16{}
136+
minBlocksSettings := map[string][4]byte{}
135137
for _, pool := range src.TokenPools {
136138
if minBlockConfirmations, ok := pool.MinBlockConfirmations.Get(); ok {
137-
minBlocksSettings[pool.PoolAddress] = minBlockConfirmations
139+
minBlocksSettings[pool.PoolAddress] = finality.Config{BlockDepth: minBlockConfirmations}.Raw()
138140
}
139141
if len(pool.Destinations) > 0 {
140142
feeConfigSettings[pool.PoolAddress] = map[uint64]*TokenTransferFeeConfig{}
@@ -151,15 +153,15 @@ func setTokenTransferFeeApply() func(deployment.Environment, SetTokenTransferFee
151153
if len(minBlocksSettings) > 0 {
152154
minBlocksReport, err := cldf_ops.ExecuteSequence(
153155
e.OperationsBundle,
154-
feesAdapter.SetMinBlockConfirmations(&e),
156+
feesAdapter.SetAllowedFinalityConfig(&e),
155157
e.BlockChains,
156-
SetMinBlockConfirmationsSequenceInput{
158+
SetAllowedFinalityConfigSequenceInput{
157159
Selector: src.Selector,
158160
Settings: minBlocksSettings,
159161
},
160162
)
161163
if err != nil {
162-
return deployment.ChangesetOutput{}, fmt.Errorf("failed to execute SetMinBlockConfirmations operation for src %d: %w", src.Selector, err)
164+
return deployment.ChangesetOutput{}, fmt.Errorf("failed to execute SetAllowedFinalityConfig operation for src %d: %w", src.Selector, err)
163165
}
164166
batchOps = append(batchOps, minBlocksReport.Output.BatchOps...)
165167
reports = append(reports, minBlocksReport.ExecutionReports...)

deployment/tokens/product.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@ import (
77

88
"github.com/Masterminds/semver/v3"
99

10-
"github.com/smartcontractkit/chainlink-ccip/deployment/finality"
11-
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/sequences"
1210
cldf_chain "github.com/smartcontractkit/chainlink-deployments-framework/chain"
1311
"github.com/smartcontractkit/chainlink-deployments-framework/datastore"
1412
"github.com/smartcontractkit/chainlink-deployments-framework/deployment"
1513
cldf_ops "github.com/smartcontractkit/chainlink-deployments-framework/operations"
14+
15+
"github.com/smartcontractkit/chainlink-ccip/deployment/finality"
16+
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/sequences"
1617
)
1718

1819
type tokenAdapterID string
1920

2021
// TokenFeeAdapter is an optional interface that can be implemented by TokenAdapters to support setting token transfer fee configurations.
2122
type TokenFeeAdapter interface {
22-
SetMinBlockConfirmations(e *deployment.Environment) *cldf_ops.Sequence[SetMinBlockConfirmationsSequenceInput, sequences.OnChainOutput, cldf_chain.BlockChains]
23+
SetAllowedFinalityConfig(e *deployment.Environment) *cldf_ops.Sequence[SetAllowedFinalityConfigSequenceInput, sequences.OnChainOutput, cldf_chain.BlockChains]
2324
SetTokenTransferFee(e *deployment.Environment) *cldf_ops.Sequence[SetTokenTransferFeeSequenceInput, sequences.OnChainOutput, cldf_chain.BlockChains]
2425
GetOnchainTokenTransferFeeConfig(e deployment.Environment, poolAddress string, src uint64, dst uint64) (TokenTransferFeeConfig, error)
2526
GetDefaultTokenTransferFeeConfig(src uint64, dst uint64) TokenTransferFeeConfig
@@ -168,7 +169,7 @@ type ConfigureTokenForTransfersInput struct {
168169
// ExternalAdmin is specified when we want to propose an admin that we don't control.
169170
ExternalAdmin string
170171
// RegistryAddress is the address of the contract on which the token pool must be registered.
171-
RegistryAddress string
172+
RegistryAddress string
172173
AllowedFinalityConfig finality.Config
173174
// LiquidityMigrationAmount, if set, specifies an exact token amount to migrate from the old pool
174175
// to the new pool's lockbox. Mutually exclusive with LiquidityMigrationBasisPoints.
@@ -189,10 +190,10 @@ type ConfigureTokenForTransfersInput struct {
189190
TokenRef datastore.AddressRef
190191
}
191192

192-
// SetMinBlockConfirmationsSequenceInput defines the input for setting the minimum block confirmations on a V2 token pool.
193-
type SetMinBlockConfirmationsSequenceInput struct {
194-
// Settings are provided as a map of pool address to minimum block confirmations.
195-
Settings map[string]uint16 `json:"settings" yaml:"settings"`
193+
// SetAllowedFinalityConfigSequenceInput defines the input for setting the allowed finality config on a V2 token pool.
194+
type SetAllowedFinalityConfigSequenceInput struct {
195+
// Settings are provided as a map of pool address to finality config.
196+
Settings map[string][4]byte `json:"settings" yaml:"settings"`
196197
// Selector is the chain selector for the chain on which to set the minimum block confirmations.
197198
Selector uint64 `json:"selector" yaml:"selector"`
198199
}

0 commit comments

Comments
 (0)