Skip to content

Commit

Permalink
Fix linting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
carte7000 committed Jan 15, 2025
1 parent 19e3410 commit 0cd231c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
11 changes: 9 additions & 2 deletions deployment/ccip/changeset/cs_rmn_curse_uncurse.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ func RMNCurseChangeset(e deployment.Environment, cfg RMNCurseConfig) (deployment
grouped := groupRMNSubjectBySelector(curseActions, true, true)
// For each chain in the environment get the RMNRemote contract and call curse
for selector, chain := range state.Chains {
deployer := deployerGroup.getDeployer(selector)
deployer, err := deployerGroup.getDeployer(selector)
if err != nil {
return deployment.ChangesetOutput{}, fmt.Errorf("failed to get deployer for chain %d: %w", selector, err)
}
if curseSubjects, ok := grouped[selector]; ok {
// Only curse the subjects that are not actually cursed
notAlreadyCursedSubjects := make([]Subject, 0)
Expand Down Expand Up @@ -293,7 +296,11 @@ func RMNUncurseChangeset(e deployment.Environment, cfg RMNCurseConfig) (deployme

// For each chain in the environement get the RMNRemote contract and call uncurse
for selector, chain := range state.Chains {
deployer := deployerGroup.getDeployer(selector)
deployer, err := deployerGroup.getDeployer(selector)
if err != nil {
return deployment.ChangesetOutput{}, fmt.Errorf("failed to get deployer for chain %d: %w", selector, err)
}

if curseSubjects, ok := grouped[selector]; ok {
// Only keep the subject that are actually cursed
actuallyCursedSubjects := make([]Subject, 0)
Expand Down
6 changes: 3 additions & 3 deletions deployment/ccip/changeset/deployer_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewDeployerGroup(e deployment.Environment, state CCIPOnChainState, mcmConfi
}
}

func (d *DeployerGroup) getDeployer(chain uint64) *bind.TransactOpts {
func (d *DeployerGroup) getDeployer(chain uint64) (*bind.TransactOpts, error) {
txOpts := d.e.Chains[chain].DeployerKey
if d.mcmConfig != nil {
txOpts = deployment.SimTransactOpts()
Expand Down Expand Up @@ -83,7 +83,7 @@ func (d *DeployerGroup) getDeployer(chain uint64) *bind.TransactOpts {
} else {
nonce, err := d.e.Chains[chain].Client.PendingNonceAt(context.Background(), txOpts.From)
if err != nil {
panic(fmt.Errorf("could not get nonce for deployer: %v", err))
return nil, fmt.Errorf("could not get nonce for deployer: %w", err)
}
startingNonce = new(big.Int).SetUint64(nonce)
}
Expand All @@ -99,7 +99,7 @@ func (d *DeployerGroup) getDeployer(chain uint64) *bind.TransactOpts {
d.transactions[chain] = append(d.transactions[chain], tx)
return tx, nil
}
return sim
return sim, nil
}

func (d *DeployerGroup) enact(deploymentDescription string) (deployment.ChangesetOutput, error) {
Expand Down
13 changes: 10 additions & 3 deletions deployment/ccip/changeset/deployer_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"testing"

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

"github.com/smartcontractkit/chainlink/deployment"
commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset"
"github.com/stretchr/testify/require"
)

type dummyDeployerGroupChangesetConfig struct {
Expand All @@ -26,7 +27,10 @@ func dummyDeployerGroupGrantMintChangeset(e deployment.Environment, cfg dummyDep
token := state.Chains[cfg.selector].LinkToken

group := NewDeployerGroup(e, state, cfg.MCMS)
deployer := group.getDeployer(cfg.selector)
deployer, err := group.getDeployer(cfg.selector)
if err != nil {
return deployment.ChangesetOutput{}, err
}

_, err = token.GrantMintRole(deployer, deployer.From)
if err != nil {
Expand All @@ -45,7 +49,10 @@ func dummyDeployerGroupMintChangeset(e deployment.Environment, cfg dummyDeployer
token := state.Chains[cfg.selector].LinkToken

group := NewDeployerGroup(e, state, cfg.MCMS)
deployer := group.getDeployer(cfg.selector)
deployer, err := group.getDeployer(cfg.selector)
if err != nil {
return deployment.ChangesetOutput{}, err
}

for _, mint := range cfg.mints {
_, err = token.Mint(deployer, cfg.address, mint)
Expand Down

0 comments on commit 0cd231c

Please sign in to comment.