Skip to content

Commit

Permalink
Address some more feedback on the PR
Browse files Browse the repository at this point in the history
  • Loading branch information
carte7000 committed Dec 9, 2024
1 parent 1715638 commit a68f20b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 6 additions & 3 deletions deployment/ccip/changeset/cs_update_rmn_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"math/big"
"reflect"
"time"

"github.com/ethereum/go-ethereum/common"
"github.com/smartcontractkit/ccip-owner-contracts/pkg/gethwrappers"
Expand All @@ -21,6 +22,7 @@ type SetRMNHomeCandidateConfig struct {
RMNStaticConfig rmn_home.RMNHomeStaticConfig
RMNDynamicConfig rmn_home.RMNHomeDynamicConfig
DigestToOverride [32]byte
MinDelay time.Duration
}

func (c SetRMNHomeCandidateConfig) Validate(state CCIPOnChainState) error {
Expand Down Expand Up @@ -63,13 +65,12 @@ func (c SetRMNHomeCandidateConfig) Validate(state CCIPOnChainState) error {
}

currentDigest, err := rmnHome.GetCandidateDigest(nil)

if err != nil {
return fmt.Errorf("failed to get RMNHome candidate digest: %w", err)
}

if currentDigest != c.DigestToOverride {
return fmt.Errorf("current digest does not match digest to override")
return fmt.Errorf("current digest (%x) does not match digest to override (%x)", currentDigest[:], c.DigestToOverride[:])
}

return nil
Expand All @@ -78,6 +79,7 @@ func (c SetRMNHomeCandidateConfig) Validate(state CCIPOnChainState) error {
type PromoteRMNHomeCandidateConfig struct {
HomeChainSelector uint64
DigestToPromote [32]byte
MinDelay time.Duration
}

func (c PromoteRMNHomeCandidateConfig) Validate(state CCIPOnChainState) error {
Expand All @@ -97,7 +99,7 @@ func (c PromoteRMNHomeCandidateConfig) Validate(state CCIPOnChainState) error {
}

if currentCandidateDigest != c.DigestToPromote {
return fmt.Errorf("candidate digest does not match digest to promote")
return fmt.Errorf("current digest (%x) does not match digest to promote (%x)", currentCandidateDigest[:], c.DigestToPromote[:])
}

return nil
Expand Down Expand Up @@ -259,6 +261,7 @@ type SetRMNRemoteConfig struct {
HomeChainSelector uint64
Signers []rmn_remote.RMNRemoteSigner
F uint64
MinDelay time.Duration
}

func (c SetRMNRemoteConfig) Validate() error {
Expand Down
5 changes: 4 additions & 1 deletion deployment/ccip/changeset/cs_update_rmn_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func TestUpdateRMNHomeConfig(t *testing.T) {
SourceChains: []rmn_home.RMNHomeSourceChain{},
OffchainConfig: []byte(""),
},
MinDelay: 0,
}

_, err = commonchangeset.ApplyChangesets(t, e.Env, timelocksPerChain, []commonchangeset.ChangesetApplication{
Expand All @@ -87,6 +88,7 @@ func TestUpdateRMNHomeConfig(t *testing.T) {
promoteConfig := PromoteRMNHomeCandidateConfig{
HomeChainSelector: e.HomeChainSel,
DigestToPromote: currentCandidateDigest,
MinDelay: 0,
}

_, err = commonchangeset.ApplyChangesets(t, e.Env, timelocksPerChain, []commonchangeset.ChangesetApplication{
Expand All @@ -110,7 +112,8 @@ func TestUpdateRMNHomeConfig(t *testing.T) {
NodeIndex: 0,
},
},
F: 0,
F: 0,
MinDelay: 0,
}

_, err = commonchangeset.ApplyChangesets(t, e.Env, timelocksPerChain, []commonchangeset.ChangesetApplication{
Expand Down

0 comments on commit a68f20b

Please sign in to comment.