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

Misc fixes for CCIP1.6 staging #14665

Merged
merged 7 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
7 changes: 7 additions & 0 deletions integration-tests/deployment/ccip/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ func (c CCIPChainState) GenerateView() (view.ChainView, error) {
}
chainView.RMNProxy[c.RMNProxy.Address().Hex()] = rmnProxyView
}
if c.CapabilityRegistry != nil {
capRegView, err := v1_6.GenerateCapRegView(c.CapabilityRegistry)
if err != nil {
return chainView, err
}
chainView.CapabilityRegistry[c.CapabilityRegistry.Address().Hex()] = capRegView
}
return chainView, nil
}

Expand Down
22 changes: 12 additions & 10 deletions integration-tests/deployment/ccip/view/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ type ChainView struct {
TokenAdminRegistry map[string]v1_5.TokenAdminRegistryView `json:"tokenAdminRegistry,omitempty"`
CommitStore map[string]v1_5.CommitStoreView `json:"commitStore,omitempty"`
// v1.6
FeeQuoter map[string]v1_6.FeeQuoterView `json:"feeQuoter,omitempty"`
NonceManager map[string]v1_6.NonceManagerView `json:"nonceManager,omitempty"`
RMN map[string]v1_6.RMNRemoteView `json:"rmn,omitempty"`
OnRamp map[string]v1_6.OnRampView `json:"onRamp,omitempty"`
OffRamp map[string]v1_6.OffRampView `json:"offRamp,omitempty"`
FeeQuoter map[string]v1_6.FeeQuoterView `json:"feeQuoter,omitempty"`
NonceManager map[string]v1_6.NonceManagerView `json:"nonceManager,omitempty"`
RMN map[string]v1_6.RMNRemoteView `json:"rmn,omitempty"`
OnRamp map[string]v1_6.OnRampView `json:"onRamp,omitempty"`
OffRamp map[string]v1_6.OffRampView `json:"offRamp,omitempty"`
CapabilityRegistry map[string]v1_6.CapRegView `json:"capabilityRegistry,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

The contract is versioned 1.0 though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah this is a bit of a weird case, its shared/multi-product 1.0 contract which we introduced in 1.6. I think still makes most sense to include in 1.6

Copy link
Contributor

Choose a reason for hiding this comment

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

How about adding a comment? so that we don't end up changing it later

}

func NewChain() ChainView {
Expand All @@ -33,10 +34,11 @@ func NewChain() ChainView {
TokenAdminRegistry: make(map[string]v1_5.TokenAdminRegistryView),
CommitStore: make(map[string]v1_5.CommitStoreView),
// v1.6
FeeQuoter: make(map[string]v1_6.FeeQuoterView),
NonceManager: make(map[string]v1_6.NonceManagerView),
RMN: make(map[string]v1_6.RMNRemoteView),
OnRamp: make(map[string]v1_6.OnRampView),
OffRamp: make(map[string]v1_6.OffRampView),
FeeQuoter: make(map[string]v1_6.FeeQuoterView),
NonceManager: make(map[string]v1_6.NonceManagerView),
RMN: make(map[string]v1_6.RMNRemoteView),
OnRamp: make(map[string]v1_6.OnRampView),
OffRamp: make(map[string]v1_6.OffRampView),
CapabilityRegistry: make(map[string]v1_6.CapRegView),
}
}
42 changes: 42 additions & 0 deletions integration-tests/deployment/ccip/view/v1_6/capreg.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package v1_6

import (
"github.com/ethereum/go-ethereum/common"

"github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip/view/types"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry"
)

type CapRegView struct {
types.ContractMetaData
Capabilities []CapabilityView `json:"capabilities,omitempty"`
}

type CapabilityView struct {
LabelledName string `json:"labelledName"`
Version string `json:"version"`
ConfigContract common.Address `json:"configContract"`
}

func GenerateCapRegView(capReg *capabilities_registry.CapabilitiesRegistry) (CapRegView, error) {
tv, err := types.NewContractMetaData(capReg, capReg.Address())
if err != nil {
return CapRegView{}, err
}
caps, err := capReg.GetCapabilities(nil)
if err != nil {
return CapRegView{}, err
}
var capViews []CapabilityView
for _, capability := range caps {
capViews = append(capViews, CapabilityView{
LabelledName: capability.LabelledName,
Version: capability.Version,
ConfigContract: capability.ConfigurationContract,
})
}
return CapRegView{
ContractMetaData: tv,
Capabilities: capViews,
}, nil
}
7 changes: 4 additions & 3 deletions integration-tests/deployment/devenv/jd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package devenv

import (
"context"
"crypto/tls"
"fmt"

"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"

"github.com/smartcontractkit/chainlink/integration-tests/deployment"
csav1 "github.com/smartcontractkit/chainlink/integration-tests/deployment/jd/csa/v1"
Expand All @@ -27,8 +27,9 @@ func NewJDConnection(cfg JDConfig) (*grpc.ClientConn, error) {
if cfg.creds != nil {
opts = append(opts, grpc.WithTransportCredentials(cfg.creds))
} else {
opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))

opts = append(opts, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{
MinVersion: tls.VersionTLS12,
})))
}

conn, err := grpc.NewClient(cfg.GRPC, opts...)
Expand Down
1 change: 1 addition & 0 deletions integration-tests/deployment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type OnchainClient interface {
// to abstract chain clients.
bind.ContractBackend
bind.DeployBackend
BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
}

type OffchainClient interface {
Expand Down
10 changes: 0 additions & 10 deletions integration-tests/deployment/multiclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,6 @@ func NewMultiClient(rpcs []RPC, opts ...func(client *MultiClient)) (*MultiClient
return &mc, nil
}

func (mc *MultiClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) {
var receipt *types.Receipt
err := mc.retryWithBackups(func(client *ethclient.Client) error {
var err error
receipt, err = client.TransactionReceipt(ctx, txHash)
return err
})
return receipt, err
}

func (mc *MultiClient) SendTransaction(ctx context.Context, tx *types.Transaction) error {
return mc.retryWithBackups(func(client *ethclient.Client) error {
return client.SendTransaction(ctx, tx)
Expand Down
Loading