Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AnieeG committed Sep 30, 2024
1 parent 37a8a99 commit 94f3bcc
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 27 deletions.
8 changes: 7 additions & 1 deletion integration-tests/deployment/ccip/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ func LoadChainState(chain deployment.Chain, addresses map[string]deployment.Type
var state CCIPChainState
for address, tvStr := range addresses {
switch tvStr.String() {
case deployment.NewTypeAndVersion(CCIPConfig, deployment.Version1_6_0_dev).String():
cc, err := ccip_config.NewCCIPConfig(common.HexToAddress(address), chain.Client)
if err != nil {
return state, err
}
state.CCIPConfig = cc
case deployment.NewTypeAndVersion(RBACTimelock, deployment.Version1_0_0).String():
tl, err := owner_wrappers.NewRBACTimelock(common.HexToAddress(address), chain.Client)
if err != nil {
Expand All @@ -241,7 +247,7 @@ func LoadChainState(chain deployment.Chain, addresses map[string]deployment.Type
return state, err
}
state.Mcm = mcms
case deployment.NewTypeAndVersion(CapabilitiesRegistry, deployment.Version1_0_0).String():
case deployment.NewTypeAndVersion(CapabilitiesRegistry, deployment.Version1_1_0).String():
cr, err := capabilities_registry.NewCapabilitiesRegistry(common.HexToAddress(address), chain.Client)
if err != nil {
return state, err
Expand Down
12 changes: 6 additions & 6 deletions integration-tests/deployment/devenv/build_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,19 +310,19 @@ func CreateChainConfigFromNetworks(
chainId := net.ChainID
chainName, err := chainselectors.NameFromChainId(uint64(chainId))
require.NoError(t, err, "Error getting chain name")
// TODO : testconfig does not allow blank private key as of now
// so we are defaulting to nil for now to make use of KMS
// when it's supported allow reading private key from testconfig so that
// when it's not provided we can use KMS
//pvtKeyStr, exists := networkPvtKeys[chainId]
//require.Truef(t, exists, "Private key not found for chain id %d", chainId)
chainCfg := ChainConfig{
ChainID: uint64(chainId),
ChainName: chainName,
ChainType: "EVM",
WSRPCs: net.URLs,
HTTPRPCs: net.HTTPURLs,
}
// TODO : testconfig does not allow blank private key as of now
// so we are defaulting to nil to make use of KMS
// when blank private key is supported, allow reading private key from testconfig so that
// when it's not provided we can use KMS, otherwise use the provided private key
//pvtKeyStr, exists := networkPvtKeys[chainId]
//require.Truef(t, exists, "Private key not found for chain id %d", chainId)
require.NoError(t, chainCfg.SetDeployerKey(nil))
chains = append(chains, chainCfg)
}
Expand Down
4 changes: 4 additions & 0 deletions integration-tests/deployment/multiclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ func (mc *MultiClient) NonceAt(ctx context.Context, account common.Address) (uin
return count, err
}

// retryWithBackups will retry the operation with the main client and then with the backup clients
// If the operation returns an error that is in the acceptedErrors list, it will not retry the operation or try the next client
func (mc *MultiClient) retryWithBackups(ctx context.Context, op func(*ethclient.Client) error, acceptedErrors ...error) error {
var err2 error
funcName := runtime.FuncForPC(reflect.ValueOf(op).Pointer()).Name()
Expand All @@ -222,6 +224,8 @@ func (mc *MultiClient) retryWithBackups(ctx context.Context, op func(*ethclient.
if err2 == nil {
return nil
}
// Check if the error is one of the accepted errors
// In case of an accepted error, we don't need to try the next client
for _, acceptedError := range acceptedErrors {
if errors.Is(err2, acceptedError) {
return err2
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ require (
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df
github.com/chaos-mesh/chaos-mesh/api v0.0.0-20240821051457-da69c6d9617a
github.com/cli/go-gh/v2 v2.0.0
github.com/cometbft/cometbft v0.37.5
github.com/ethereum/go-ethereum v1.13.8
github.com/fxamacker/cbor/v2 v2.7.0
github.com/go-resty/resty/v2 v2.11.0
Expand Down Expand Up @@ -151,7 +152,6 @@ require (
github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft v0.37.5 // indirect
github.com/cometbft/cometbft-db v0.8.0 // indirect
github.com/confio/ics23/go v0.9.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
Expand Down
19 changes: 0 additions & 19 deletions integration-tests/smoke/ccip_test.go
Original file line number Diff line number Diff line change
@@ -1,41 +1,22 @@
package smoke

import (
"fmt"
"testing"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/stretchr/testify/require"

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

"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"
"github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip/changeset"
"github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip/view"
jobv1 "github.com/smartcontractkit/chainlink/integration-tests/deployment/jd/job/v1"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry"
"github.com/smartcontractkit/chainlink/v2/core/logger"
)

func TestRevert(t *testing.T) {
ec, err := ethclient.Dial("wss...")
require.NoError(t, err)
tx, _, err := ec.TransactionByHash(testcontext.Get(t), common.HexToHash("0x6aae71ad356d383a41d20aad69de4e1cde536c33b0a41488e529df731bf086ab"))
require.NoError(t, err)
rec, err := ec.TransactionReceipt(testcontext.Get(t), tx.Hash())
require.NoError(t, err)
fromTx, err := deployment.GetErrorReasonFromTx(ec, common.HexToAddress("0xBE7294B7910606845500Ba524FfcAC8917A00F34"), *tx, rec)
require.NoError(t, err)
errStr, err := deployment.ParseErrorFromABI(fromTx, capabilities_registry.CapabilitiesRegistryABI)
require.NoError(t, err)
fmt.Println(errStr)
}

func Test0002_InitialDeployOnLocal(t *testing.T) {
lggr := logger.TestLogger(t)
ctx := testcontext.Get(t)
Expand Down

0 comments on commit 94f3bcc

Please sign in to comment.