Skip to content

Commit

Permalink
cleanup name and better error decoding (#14728)
Browse files Browse the repository at this point in the history
* cleanup name and better error decoding

* update deployment owners
  • Loading branch information
krehermann authored Oct 11, 2024
1 parent 70a61fe commit 998bc27
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ core/scripts/gateway @smartcontractkit/dev-services

# Deployment tooling
# Initially the common structures owned by CCIP
/integration-tests/deployment @smartcontractkit/ccip
/integration-tests/deployment @smartcontractkit/ccip @smartcontractkit/keystone
/integration-tests/deployment/ccip @smartcontractkit/ccip
/integration-tests/deployment/keystone @smartcontractkit/keystone
# TODO: As more products add their deployment logic here, add the team as an owner

# CI/CD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import (
kslib "github.com/smartcontractkit/chainlink/integration-tests/deployment/keystone"
)

// func Apply0004(lggr logger.Logger, env deployment.Environment, ab deployment.AddressBook, registryChainSel uint64) (deployment.ChangesetOutput, error) {
func Apply0004(lggr logger.Logger, req *kslib.ConfigureContractsRequest) (deployment.ChangesetOutput, error) {
func ConfigureInitialContracts(lggr logger.Logger, req *kslib.ConfigureContractsRequest) (deployment.ChangesetOutput, error) {
if err := req.Validate(); err != nil {
return deployment.ChangesetOutput{}, fmt.Errorf("failed to validate request: %w", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import (
kslib "github.com/smartcontractkit/chainlink/integration-tests/deployment/keystone"
)

func Apply0003(lggr logger.Logger, env deployment.Environment, ab deployment.AddressBook, registryChainSel uint64) (deployment.ChangesetOutput, error) {

func DeployForwarder(lggr logger.Logger, env deployment.Environment, ab deployment.AddressBook, registryChainSel uint64) (deployment.ChangesetOutput, error) {
// expect OCR3 to be deployed & capabilities registry
regAddrs, err := ab.AddressesForChain(registryChainSel)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/smartcontractkit/chainlink/integration-tests/deployment/memory"
)

func TestApply0003(t *testing.T) {
func TestDeployForwarder(t *testing.T) {
t.Parallel()

lggr := logger.Test(t)
Expand All @@ -33,7 +33,7 @@ func TestApply0003(t *testing.T) {
}
deployment.NewMemoryAddressBookFromMap(m)
// capabilities registry and ocr3 must be deployed on registry chain
_, err := changeset.Apply0003(lggr, env, ab, registrySel)
_, err := changeset.DeployForwarder(lggr, env, ab, registrySel)
require.Error(t, err)
})

Expand All @@ -45,7 +45,7 @@ func TestApply0003(t *testing.T) {
}
deployment.NewMemoryAddressBookFromMap(m)
// capabilities registry and ocr3 must be deployed on registry chain
_, err := changeset.Apply0003(lggr, env, ab, registrySel)
_, err := changeset.DeployForwarder(lggr, env, ab, registrySel)
require.Error(t, err)
})

Expand All @@ -59,7 +59,7 @@ func TestApply0003(t *testing.T) {
err = ab.Save(registrySel, "0x0000000000000000000000000000000000000002", kslb.OCR3CapabilityTypeVersion)
require.NoError(t, err)
// deploy forwarder
resp, err := changeset.Apply0003(lggr, env, ab, registrySel)
resp, err := changeset.DeployForwarder(lggr, env, ab, registrySel)
require.NoError(t, err)
require.NotNil(t, resp)
// registry, ocr3, forwarder should be deployed on registry chain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
kslib "github.com/smartcontractkit/chainlink/integration-tests/deployment/keystone"
)

func Apply0002(lggr logger.Logger, env deployment.Environment, ab deployment.AddressBook, registryChainSel uint64) (deployment.ChangesetOutput, error) {
func DeployOCR3(lggr logger.Logger, env deployment.Environment, ab deployment.AddressBook, registryChainSel uint64) (deployment.ChangesetOutput, error) {
// must have capabilities registry deployed
regAddrs, err := ab.AddressesForChain(registryChainSel)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/smartcontractkit/chainlink/integration-tests/deployment/memory"
)

func TestApply0002(t *testing.T) {
func TestDeployOCR3(t *testing.T) {
t.Parallel()
lggr := logger.Test(t)
ab := deployment.NewMemoryAddressBook()
Expand All @@ -27,13 +27,13 @@ func TestApply0002(t *testing.T) {

registrySel := env.AllChainSelectors()[0]
// err if no capabilities registry on chain 0
_, err := changeset.Apply0002(lggr, env, ab, registrySel)
_, err := changeset.DeployOCR3(lggr, env, ab, registrySel)
require.Error(t, err)

// fake capabilities registry
err = ab.Save(registrySel, "0x0000000000000000000000000000000000000001", kslb.CapabilityRegistryTypeVersion)
require.NoError(t, err)
resp, err := changeset.Apply0002(lggr, env, ab, registrySel)
resp, err := changeset.DeployOCR3(lggr, env, ab, registrySel)
require.NoError(t, err)
require.NotNil(t, resp)
// OCR3 should be deployed on chain 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
kslib "github.com/smartcontractkit/chainlink/integration-tests/deployment/keystone"
)

func Apply0001(lggr logger.Logger, env deployment.Environment, ab deployment.AddressBook, registryChainSel uint64) (deployment.ChangesetOutput, error) {
func DeployCapabilityRegistry(lggr logger.Logger, env deployment.Environment, ab deployment.AddressBook, registryChainSel uint64) (deployment.ChangesetOutput, error) {
c, ok := env.Chains[registryChainSel]
if !ok {
return deployment.ChangesetOutput{}, fmt.Errorf("chain not found in environment")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/smartcontractkit/chainlink/integration-tests/deployment/memory"
)

func TestApply0001(t *testing.T) {
func TestDeployCapabilityRegistry(t *testing.T) {
t.Parallel()
lggr := logger.Test(t)
ab := deployment.NewMemoryAddressBook()
Expand All @@ -24,7 +24,7 @@ func TestApply0001(t *testing.T) {
env := memory.NewMemoryEnvironment(t, lggr, zapcore.DebugLevel, cfg)

registrySel := env.AllChainSelectors()[0]
resp, err := changeset.Apply0001(lggr, env, ab, registrySel)
resp, err := changeset.DeployCapabilityRegistry(lggr, env, ab, registrySel)
require.NoError(t, err)
require.NotNil(t, resp)
// capabilities registry should be deployed on chain 0
Expand Down
9 changes: 7 additions & 2 deletions integration-tests/deployment/keystone/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,16 @@ func DecodeErr(encodedABI string, err error) error {
var d rpc.DataError
ok := errors.As(err, &d)
if ok {
errStr, parseErr := deployment.ParseErrorFromABI(d.ErrorData().(string), encodedABI)
encErr, ok := d.ErrorData().(string)
if !ok {
return fmt.Errorf("error without error data: %s", d.Error())
}
errStr, parseErr := deployment.ParseErrorFromABI(encErr, encodedABI)
if parseErr != nil {
return fmt.Errorf("failed to decode error with abi: %w", parseErr)
return fmt.Errorf("failed to decode error '%s' with abi: %w", encErr, parseErr)
}
return fmt.Errorf("contract error: %s", errStr)

}
return fmt.Errorf("cannot decode error with abi: %w", err)
}
Expand Down

0 comments on commit 998bc27

Please sign in to comment.