Skip to content

Commit

Permalink
fix home chain reader test
Browse files Browse the repository at this point in the history
  • Loading branch information
makramkd committed Aug 6, 2024
1 parent 920798c commit 9293aba
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions core/capabilities/ccip/ccip_integration_tests/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ func (h *homeChain) AddDON(
RootSnoozeTime: *commonconfig.MustNewDuration(RootSnoozeTime),
BatchingStrategyID: BatchingStrategyID,
})
require.NoError(t, err2)
}
signers, transmitters, f, _, offchainConfigVersion, offchainConfig, err := ocr3confighelper.ContractSetConfigArgsForTests(

Check failure on line 495 in core/capabilities/ccip/ccip_integration_tests/helpers.go

View workflow job for this annotation

GitHub Actions / lint

shadow: declaration of "f" shadows declaration at line 458 (govet)
DeltaProgress,
Expand Down
23 changes: 19 additions & 4 deletions core/capabilities/ccip/ccip_integration_tests/home_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

libocrtypes "github.com/smartcontractkit/libocr/ragep2p/types"

"github.com/smartcontractkit/chainlink-ccip/chainconfig"
ccipreader "github.com/smartcontractkit/chainlink-ccip/pkg/reader"

cciptypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccipocr3"
Expand All @@ -35,15 +36,22 @@ func TestHomeChainReader(t *testing.T) {
p2pIDs := integrationhelpers.P2pIDsFromInts(arr)
uni.AddCapability(p2pIDs)
//==============================Apply configs to Capability Contract=================================
chainAConf := integrationhelpers.SetupConfigInfo(integrationhelpers.ChainA, p2pIDs, integrationhelpers.FChainA, []byte("ChainA"))
chainBConf := integrationhelpers.SetupConfigInfo(integrationhelpers.ChainB, p2pIDs[1:], integrationhelpers.FChainB, []byte("ChainB"))
chainCConf := integrationhelpers.SetupConfigInfo(integrationhelpers.ChainC, p2pIDs[2:], integrationhelpers.FChainC, []byte("ChainC"))
encodedChainConfig, err := chainconfig.EncodeChainConfig(chainconfig.ChainConfig{
GasPriceDeviationPPB: cciptypes.NewBigIntFromInt64(1000),
DAGasPriceDeviationPPB: cciptypes.NewBigIntFromInt64(1_000_000),
FinalityDepth: -1,
OptimisticConfirmations: 1,
})
require.NoError(t, err)
chainAConf := integrationhelpers.SetupConfigInfo(integrationhelpers.ChainA, p2pIDs, integrationhelpers.FChainA, encodedChainConfig)
chainBConf := integrationhelpers.SetupConfigInfo(integrationhelpers.ChainB, p2pIDs[1:], integrationhelpers.FChainB, encodedChainConfig)
chainCConf := integrationhelpers.SetupConfigInfo(integrationhelpers.ChainC, p2pIDs[2:], integrationhelpers.FChainC, encodedChainConfig)
inputConfig := []capcfg.CCIPConfigTypesChainConfigInfo{
chainAConf,
chainBConf,
chainCConf,
}
_, err := uni.CcipCfg.ApplyChainConfigUpdates(uni.Transactor, nil, inputConfig)
_, err = uni.CcipCfg.ApplyChainConfigUpdates(uni.Transactor, nil, inputConfig)
require.NoError(t, err)
uni.Backend.Commit()
//================================Setup HomeChainReader===============================
Expand All @@ -63,6 +71,7 @@ func TestHomeChainReader(t *testing.T) {
expectedChainConfigs[cciptypes.ChainSelector(c.ChainSelector)] = ccipreader.ChainConfig{
FChain: int(c.ChainConfig.FChain),
SupportedNodes: toPeerIDs(c.ChainConfig.Readers),
Config: mustDecodeChainConfig(t, c.ChainConfig.Config),
}
}
configs, err := homeChain.GetAllChainConfigs()
Expand All @@ -86,3 +95,9 @@ func toPeerIDs(readers [][32]byte) mapset.Set[libocrtypes.PeerID] {
}
return peerIDs
}

func mustDecodeChainConfig(t *testing.T, encodedChainConfig []byte) chainconfig.ChainConfig {
chainConfig, err := chainconfig.DecodeChainConfig(encodedChainConfig)
require.NoError(t, err)
return chainConfig
}

0 comments on commit 9293aba

Please sign in to comment.