Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable add chain test #14904

Merged
merged 40 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
be45932
Add FeeQuoter to SourceConfig
asoliman92 Oct 17, 2024
0f8fc41
Merge branch 'develop' into fix-fee-quoter
asoliman92 Oct 17, 2024
c276a80
cl-ccip bump
asoliman92 Oct 17, 2024
39e6338
Merge branch 'develop' into fix-fee-quoter
asoliman92 Oct 18, 2024
009f334
Debugging
asoliman92 Oct 18, 2024
ad5635f
Fix OnRamp.GetDestChainConfig
asoliman92 Oct 18, 2024
e58e79c
Cleaning
asoliman92 Oct 21, 2024
1adc8c0
Clean contract configs
asoliman92 Oct 21, 2024
085bd48
Clean contract configs
asoliman92 Oct 21, 2024
397420e
Add Gas Price test in initial_deploy_test.go
asoliman92 Oct 21, 2024
98e5ac2
Bump chainlink-ccip
asoliman92 Oct 21, 2024
ef99468
Merge branch 'develop' into fix-fee-quoter
asoliman92 Oct 21, 2024
157e441
Bump chainlink-ccip
asoliman92 Oct 21, 2024
3a68a95
Merge branch 'develop' into fix-fee-quoter
asoliman92 Oct 22, 2024
d2e5ac0
cleaning cmoments
asoliman92 Oct 22, 2024
83fa7c8
linting
asoliman92 Oct 22, 2024
36169af
skip failing test for now
asoliman92 Oct 22, 2024
3bb786a
unskip
asoliman92 Oct 22, 2024
ea86129
Add FeeQuoter to SourceConfig
asoliman92 Oct 17, 2024
c6230b4
Bump chainlink-ccip
winder Oct 22, 2024
0614569
Add weth feed
asoliman92 Oct 22, 2024
f95de90
Remove deprecated thing.
winder Oct 22, 2024
131211a
Add assertions for weth
asoliman92 Oct 22, 2024
0120ff5
Remove replacement.
winder Oct 22, 2024
e9d9681
linting
asoliman92 Oct 22, 2024
d84c55a
gomodtidy
winder Oct 22, 2024
21a5c0a
Make TestAddChainInbound test Bidirectional and rename to TestAddChain
asoliman92 Oct 22, 2024
fe8ff1f
Merge branch 'fix-fee-quoter' into add-weth-feed
asoliman92 Oct 22, 2024
596033f
updates
AnieeG Oct 22, 2024
7e0bfe0
enable testaddchain
AnieeG Oct 22, 2024
0dc1a11
changes
AnieeG Oct 22, 2024
355005a
more changes
AnieeG Oct 22, 2024
6b65996
updates
AnieeG Oct 22, 2024
739cedf
go mod update
AnieeG Oct 22, 2024
a6da0cd
more fix
AnieeG Oct 22, 2024
2952a0c
fix lint
AnieeG Oct 22, 2024
b4b7913
fix lint
AnieeG Oct 22, 2024
62a0290
fix conflicts
AnieeG Oct 23, 2024
201ea59
go mod
AnieeG Oct 23, 2024
bd58ad7
merge
AnieeG Oct 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 4 additions & 56 deletions integration-tests/deployment/ccip/add_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@ import (
"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/mcms"
"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock"

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

"github.com/smartcontractkit/chainlink-ccip/chainconfig"

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

"github.com/smartcontractkit/chainlink/integration-tests/deployment"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/ccip_home"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/onramp"
)
Expand All @@ -35,7 +28,6 @@ func NewChainInboundProposal(
var batches []timelock.BatchChainOperation
var chains []uint64
for _, source := range sources {
chain, _ := chainsel.ChainBySelector(source)
enableOnRampDest, err := state.Chains[source].OnRamp.ApplyDestChainConfigUpdates(deployment.SimTransactOpts(), []onramp.OnRampDestChainConfigArgs{
{
DestChainSelector: newChainSel,
Expand All @@ -56,35 +48,15 @@ func NewChainInboundProposal(
if err != nil {
return nil, err
}
initialPrices, err := state.Chains[source].FeeQuoter.UpdatePrices(
deployment.SimTransactOpts(),
fee_quoter.InternalPriceUpdates{
TokenPriceUpdates: []fee_quoter.InternalTokenPriceUpdate{},
GasPriceUpdates: []fee_quoter.InternalGasPriceUpdate{
{
DestChainSelector: newChainSel,
// TODO: parameterize
UsdPerUnitGas: big.NewInt(2e12),
},
}})
if err != nil {
return nil, err
}
batches = append(batches, timelock.BatchChainOperation{
ChainIdentifier: mcms.ChainIdentifier(chain.Selector),
ChainIdentifier: mcms.ChainIdentifier(source),
Batch: []mcms.Operation{
{
// Enable the source in on ramp
To: state.Chains[source].OnRamp.Address(),
Data: enableOnRampDest.Data(),
Value: big.NewInt(0),
},
{
// Set initial dest prices to unblock testing.
To: state.Chains[source].FeeQuoter.Address(),
Data: initialPrices.Data(),
Value: big.NewInt(0),
},
{
To: state.Chains[source].FeeQuoter.Address(),
Data: enableFeeQuoterDest.Data(),
Expand All @@ -95,42 +67,18 @@ func NewChainInboundProposal(
chains = append(chains, source)
}

homeChain, _ := chainsel.ChainBySelector(homeChainSel)
nodes, err := deployment.NodeInfo(e.NodeIDs, e.Offchain)
addChainOp, err := ApplyChainConfigUpdatesOp(e, state, homeChainSel, []uint64{newChainSel})
if err != nil {
return nil, err
}
encodedExtraChainConfig, err := chainconfig.EncodeChainConfig(chainconfig.ChainConfig{
GasPriceDeviationPPB: ccipocr3.NewBigIntFromInt64(1000),
DAGasPriceDeviationPPB: ccipocr3.NewBigIntFromInt64(0),
OptimisticConfirmations: 1,
})
if err != nil {
return nil, err
}
chainConfig := SetupConfigInfo(newChainSel, nodes.NonBootstraps().PeerIDs(),
nodes.DefaultF(), encodedExtraChainConfig)
addChain, err := state.Chains[homeChainSel].CCIPHome.ApplyChainConfigUpdates(
deployment.SimTransactOpts(), nil, []ccip_home.CCIPHomeChainConfigArgs{
chainConfig,
})
if err != nil {
return nil, err
}

timelockAddresses, metaDataPerChain, err := BuildProposalMetadata(state, append(chains, homeChainSel))
if err != nil {
return nil, err
}
batches = append(batches, timelock.BatchChainOperation{
ChainIdentifier: mcms.ChainIdentifier(homeChain.Selector),
ChainIdentifier: mcms.ChainIdentifier(homeChainSel),
Batch: []mcms.Operation{
{
// Add the chain first, don needs it to be there.
To: state.Chains[homeChainSel].CCIPHome.Address(),
Data: addChain.Data(),
Value: big.NewInt(0),
},
addChainOp,
},
})
return timelock.NewMCMSWithTimelockProposal(
Expand Down
1 change: 0 additions & 1 deletion integration-tests/deployment/ccip/add_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
)

func TestAddChainInbound(t *testing.T) {
t.Skip("Skipping test. Working on it in another PR")
// 4 chains where the 4th is added after initial deployment.
e := NewMemoryEnvironmentWithJobs(t, logger.TestLogger(t), 4)
state, err := LoadOnchainState(e.Env, e.Ab)
Expand Down
9 changes: 4 additions & 5 deletions integration-tests/deployment/ccip/add_lane.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,9 @@ func defaultFeeQuoterDestChainConfig() fee_quoter.FeeQuoterDestChainConfig {
DestGasPerDataAvailabilityByte: 100,
DestDataAvailabilityMultiplierBps: 1,
DefaultTokenDestGasOverhead: 125_000,
//DefaultTokenDestBytesOverhead: 32,
DefaultTxGasLimit: 200_000,
GasMultiplierWeiPerEth: 1,
NetworkFeeUSDCents: 1,
ChainFamilySelector: [4]byte(evmFamilySelector),
DefaultTxGasLimit: 200_000,
GasMultiplierWeiPerEth: 1,
NetworkFeeUSDCents: 1,
ChainFamilySelector: [4]byte(evmFamilySelector),
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import (
cciptypes "github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3"
"github.com/smartcontractkit/chainlink-ccip/pluginconfig"

"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext"
"github.com/smartcontractkit/chainlink/integration-tests/deployment"
ccdeploy "github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip"

jobv1 "github.com/smartcontractkit/chainlink-protos/job-distributor/v1/job"

"github.com/smartcontractkit/chainlink/integration-tests/deployment"
ccdeploy "github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip"
"github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext"

"github.com/smartcontractkit/chainlink/v2/core/logger"

"github.com/stretchr/testify/require"
)

func TestInitialDeploy(t *testing.T) {
Expand Down Expand Up @@ -98,7 +99,6 @@ func TestInitialDeploy(t *testing.T) {

// Wait for all commit reports to land.
ccdeploy.ConfirmCommitForAllWithExpectedSeqNums(t, e, state, expectedSeqNum, startBlocks)

// TODO: use proper assertions to check gas and token prices using events

// Wait for all exec reports to land
Expand Down
41 changes: 40 additions & 1 deletion integration-tests/deployment/ccip/deploy_home_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"

"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/mcms"

"github.com/smartcontractkit/chainlink-ccip/chainconfig"
Expand Down Expand Up @@ -1075,3 +1074,43 @@ func AddDON(

return nil
}

func ApplyChainConfigUpdatesOp(
e deployment.Environment,
state CCIPOnChainState,
homeChainSel uint64,
chains []uint64,
) (mcms.Operation, error) {
nodes, err := deployment.NodeInfo(e.NodeIDs, e.Offchain)
if err != nil {
return mcms.Operation{}, err
}
encodedExtraChainConfig, err := chainconfig.EncodeChainConfig(chainconfig.ChainConfig{
GasPriceDeviationPPB: ccipocr3.NewBigIntFromInt64(1000),
DAGasPriceDeviationPPB: ccipocr3.NewBigIntFromInt64(0),
OptimisticConfirmations: 1,
})
if err != nil {
return mcms.Operation{}, err
}
var chainConfigUpdates []ccip_home.CCIPHomeChainConfigArgs
for _, chainSel := range chains {
chainConfig := SetupConfigInfo(chainSel, nodes.NonBootstraps().PeerIDs(),
nodes.DefaultF(), encodedExtraChainConfig)
chainConfigUpdates = append(chainConfigUpdates, chainConfig)
}

addChain, err := state.Chains[homeChainSel].CCIPHome.ApplyChainConfigUpdates(
deployment.SimTransactOpts(),
nil,
chainConfigUpdates,
)
if err != nil {
return mcms.Operation{}, err
}
return mcms.Operation{
To: state.Chains[homeChainSel].CCIPHome.Address(),
Data: addChain.Data(),
Value: big.NewInt(0),
}, nil
}
4 changes: 2 additions & 2 deletions integration-tests/deployment/ccip/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import (
jobv1 "github.com/smartcontractkit/chainlink-protos/job-distributor/v1/job"

"github.com/smartcontractkit/chainlink/integration-tests/deployment"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/mock_ethusd_aggregator_wrapper"

"github.com/smartcontractkit/chainlink/integration-tests/deployment/memory"
"github.com/smartcontractkit/chainlink/integration-tests/docker/test_env"
"github.com/smartcontractkit/chainlink/integration-tests/testconfig"
Expand All @@ -42,7 +44,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/mock_v3_aggregator_contract"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/aggregator_v3_interface"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/mock_ethusd_aggregator_wrapper"
)

const (
Expand Down Expand Up @@ -557,5 +558,4 @@ func deploySingleFeed(
}

return mockTokenFeed.Address, desc, nil

}
1 change: 1 addition & 0 deletions integration-tests/deployment/ccip/token_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ccipdeployment
import (
"github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3"
"github.com/smartcontractkit/chainlink-ccip/pluginconfig"

"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/weth9"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/shared/generated/burn_mint_erc677"

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/load/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ require (
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241022184834-e8564a286a47 // indirect
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f // indirect
github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.0 // indirect
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect
Expand Down Expand Up @@ -406,7 +407,6 @@ require (
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/smartcontractkit/chain-selectors v1.0.27 // indirect
github.com/smartcontractkit/chainlink-automation v0.8.0 // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241022184834-e8564a286a47 // indirect
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241018134907-a00ba3729b5e // indirect
github.com/smartcontractkit/chainlink-feeds v0.1.1 // indirect
github.com/smartcontractkit/chainlink-protos/orchestrator v0.3.0 // indirect
Expand Down
Loading