Skip to content

Commit

Permalink
Update snapshot (#2248)
Browse files Browse the repository at this point in the history
* bump snapshot

* bump single node

* add durango 12

* point to main
  • Loading branch information
felipemadero authored Oct 15, 2024
1 parent 6a36a25 commit 73dcaca
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 7 deletions.
Binary file added assets/bootstrapSnapshot.PreDurango12.tar.gz
Binary file not shown.
Binary file modified assets/bootstrapSnapshot.tar.gz
Binary file not shown.
Binary file not shown.
Binary file modified assets/bootstrapSnapshotSingleNode.tar.gz
Binary file not shown.
1 change: 1 addition & 0 deletions assets/sha256sum.PreDurango12.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
811e73be1ad9b56f05a14ca6d239ee50bc3882fa10fdb2f78d41b02fb81ac6fe assets/bootstrapSnapshot.tar.gz
2 changes: 1 addition & 1 deletion assets/sha256sum.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
811e73be1ad9b56f05a14ca6d239ee50bc3882fa10fdb2f78d41b02fb81ac6fe assets/bootstrapSnapshot.tar.gz
26b07c304da467d3a28ebc936f5b44c5f27f65b0a626da81fabe9154a821ec24 assets/bootstrapSnapshot.tar.gz
1 change: 1 addition & 0 deletions assets/sha256sumSingleNode.PreDurango12.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
53ef0b4c6ef6bd54e07bd065d58164bd464cd46576d36230731c93d3cc254df9 assets/bootstrapSnapshotSingleNode.tar.gz
2 changes: 1 addition & 1 deletion assets/sha256sumSingleNode.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
53ef0b4c6ef6bd54e07bd065d58164bd464cd46576d36230731c93d3cc254df9 assets/bootstrapSnapshotSingleNode.tar.gz
ec7332442743b1943e298d7301b8962948ae104edb78f70b5cad30376b60557c assets/bootstrapSnapshotSingleNode.tar.gz
11 changes: 11 additions & 0 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const (

Cortina17Version = "v1.10.17"
Durango11Version = "v1.11.11"
Durango12Version = "v1.11.12"

BootstrapSnapshotRawBranch = "https://github.com/ava-labs/avalanche-cli/raw/main/"

Expand Down Expand Up @@ -135,6 +136,16 @@ const (
BootstrapSnapshotSingleNodePreDurango11URL = BootstrapSnapshotRawBranch + BootstrapSnapshotSingleNodePreDurango11LocalPath
BootstrapSnapshotSingleNodePreDurango11SHA256URL = BootstrapSnapshotRawBranch + AssetsDir + "sha256sumSingleNode.PreDurango11.txt"

BootstrapSnapshotPreDurango12ArchiveName = "bootstrapSnapshot.PreDurango12.tar.gz"
BootstrapSnapshotPreDurango12LocalPath = AssetsDir + BootstrapSnapshotPreDurango12ArchiveName
BootstrapSnapshotPreDurango12URL = BootstrapSnapshotRawBranch + BootstrapSnapshotPreDurango12LocalPath
BootstrapSnapshotPreDurango12SHA256URL = BootstrapSnapshotRawBranch + AssetsDir + "sha256sum.PreDurango12.txt"

BootstrapSnapshotSingleNodePreDurango12ArchiveName = "bootstrapSnapshotSingleNode.PreDurango12.tar.gz"
BootstrapSnapshotSingleNodePreDurango12LocalPath = AssetsDir + BootstrapSnapshotSingleNodePreDurango12ArchiveName
BootstrapSnapshotSingleNodePreDurango12URL = BootstrapSnapshotRawBranch + BootstrapSnapshotSingleNodePreDurango12LocalPath
BootstrapSnapshotSingleNodePreDurango12SHA256URL = BootstrapSnapshotRawBranch + AssetsDir + "sha256sumSingleNode.PreDurango12.txt"

ExtraLocalNetworkDataFilename = "extra-local-network-data.json"

CliInstallationURL = "https://raw.githubusercontent.com/ava-labs/avalanche-cli/main/scripts/install.sh"
Expand Down
32 changes: 27 additions & 5 deletions pkg/subnet/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,12 @@ func (d *LocalDeployer) removeInstalledPlugin(
return d.binaryDownloader.RemoveVM(vmID.String())
}

func getSnapshotLocs(isSingleNode bool, isPreCortina17 bool, isPreDurango11 bool) (string, string, string, string) {
func getSnapshotLocs(
isSingleNode bool,
isPreCortina17 bool,
isPreDurango11 bool,
isPreDurango12 bool,
) (string, string, string, string) {
bootstrapSnapshotArchiveName := ""
url := ""
shaSumURL := ""
Expand All @@ -686,6 +691,11 @@ func getSnapshotLocs(isSingleNode bool, isPreCortina17 bool, isPreDurango11 bool
url = constants.BootstrapSnapshotSingleNodePreDurango11URL
shaSumURL = constants.BootstrapSnapshotSingleNodePreDurango11SHA256URL
pathInShaSum = constants.BootstrapSnapshotSingleNodePreDurango11LocalPath
case isPreDurango12:
bootstrapSnapshotArchiveName = constants.BootstrapSnapshotSingleNodePreDurango12ArchiveName
url = constants.BootstrapSnapshotSingleNodePreDurango12URL
shaSumURL = constants.BootstrapSnapshotSingleNodePreDurango12SHA256URL
pathInShaSum = constants.BootstrapSnapshotSingleNodePreDurango12LocalPath
default:
bootstrapSnapshotArchiveName = constants.BootstrapSnapshotSingleNodeArchiveName
url = constants.BootstrapSnapshotSingleNodeURL
Expand All @@ -704,6 +714,11 @@ func getSnapshotLocs(isSingleNode bool, isPreCortina17 bool, isPreDurango11 bool
url = constants.BootstrapSnapshotPreDurango11URL
shaSumURL = constants.BootstrapSnapshotPreDurango11SHA256URL
pathInShaSum = constants.BootstrapSnapshotPreDurango11LocalPath
case isPreDurango12:
bootstrapSnapshotArchiveName = constants.BootstrapSnapshotPreDurango12ArchiveName
url = constants.BootstrapSnapshotPreDurango12URL
shaSumURL = constants.BootstrapSnapshotPreDurango12SHA256URL
pathInShaSum = constants.BootstrapSnapshotPreDurango12LocalPath
default:
bootstrapSnapshotArchiveName = constants.BootstrapSnapshotArchiveName
url = constants.BootstrapSnapshotURL
Expand All @@ -714,8 +729,13 @@ func getSnapshotLocs(isSingleNode bool, isPreCortina17 bool, isPreDurango11 bool
return bootstrapSnapshotArchiveName, url, shaSumURL, pathInShaSum
}

func getExpectedDefaultSnapshotSHA256Sum(isSingleNode bool, isPreCortina17 bool, isPreDurango11 bool) (string, error) {
_, _, url, path := getSnapshotLocs(isSingleNode, isPreCortina17, isPreDurango11)
func getExpectedDefaultSnapshotSHA256Sum(
isSingleNode bool,
isPreCortina17 bool,
isPreDurango11 bool,
isPreDurango12 bool,
) (string, error) {
_, _, url, path := getSnapshotLocs(isSingleNode, isPreCortina17, isPreDurango11, isPreDurango12)
resp, err := http.Get(url)
if err != nil {
return "", fmt.Errorf("failed downloading sha256 sums: %w", err)
Expand All @@ -741,12 +761,14 @@ func SetDefaultSnapshot(snapshotsDir string, resetCurrentSnapshot bool, avagoVer
var (
isPreCortina17 bool
isPreDurango11 bool
isPreDurango12 bool
)
if avagoVersion != "" {
isPreCortina17 = semver.Compare(avagoVersion, constants.Cortina17Version) < 0
isPreDurango11 = semver.Compare(avagoVersion, constants.Durango11Version) < 0
isPreDurango12 = semver.Compare(avagoVersion, constants.Durango12Version) < 0
}
bootstrapSnapshotArchiveName, url, _, _ := getSnapshotLocs(isSingleNode, isPreCortina17, isPreDurango11)
bootstrapSnapshotArchiveName, url, _, _ := getSnapshotLocs(isSingleNode, isPreCortina17, isPreDurango11, isPreDurango12)
currentBootstrapNamePath := filepath.Join(snapshotsDir, constants.CurrentBootstrapNamePath)
exists, err := storage.FileExists(currentBootstrapNamePath)
if err != nil {
Expand Down Expand Up @@ -781,7 +803,7 @@ func SetDefaultSnapshot(snapshotsDir string, resetCurrentSnapshot bool, avagoVer
if err != nil {
return false, err
}
expectedSum, err := getExpectedDefaultSnapshotSHA256Sum(isSingleNode, isPreCortina17, isPreDurango11)
expectedSum, err := getExpectedDefaultSnapshotSHA256Sum(isSingleNode, isPreCortina17, isPreDurango11, isPreDurango12)
if err != nil {
ux.Logger.PrintToUser("Warning: failure verifying that the local snapshot is the latest one: %s", err)
} else if gotSum != expectedSum {
Expand Down

0 comments on commit 73dcaca

Please sign in to comment.