Skip to content

Commit

Permalink
Replacing with Mergo
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusz-sekara committed Feb 27, 2025
1 parent 88a2f8f commit 7b26c04
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 73 deletions.
8 changes: 4 additions & 4 deletions deployment/ccip/changeset/testhelpers/test_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,8 @@ func AddCCIPContractsToEnvironment(t *testing.T, allChains []uint64, tEnv TestEn
}
return ocrParams
}
commitOCRConfigs[chain] = v1_6.DeriveOCRParamsForCommit(v1_6.SimulationTest, e.FeedChainSel, tokenConfig.GetTokenInfo(e.Env.Logger, linkTokenAddr, state.Chains[chain].Weth9.Address()), ocrOverride)
execOCRConfigs[chain] = v1_6.DeriveOCRParamsForExec(v1_6.SimulationTest, tokenDataProviders, ocrOverride)
commitOCRConfigs[chain] = v1_6.DeriveOCRParamsForCommit(v1_6.Default, e.FeedChainSel, tokenConfig.GetTokenInfo(e.Env.Logger, linkTokenAddr, state.Chains[chain].Weth9.Address()), ocrOverride)
execOCRConfigs[chain] = v1_6.DeriveOCRParamsForExec(v1_6.Default, tokenDataProviders, ocrOverride)
chainConfigs[chain] = v1_6.ChainConfig{
Readers: nodeInfo.NonBootstraps().PeerIDs(),
FChain: uint8(len(nodeInfo.NonBootstraps().PeerIDs()) / 3),
Expand All @@ -705,8 +705,8 @@ func AddCCIPContractsToEnvironment(t *testing.T, allChains []uint64, tEnv TestEn

for _, chain := range solChains {
ocrOverride := tc.OCRConfigOverride
commitOCRConfigs[chain] = v1_6.DeriveOCRParamsForCommit(v1_6.SimulationTest, e.FeedChainSel, nil, ocrOverride)
execOCRConfigs[chain] = v1_6.DeriveOCRParamsForExec(v1_6.SimulationTest, tokenDataProviders, ocrOverride)
commitOCRConfigs[chain] = v1_6.DeriveOCRParamsForCommit(v1_6.Default, e.FeedChainSel, nil, ocrOverride)
execOCRConfigs[chain] = v1_6.DeriveOCRParamsForExec(v1_6.Default, tokenDataProviders, ocrOverride)
chainConfigs[chain] = v1_6.ChainConfig{
Readers: nodeInfo.NonBootstraps().PeerIDs(),
// #nosec G115 - Overflow is not a concern in this test scenario
Expand Down
53 changes: 0 additions & 53 deletions deployment/ccip/changeset/v1_6/config.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
package v1_6

import (
"time"

chain_selectors "github.com/smartcontractkit/chain-selectors"

"github.com/smartcontractkit/chainlink-common/pkg/config"
"github.com/smartcontractkit/chainlink-common/pkg/merklemulti"

"github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3"
"github.com/smartcontractkit/chainlink-ccip/pluginconfig"

"github.com/smartcontractkit/chainlink/deployment/ccip/changeset/globals"
"github.com/smartcontractkit/chainlink/deployment/common/types"
)

var (
Expand All @@ -35,56 +29,13 @@ var (
OCRParameters: globals.ExecOCRParamsForEthereum,
ExecuteOffChainConfig: &globals.DefaultExecuteOffChainCfg,
}

// Used for only testing with simulated chains
OcrParamsForTest = CCIPOCRParams{
OCRParameters: types.OCRParameters{
DeltaProgress: 10 * time.Second,
DeltaResend: 10 * time.Second,
DeltaInitial: 20 * time.Second,
DeltaRound: 2 * time.Second,
DeltaGrace: 2 * time.Second,
DeltaCertifiedCommitRequest: 10 * time.Second,
DeltaStage: 10 * time.Second,
Rmax: 50,
MaxDurationQuery: 10 * time.Second,
MaxDurationObservation: 10 * time.Second,
MaxDurationShouldAcceptAttestedReport: 10 * time.Second,
MaxDurationShouldTransmitAcceptedReport: 10 * time.Second,
},
CommitOffChainConfig: &pluginconfig.CommitOffchainConfig{
RemoteGasPriceBatchWriteFrequency: *config.MustNewDuration(globals.RemoteGasPriceBatchWriteFrequency),
TokenPriceBatchWriteFrequency: *config.MustNewDuration(globals.TokenPriceBatchWriteFrequency),
NewMsgScanBatchSize: merklemulti.MaxNumberTreeLeaves,
MaxReportTransmissionCheckAttempts: 5,
RMNEnabled: false,
RMNSignaturesTimeout: 30 * time.Minute,
MaxMerkleTreeSize: merklemulti.MaxNumberTreeLeaves,
SignObservationPrefix: "chainlink ccip 1.6 rmn observation",
MerkleRootAsyncObserverDisabled: false,
MerkleRootAsyncObserverSyncFreq: 4 * time.Second,
MerkleRootAsyncObserverSyncTimeout: 12 * time.Second,
ChainFeeAsyncObserverSyncFreq: 10 * time.Second,
ChainFeeAsyncObserverSyncTimeout: 12 * time.Second,
},
ExecuteOffChainConfig: &pluginconfig.ExecuteOffchainConfig{
BatchGasLimit: globals.BatchGasLimit,
InflightCacheExpiry: *config.MustNewDuration(globals.InflightCacheExpiry),
RootSnoozeTime: *config.MustNewDuration(globals.RootSnoozeTime),
MessageVisibilityInterval: *config.MustNewDuration(globals.PermissionLessExecutionThreshold),
BatchingStrategyID: globals.BatchingStrategyID,
},
}
)

type OCRConfigChainType int

const (
Default OCRConfigChainType = iota + 1
Ethereum
// SimulationTest is kept only for backward compatibility. Tests probably should
// migrate to using Default or Ethereum
SimulationTest
)

func DeriveOCRConfigTypeFromSelector(chainsel uint64) OCRConfigChainType {
Expand All @@ -104,8 +55,6 @@ func (c OCRConfigChainType) CommitOCRParams() CCIPOCRParams {
return DefaultOCRParamsForCommitForETH.Copy()
case Default:
return DefaultOCRParamsForCommitForNonETH.Copy()
case SimulationTest:
return OcrParamsForTest.Copy()
default:
panic("unknown OCRConfigChainType")
}
Expand All @@ -117,8 +66,6 @@ func (c OCRConfigChainType) ExecuteOCRParams() CCIPOCRParams {
return DefaultOCRParamsForExecForETH.Copy()
case Default:
return DefaultOCRParamsForExecForNonETH.Copy()
case SimulationTest:
return OcrParamsForTest.Copy()
default:
panic("unknown OCRConfigChainType")
}
Expand Down
4 changes: 2 additions & 2 deletions deployment/ccip/changeset/v1_6/cs_active_candidate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func Test_ActiveCandidate(t *testing.T) {
{
// NOTE: this is technically not a new chain, but needed for validation.
OCRConfigPerRemoteChainSelector: map[uint64]v1_6.CCIPOCRParams{
dest: v1_6.DeriveOCRParamsForCommit(v1_6.SimulationTest, tenv.FeedChainSel, tokenConfig.GetTokenInfo(logger.TestLogger(t),
dest: v1_6.DeriveOCRParamsForCommit(v1_6.Default, tenv.FeedChainSel, tokenConfig.GetTokenInfo(logger.TestLogger(t),
state.Chains[dest].LinkToken.Address(),
state.Chains[dest].Weth9.Address()), nil),
},
Expand All @@ -219,7 +219,7 @@ func Test_ActiveCandidate(t *testing.T) {
{
// NOTE: this is technically not a new chain, but needed for validation.
OCRConfigPerRemoteChainSelector: map[uint64]v1_6.CCIPOCRParams{
dest: v1_6.DeriveOCRParamsForExec(v1_6.SimulationTest, nil, nil),
dest: v1_6.DeriveOCRParamsForExec(v1_6.Default, nil, nil),
},
PluginType: types.PluginTypeCCIPExec,
},
Expand Down
14 changes: 7 additions & 7 deletions deployment/ccip/changeset/v1_6/cs_ccip_home_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestInvalidOCR3Params(t *testing.T) {
require.NoError(t, err)
nodes, err := deployment.NodeInfo(e.Env.NodeIDs, e.Env.Offchain)
require.NoError(t, err)
params := v1_6.DeriveOCRParamsForCommit(v1_6.SimulationTest, e.FeedChainSel, nil, nil)
params := v1_6.DeriveOCRParamsForCommit(v1_6.Default, e.FeedChainSel, nil, nil)

// tweak params to have invalid config
// make DeltaRound greater than DeltaProgress
Expand Down Expand Up @@ -268,15 +268,15 @@ func Test_SetCandidate(t *testing.T) {
PluginInfo: []v1_6.SetCandidatePluginInfo{
{
OCRConfigPerRemoteChainSelector: map[uint64]v1_6.CCIPOCRParams{
dest: v1_6.DeriveOCRParamsForCommit(v1_6.SimulationTest, tenv.FeedChainSel, tokenConfig.GetTokenInfo(logger.TestLogger(t),
dest: v1_6.DeriveOCRParamsForCommit(v1_6.Default, tenv.FeedChainSel, tokenConfig.GetTokenInfo(logger.TestLogger(t),
state.Chains[dest].LinkToken.Address(),
state.Chains[dest].Weth9.Address()), nil),
},
PluginType: types.PluginTypeCCIPCommit,
},
{
OCRConfigPerRemoteChainSelector: map[uint64]v1_6.CCIPOCRParams{
dest: v1_6.DeriveOCRParamsForExec(v1_6.SimulationTest, nil, func(params v1_6.CCIPOCRParams) v1_6.CCIPOCRParams {
dest: v1_6.DeriveOCRParamsForExec(v1_6.Default, nil, func(params v1_6.CCIPOCRParams) v1_6.CCIPOCRParams {
dCfg, err := state.Chains[dest].OffRamp.GetDynamicConfig(&bind.CallOpts{
Context: ctx,
})
Expand Down Expand Up @@ -315,15 +315,15 @@ func Test_SetCandidate(t *testing.T) {
PluginInfo: []v1_6.SetCandidatePluginInfo{
{
OCRConfigPerRemoteChainSelector: map[uint64]v1_6.CCIPOCRParams{
dest: v1_6.DeriveOCRParamsForCommit(v1_6.SimulationTest, tenv.FeedChainSel, tokenConfig.GetTokenInfo(logger.TestLogger(t),
dest: v1_6.DeriveOCRParamsForCommit(v1_6.Default, tenv.FeedChainSel, tokenConfig.GetTokenInfo(logger.TestLogger(t),
state.Chains[dest].LinkToken.Address(),
state.Chains[dest].Weth9.Address()), nil),
},
PluginType: types.PluginTypeCCIPCommit,
},
{
OCRConfigPerRemoteChainSelector: map[uint64]v1_6.CCIPOCRParams{
dest: v1_6.DeriveOCRParamsForExec(v1_6.SimulationTest, nil, nil),
dest: v1_6.DeriveOCRParamsForExec(v1_6.Default, nil, nil),
},
PluginType: types.PluginTypeCCIPExec,
},
Expand Down Expand Up @@ -426,15 +426,15 @@ func Test_RevokeCandidate(t *testing.T) {
PluginInfo: []v1_6.SetCandidatePluginInfo{
{
OCRConfigPerRemoteChainSelector: map[uint64]v1_6.CCIPOCRParams{
dest: v1_6.DeriveOCRParamsForCommit(v1_6.SimulationTest, tenv.FeedChainSel, tokenConfig.GetTokenInfo(logger.TestLogger(t),
dest: v1_6.DeriveOCRParamsForCommit(v1_6.Default, tenv.FeedChainSel, tokenConfig.GetTokenInfo(logger.TestLogger(t),
state.Chains[dest].LinkToken.Address(),
state.Chains[dest].Weth9.Address()), nil),
},
PluginType: types.PluginTypeCCIPCommit,
},
{
OCRConfigPerRemoteChainSelector: map[uint64]v1_6.CCIPOCRParams{
dest: v1_6.DeriveOCRParamsForExec(v1_6.SimulationTest, nil, nil),
dest: v1_6.DeriveOCRParamsForExec(v1_6.Default, nil, nil),
},
PluginType: types.PluginTypeCCIPExec,
},
Expand Down
2 changes: 1 addition & 1 deletion deployment/ccip/changeset/v1_6/cs_chain_contracts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ func TestSetOCR3ConfigValidations(t *testing.T) {
wrongChainConfigs := make(map[uint64]v1_6.ChainConfig)
commitOCRConfigs := make(map[uint64]v1_6.CCIPOCRParams)
for _, chain := range allChains {
commitOCRConfigs[chain] = v1_6.DeriveOCRParamsForCommit(v1_6.SimulationTest, e.FeedChainSel, nil, nil)
commitOCRConfigs[chain] = v1_6.DeriveOCRParamsForCommit(v1_6.Default, e.FeedChainSel, nil, nil)
// set wrong chain config with incorrect value of FChain
wrongChainConfigs[chain] = v1_6.ChainConfig{
Readers: envNodes.NonBootstraps().PeerIDs(),
Expand Down
2 changes: 1 addition & 1 deletion deployment/ccip/changeset/v1_6/cs_home_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func TestAddDonAfterRemoveDons(t *testing.T) {
break
}
}
ocrConfigs[donRemovedForChain] = v1_6.DeriveOCRParamsForCommit(v1_6.SimulationTest, e.FeedChainSel, nil, nil)
ocrConfigs[donRemovedForChain] = v1_6.DeriveOCRParamsForCommit(v1_6.Default, e.FeedChainSel, nil, nil)
// try to add the another don
e.Env, err = commoncs.Apply(t, e.Env, nil,
commoncs.Configure(
Expand Down
6 changes: 1 addition & 5 deletions deployment/environment/crib/ccip_deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,7 @@ func mustOCR(e *deployment.Environment, homeChainSel uint64, feedChainSel uint64
var commitOCRConfigPerSelector = make(map[uint64]v1_6.CCIPOCRParams)
var execOCRConfigPerSelector = make(map[uint64]v1_6.CCIPOCRParams)
// Should be configured in the future based on the load test scenario
// chainType := v1_6.Default

// TODO Passing SimulationTest to reduce number of changes in the CRIB (load test setup)
// @Austin please flip it back to Default once we reach a stable state
chainType := v1_6.SimulationTest
chainType := v1_6.Default
for selector := range e.Chains {
commitOCRConfigPerSelector[selector] = v1_6.DeriveOCRParamsForCommit(chainType, feedChainSel, nil, nil)
execOCRConfigPerSelector[selector] = v1_6.DeriveOCRParamsForExec(chainType, nil, nil)
Expand Down

0 comments on commit 7b26c04

Please sign in to comment.