Skip to content

Commit

Permalink
Unorder changesets (#14608)
Browse files Browse the repository at this point in the history
* Unorder

* Typo

* Fix smoke

* Rename test
  • Loading branch information
connorwstein authored Sep 30, 2024
1 parent 3e9e058 commit 74a5b4f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
15 changes: 8 additions & 7 deletions integration-tests/deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ environments like testnet/mainnet.
- EVM only

/deployment/devenv
- Coming soon
- package name `devenv`
- Docker environment for higher fidelity testing
- Support non-EVMs (yet to be implemented)
Expand All @@ -36,20 +35,22 @@ environments like testnet/mainnet.
- package name `changeset` imported as `ccipchangesets`
- These function like scripts describing state transitions
you wish to apply to _persistent_ environments like testnet/mainnet
- Ordered list of Go functions following the format
- They should be go functions where the first argument is an
environment and the second argument is a config struct which can be unique to the
changeset. The return value should be a `deployment.ChangesetOutput` and an error.
```Go
0001_descriptive_name.go
func Apply0001(env deployment.Environment, c ccipdeployment.Config) (deployment.ChangesetOutput, error)
do_something.go
func DoSomethingChangeSet(env deployment.Environment, c ccipdeployment.Config) (deployment.ChangesetOutput, error)
{
// Deploy contracts, generate MCMS proposals, generate
// job specs according to contracts etc.
return deployment.ChangesetOutput{}, nil
}
0001_descriptive_name_test.go
func TestApply0001(t *testing.T)
do_something_test.go
func TestDoSomething(t *testing.T)
{
// Set up memory env
// Apply0001 function
// DoSomethingChangeSet function
// Take the artifacts from ChangeSet output
// Apply them to the memory env
// Send traffic, run assertions etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
ccipdeployment "github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip"
)

// Separate migration because cap reg is an env var for CL nodes.
func Apply0001(env deployment.Environment, homeChainSel uint64) (deployment.ChangesetOutput, error) {
// Separated changset because cap reg is an env var for CL nodes.
func CapRegChangeSet(env deployment.Environment, homeChainSel uint64) (deployment.ChangesetOutput, error) {
// Note we also deploy the cap reg.
ab, _, err := ccipdeployment.DeployCapReg(env.Logger, env.Chains[homeChainSel])
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
// TODO: Maybe there's a generics approach here?
// Note if the change set is a deployment and it fails we have 2 options:
// - Just throw away the addresses, fix issue and try again (potentially expensive on mainnet)
func Apply0002(env deployment.Environment, c ccipdeployment.DeployCCIPContractConfig) (deployment.ChangesetOutput, error) {
func InitialDeployChangeSet(env deployment.Environment, c ccipdeployment.DeployCCIPContractConfig) (deployment.ChangesetOutput, error) {
ab, err := ccipdeployment.DeployCCIPContracts(env, c)
if err != nil {
env.Logger.Errorw("Failed to deploy CCIP contracts", "err", err, "addresses", ab)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/logger"
)

func Test0002_InitialDeploy(t *testing.T) {
func TestInitialDeploy(t *testing.T) {
lggr := logger.TestLogger(t)
ctx := ccdeploy.Context(t)
tenv := ccdeploy.NewMemoryEnvironment(t, lggr, 3)
Expand All @@ -35,8 +35,8 @@ func Test0002_InitialDeploy(t *testing.T) {
DeviationPPB: cciptypes.NewBigIntFromInt64(1e9),
},
)
// Apply migration
output, err := Apply0002(tenv.Env, ccdeploy.DeployCCIPContractConfig{
// Apply changeset
output, err := InitialDeployChangeSet(tenv.Env, ccdeploy.DeployCCIPContractConfig{
HomeChainSel: tenv.HomeChainSel,
FeedChainSel: tenv.FeedChainSel,
ChainsToDeploy: tenv.Env.AllChainSelectors(),
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/smoke/ccip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/logger"
)

func Test0002_InitialDeployOnLocal(t *testing.T) {
func TestInitialDeployOnLocal(t *testing.T) {
lggr := logger.TestLogger(t)
ctx := ccdeploy.Context(t)
tenv := ccdeploy.NewLocalDevEnvironment(t, lggr)
Expand All @@ -35,7 +35,7 @@ func Test0002_InitialDeployOnLocal(t *testing.T) {
},
)
// Apply migration
output, err := changeset.Apply0002(tenv.Env, ccdeploy.DeployCCIPContractConfig{
output, err := changeset.InitialDeployChangeSet(tenv.Env, ccdeploy.DeployCCIPContractConfig{
HomeChainSel: tenv.HomeChainSel,
FeedChainSel: tenv.FeedChainSel,
ChainsToDeploy: tenv.Env.AllChainSelectors(),
Expand Down

0 comments on commit 74a5b4f

Please sign in to comment.