mirror of
https://github.com/luxfi/cli.git
synced 2026-10-30 17:01:20 +00:00
- Update github.com/luxfi/netrunner v1.15.3 → v1.15.4 - Update github.com/luxfi/node v1.22.77 → v1.22.80 - Remove local replace directive for netrunner - Use published package versions for reproducible builds
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
// Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package binutils
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/luxfi/cli/pkg/application"
|
|
"github.com/luxfi/sdk/models"
|
|
)
|
|
|
|
// UpgradeVM upgrades a VM binary to the specified version.
|
|
func UpgradeVM(app *application.Lux, vmID string, vmBinPath string) error {
|
|
installer := NewPluginBinaryDownloader(app)
|
|
if err := installer.UpgradeVM(vmID, vmBinPath); err != nil {
|
|
return fmt.Errorf("failed to upgrade vm: %w", err)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// UpdateLocalSidecarRPC updates the RPC version of the VM in the sidecar file.
|
|
func UpdateLocalSidecarRPC(app *application.Lux, sc models.Sidecar, rpcVersion int) error {
|
|
// find local network deployment info in sidecar
|
|
networkData, ok := sc.Networks[models.Local.String()]
|
|
if !ok {
|
|
return fmt.Errorf("failed to find local network in sidecar")
|
|
}
|
|
|
|
networkData.RPCVersion = rpcVersion
|
|
|
|
sc.Networks[models.Local.String()] = networkData
|
|
|
|
if err := app.UpdateSidecar(&sc); err != nil {
|
|
return fmt.Errorf("failed to update sidecar: %w", err)
|
|
}
|
|
|
|
return nil
|
|
}
|