From 133523bd579e4bede549a71c9bdea71ac7a5af70 Mon Sep 17 00:00:00 2001 From: Josh Siegel Date: Fri, 2 Dec 2022 01:03:32 +0000 Subject: [PATCH] algo/fix: switch to using last round --- .../sandbox-algorand/images/algod/Dockerfile | 2 +- node/go.mod | 2 +- node/go.sum | 3 +++ node/pkg/watchers/algorand/watcher.go | 22 ++++++++++--------- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/algorand/sandbox-algorand/images/algod/Dockerfile b/algorand/sandbox-algorand/images/algod/Dockerfile index 1c1d26fdb..2c515600b 100644 --- a/algorand/sandbox-algorand/images/algod/Dockerfile +++ b/algorand/sandbox-algorand/images/algod/Dockerfile @@ -39,7 +39,7 @@ COPY . /tmp RUN /tmp/images/algod/install.sh \ -d "${BIN_DIR}" \ -u "https://github.com/algorand/go-algorand" \ - -b "v3.11.2-stable" \ + -b "v3.12.2-stable" \ -s "" # Configure network diff --git a/node/go.mod b/node/go.mod index dcc0680fe..c22efaf2f 100644 --- a/node/go.mod +++ b/node/go.mod @@ -48,7 +48,7 @@ require ( require ( cloud.google.com/go/logging v1.4.2 cloud.google.com/go/pubsub v1.25.1 - github.com/algorand/go-algorand-sdk v1.15.0 + github.com/algorand/go-algorand-sdk v1.23.0 github.com/benbjohnson/clock v1.3.0 github.com/blendle/zapdriver v1.3.1 github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce diff --git a/node/go.sum b/node/go.sum index 34d5008ee..59d59d453 100644 --- a/node/go.sum +++ b/node/go.sum @@ -147,6 +147,8 @@ github.com/algorand/falcon v0.0.0-20220130164023-c9e1d466f123/go.mod h1:OkQyHlGv github.com/algorand/go-algorand v0.0.0-20220323144801-17c0feef002f/go.mod h1:ehGHRKxrRgN0fF+vm6kHLykiQ1ana3qc52N5UQzkFPM= github.com/algorand/go-algorand-sdk v1.15.0 h1:b93A5iOdzbgwRUT1xDkIeNho37fEZBhIesiMS9uOobo= github.com/algorand/go-algorand-sdk v1.15.0/go.mod h1:IM0k8f3UnqGoxZ0U560r3SwORHtvCT2gQfvgMOEm0rg= +github.com/algorand/go-algorand-sdk v1.23.0 h1:wlEV6OgDVc/sLeF2y41bwNG/Lr8EoMnN87Ur8N2Gyyo= +github.com/algorand/go-algorand-sdk v1.23.0/go.mod h1:7i2peZBcE48kfoxNZnLA+mklKh812jBKvQ+t4bn0KBQ= github.com/algorand/go-codec v1.1.8/go.mod h1:XhzVs6VVyWMLu6cApb9/192gBjGRVGm5cX5j203Heg4= github.com/algorand/go-codec/codec v1.1.8 h1:lsFuhcOH2LiEhpBH3BVUUkdevVmwCRyvb7FCAAPeY6U= github.com/algorand/go-codec/codec v1.1.8/go.mod h1:tQ3zAJ6ijTps6V+wp8KsGDnPC2uhHVC7ANyrtkIY0bA= @@ -597,6 +599,7 @@ github.com/googleapis/gax-go/v2 v2.6.0 h1:SXk3ABtQYDT/OH8jAyvEOQ58mgawq5C4o/4/89 github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e h1:JKmoR8x90Iww1ks85zJ1lfDGgIiMDuIptTOhJq+zKyg= github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= diff --git a/node/pkg/watchers/algorand/watcher.go b/node/pkg/watchers/algorand/watcher.go index 0d3fa1ad9..ff4d11f92 100644 --- a/node/pkg/watchers/algorand/watcher.go +++ b/node/pkg/watchers/algorand/watcher.go @@ -176,7 +176,9 @@ func (e *Watcher) Run(ctx context.Context) error { return err } - e.next_round = status.NextVersionRound + e.next_round = status.LastRound + 1 + + logger.Info(fmt.Sprintf("first block %d", e.next_round)) for { select { @@ -220,9 +222,8 @@ func (e *Watcher) Run(ctx context.Context) error { continue } - if e.next_round < status.NextVersionRound { + if e.next_round <= status.LastRound { for { - logger.Info(fmt.Sprintf("inspecting block %d", e.next_round)) block, err := algodClient.Block(e.next_round).Do(context.Background()) if err != nil { logger.Error(fmt.Sprintf("algodClient.Block %d: %s", e.next_round, err.Error())) @@ -239,17 +240,18 @@ func (e *Watcher) Run(ctx context.Context) error { } e.next_round = e.next_round + 1 - currentAlgorandHeight.Set(float64(e.next_round)) - p2p.DefaultRegistry.SetNetworkStats(vaa.ChainIDAlgorand, &gossipv1.Heartbeat_Network{ - Height: int64(e.next_round), - ContractAddress: fmt.Sprintf("%d", e.appid), - }) - - if e.next_round == status.NextVersionRound { + if e.next_round > status.LastRound { break } } } + + currentAlgorandHeight.Set(float64(status.LastRound)) + p2p.DefaultRegistry.SetNetworkStats(vaa.ChainIDAlgorand, &gossipv1.Heartbeat_Network{ + Height: int64(status.LastRound), + ContractAddress: fmt.Sprintf("%d", e.appid), + }) + readiness.SetReady(common.ReadinessAlgorandSyncing) } }