Skip to content

Commit 6b37e7d

Browse files
authored
fix: ensure migration sets appropriate kind (#230)
<!-- 🚨 ATTENTION! 🚨 This PR template is REQUIRED. PRs not following this format will be closed without review. Requirements: - PR title must follow commit conventions: https://www.conventionalcommits.org/en/v1.0.0/ - Label your PR with the correct type (e.g., 🐛 Bug, ✨ Enhancement, 🧪 Test, etc.) - Provide clear and specific details in each section --> **Motivation:** <!-- Explain here the context, and why you're making that change. What is the problem you're trying to solve. --> As an AVS developer that has already created a project, I want to be certain the migration to v0.0.7 properly defines `deployed_l*_contracts` sequence so that the migrations complete successfully. **Modifications:** <!-- Describe the modifications you've done from a high level. What are the key technical decisions and why were they made? --> - Changes `deployed_l*_contracts` default to `SequenceNode` **Result:** <!-- *After your change, what will change. --> - Migration completes successfully **Testing:** <!-- *List testing procedures taken and useful artifacts. --> - Tested locally
1 parent f3fd20c commit 6b37e7d

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

config/contexts/migrations/v0.0.6-v0.0.7.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,15 @@ func Migration_0_0_6_to_0_0_7(user, old, new *yaml.Node) (*yaml.Node, error) {
137137
Path: []string{"context", "deployed_l1_contracts"},
138138
Condition: migration.Always{},
139139
Transform: func(_ *yaml.Node) *yaml.Node {
140-
return &yaml.Node{Kind: yaml.MappingNode, Content: []*yaml.Node{}}
140+
return &yaml.Node{Kind: yaml.SequenceNode, Content: []*yaml.Node{}}
141141
},
142142
},
143143
// Add deployed_l2_contracts section
144144
{
145145
Path: []string{"context", "deployed_l2_contracts"},
146146
Condition: migration.Always{},
147147
Transform: func(_ *yaml.Node) *yaml.Node {
148-
return &yaml.Node{Kind: yaml.MappingNode, Content: []*yaml.Node{}}
148+
return &yaml.Node{Kind: yaml.SequenceNode, Content: []*yaml.Node{}}
149149
},
150150
},
151151
// Remove deployed_contracts section

pkg/commands/build.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,24 @@ var BuildCommand = &cli.Command{
2727
Action: func(cCtx *cli.Context) error {
2828
logger := common.LoggerFromContext(cCtx.Context)
2929

30+
// Migrate config
31+
configsMigratedCount, err := configs.MigrateConfig(logger)
32+
if err != nil {
33+
logger.Error("config migration failed: %w", err)
34+
}
35+
if configsMigratedCount > 0 {
36+
logger.Info("configs migrated: %d", configsMigratedCount)
37+
}
38+
39+
// Migrate contexts
40+
contextsMigratedCount, err := contexts.MigrateContexts(logger)
41+
if err != nil {
42+
logger.Error("context migrations failed: %w", err)
43+
}
44+
if contextsMigratedCount > 0 {
45+
logger.Info("contexts migrated: %d", contextsMigratedCount)
46+
}
47+
3048
// Run scriptPath from cwd
3149
const dir = ""
3250

@@ -49,24 +67,6 @@ var BuildCommand = &cli.Command{
4967
}
5068
}
5169

52-
// Migrate config
53-
configsMigratedCount, err := configs.MigrateConfig(logger)
54-
if err != nil {
55-
logger.Error("config migration failed: %w", err)
56-
}
57-
if configsMigratedCount > 0 {
58-
logger.Info("configs migrated: %d", configsMigratedCount)
59-
}
60-
61-
// Migrate contexts
62-
contextsMigratedCount, err := contexts.MigrateContexts(logger)
63-
if err != nil {
64-
logger.Error("context migrations failed: %w", err)
65-
}
66-
if contextsMigratedCount > 0 {
67-
logger.Info("contexts migrated: %d", contextsMigratedCount)
68-
}
69-
7070
// Handle version increment
7171
version := cfg.Context["devnet"].Artifact.Version
7272
if version == "" {

0 commit comments

Comments
 (0)