Skip to content

Commit

Permalink
extract common code to func
Browse files Browse the repository at this point in the history
  • Loading branch information
makramkd committed Nov 26, 2024
1 parent bc716e8 commit 2edd809
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 13 additions & 2 deletions deployment/ccip/changeset/accept_ownership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
)

func Test_NewAcceptOwnershipChangeset(t *testing.T) {
ctx := tests.Context(t)
e := NewMemoryEnvironmentWithJobs(t, logger.TestLogger(t), 2, 4)
state, err := LoadOnchainState(e.Env)
require.NoError(t, err)
Expand Down Expand Up @@ -92,8 +91,20 @@ func Test_NewAcceptOwnershipChangeset(t *testing.T) {
})
require.NoError(t, err)

assertTimelockOwnership(t, e, allChains, state)
}

// assertTimelockOwnership asserts that the ownership of the contracts has been transferred
// to the appropriate timelock contract on each chain.
func assertTimelockOwnership(
t *testing.T,
e DeployedEnv,
chains []uint64,
state CCIPOnChainState,
) {
ctx := tests.Context(t)
// check that the ownership has been transferred correctly
for _, chain := range allChains {
for _, chain := range chains {
for _, contract := range []ownershipTransferrer{
state.Chains[chain].OnRamp,
state.Chains[chain].OffRamp,
Expand Down
2 changes: 2 additions & 0 deletions deployment/ccip/changeset/add_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ func TestAddChainInbound(t *testing.T) {
})
require.NoError(t, err)

assertTimelockOwnership(t, e, initialDeploy, state)

nodes, err := deployment.NodeInfo(e.Env.NodeIDs, e.Env.Offchain)
require.NoError(t, err)

Expand Down

0 comments on commit 2edd809

Please sign in to comment.