mirror of
https://github.com/luxfi/cli.git
synced 2026-10-30 17:01:20 +00:00
Deep audit changes: - Replace stub signature aggregator with real SDK warp implementation - Remove dead pkg/lpm package (SDK lpmintegration used instead) - Fix fs imports: use local utils.FileExists, DirExists, ExpandHome - Fix secp256k1fx imports: use node/vms/secp256k1fx - Fix platformvm imports: use node/vms/platformvm - Fix e2e test TODOs: uncomment BootstrapValidators assertions - Improve localnet stub implementations with real logic - Fix node.go fs.FileExists reference Note: Build requires GOWORK=off due to workspace dependency issues
52 lines
968 B
Go
52 lines
968 B
Go
// Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package migrations
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/luxfi/sdk/models"
|
|
|
|
"github.com/luxfi/cli/pkg/application"
|
|
)
|
|
|
|
const oldEVM = "EVM"
|
|
|
|
func migrateEVMNames(app *application.Lux, runner *migrationRunner) error {
|
|
chainDir := app.GetChainsDir()
|
|
chains, err := os.ReadDir(chainDir)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, chain := range chains {
|
|
if !chain.IsDir() {
|
|
continue
|
|
}
|
|
// disregard any empty chain directories
|
|
dirContents, err := os.ReadDir(filepath.Join(chainDir, chain.Name()))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if len(dirContents) == 0 {
|
|
continue
|
|
}
|
|
|
|
sc, err := app.LoadSidecar(chain.Name())
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if string(sc.VM) == oldEVM {
|
|
runner.printMigrationMessage()
|
|
sc.VM = models.EVM
|
|
if err = app.UpdateSidecar(&sc); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|