Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AvalancheGo dep to include latest + ACP-118 #1961

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ linters:
- dupword
- errcheck
- errorlint
- exportloopref
- copyloopvar
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed as of go1.23

- forbidigo
- gci
- goconst
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ARG AVALANCHEGO_NODE_IMAGE="invalid-image" # This value is not intended to be used but silences a warning

# ============= Compilation Stage ================
FROM --platform=$BUILDPLATFORM golang:1.22.12-bullseye AS builder
FROM --platform=$BUILDPLATFORM golang:1.23.7-bullseye AS builder

WORKDIR /build

Expand Down
6 changes: 5 additions & 1 deletion auth/bls.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ func NewBLSFactory(priv *bls.PrivateKey) *BLSFactory {
}

func (b *BLSFactory) Sign(msg []byte) (chain.Auth, error) {
return &BLS{Signer: bls.PublicFromPrivateKey(b.priv), Signature: bls.Sign(msg, b.priv)}, nil
signature, err := bls.Sign(msg, b.priv)
if err != nil {
return nil, err
}
return &BLS{Signer: bls.PublicFromPrivateKey(b.priv), Signature: signature}, nil
}

func (*BLSFactory) MaxUnits() (uint64, uint64) {
Expand Down
6 changes: 4 additions & 2 deletions crypto/bls/private.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import (
"errors"

"github.com/ava-labs/avalanchego/utils/crypto/bls"
"github.com/ava-labs/avalanchego/utils/crypto/bls/signer/localsigner"

blst "github.com/supranational/blst/bindings/go"
Expand Down Expand Up @@ -37,6 +38,7 @@
return pk.PublicKey()
}

func Sign(msg []byte, pk *PrivateKey) *Signature {
return pk.Sign(msg)
func Sign(msg []byte, pk *PrivateKey) (*bls.Signature, error) {
sig := pk.Sign(msg)

Check failure on line 42 in crypto/bls/private.go

View workflow job for this annotation

GitHub Actions / hypersdk-benchmark-tests

assignment mismatch: 1 variable but pk.Sign returns 2 values

Check failure on line 42 in crypto/bls/private.go

View workflow job for this annotation

GitHub Actions / hypersdk-unit-tests

assignment mismatch: 1 variable but pk.Sign returns 2 values
return sig, nil
}
6 changes: 4 additions & 2 deletions crypto/bls/private_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ func TestPrivateKeyBytes(t *testing.T) {

sk, err := GeneratePrivateKey()
require.NoError(err)
sig := Sign(msg, sk)
sig, err := Sign(msg, sk)
require.NoError(err)
skBytes := PrivateKeyToBytes(sk)

sk2, err := PrivateKeyFromBytes(skBytes)
require.NoError(err)
sig2 := Sign(msg, sk2)
sig2, err := Sign(msg, sk2)
require.NoError(err)
sk2Bytes := PrivateKeyToBytes(sk2)

require.Equal(sk, sk2)
Expand Down
6 changes: 4 additions & 2 deletions crypto/bls/public_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ func TestAggregatePublicKeys(t *testing.T) {
require.NoError(err)

// Aggregates 2 signatures
sig1 := Sign(msg, sk1)
sig2 := Sign(msg, sk2)
sig1, err := Sign(msg, sk1)
require.NoError(err)
sig2, err := Sign(msg, sk2)
require.NoError(err)
aggSigs, err := AggregateSignatures([]*Signature{sig1, sig2})
require.NoError(err)

Expand Down
6 changes: 4 additions & 2 deletions crypto/bls/signature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ func TestSignatureBytes(t *testing.T) {

sk, err := GeneratePrivateKey()
require.NoError(err)
sig := Sign(msg, sk)
sig, err := Sign(msg, sk)
require.NoError(err)
sigBytes := SignatureToBytes(sig)

sig2, err := SignatureFromBytes(sigBytes)
Expand All @@ -36,7 +37,8 @@ func TestAggregateSignaturesNoop(t *testing.T) {
sk, err := GeneratePrivateKey()
require.NoError(err)

sig := Sign(msg, sk)
sig, err := Sign(msg, sk)
require.NoError(err)
sigBytes := SignatureToBytes(sig)

aggSig, err := AggregateSignatures([]*Signature{sig})
Expand Down
2 changes: 1 addition & 1 deletion examples/morpheusvm/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ linters:
- depguard
- errcheck
- errorlint
- exportloopref
- copyloopvar
- goconst
- gocritic
- gofmt
Expand Down
4 changes: 2 additions & 2 deletions examples/morpheusvm/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/ava-labs/hypersdk/examples/morpheusvm

go 1.22.9
go 1.23.6

toolchain go1.22.12
toolchain go1.23.7

require (
github.com/ava-labs/avalanchego v1.12.3-warp-verify6.0.20250209190418-217ef3979ea7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be the same version as the top-level go.mod?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, guess it's not enforced by updating the AvalancheGo dep, but we should align them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I thought you were referring to the golang toolchain version, this was indeed the fix. Nice catch 🙏

Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/ava-labs/hypersdk

go 1.22.9
go 1.23.6

toolchain go1.22.12
toolchain go1.23.7

require (
github.com/StephenButtolph/canoto v0.10.2-0.20250210180110-33bcad847890
github.com/ava-labs/avalanchego v1.12.3-warp-verify6.0.20250209190418-217ef3979ea7
github.com/ava-labs/avalanchego v1.12.3-0.20250307191620-6e7a7d51954c
github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593
github.com/gorilla/rpc v1.2.0
github.com/gorilla/websocket v1.5.0
Expand Down Expand Up @@ -40,7 +40,7 @@ require (
github.com/DataDog/zstd v1.5.2 // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
github.com/ava-labs/coreth v0.14.2-verify-interface6 // indirect
github.com/ava-labs/coreth v0.14.1-rc.2.0.20250307191323-71558f89e990 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
Expand Down
12 changes: 8 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/ava-labs/avalanchego v1.12.3-warp-verify6.0.20250209190418-217ef3979ea7 h1:x/R9T399+9yMQpIr1Wkic5YFUvl6s2+zYc8RknNCmBg=
github.com/ava-labs/avalanchego v1.12.3-warp-verify6.0.20250209190418-217ef3979ea7/go.mod h1:wm5BWACjX6Ghi4k+8rDoS+xzPS3TOx2Hvbw6Bx2jnvk=
github.com/ava-labs/coreth v0.14.2-verify-interface6 h1:my1kp6QoTIYkY5f5N5jDey7fp0ZiKKrG63X5OkUcb80=
github.com/ava-labs/coreth v0.14.2-verify-interface6/go.mod h1:X1eaQf7a+dSyG1LD45YnfUpLjzVO3c45cgc7jkqsRcU=
github.com/ava-labs/avalanchego v1.12.3-0.20250307191620-6e7a7d51954c h1:26a0tMz2beFNGwQ45BnbfgVrG/rbIW76Tx38saPxZww=
github.com/ava-labs/avalanchego v1.12.3-0.20250307191620-6e7a7d51954c/go.mod h1:STul4CWMJ6Lp7MWu3OU2Y6vp9hSvFdUNaFfVU8Kf760=
github.com/ava-labs/coreth v0.14.1-rc.2.0.20250307191323-71558f89e990 h1:tMdOyCb0L5mbkesMCIvqeTPvQl3XzD0gEkbSkoMSBzk=
github.com/ava-labs/coreth v0.14.1-rc.2.0.20250307191323-71558f89e990/go.mod h1:ilQRZoMu4fnSx5i8P+r/AhM+/WHhxm3n3tPQudoECb4=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
Expand Down Expand Up @@ -363,6 +363,8 @@ github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
Expand Down Expand Up @@ -451,6 +453,8 @@ github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
Expand Down
2 changes: 1 addition & 1 deletion scripts/constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

set -euo pipefail

AVALANCHE_VERSION=${AVALANCHE_VERSION:-'13c08681c17d0790a94ed8c8ef8a3c88f8bb196d'}
AVALANCHE_VERSION=${AVALANCHE_VERSION:-'6e7a7d51954c094e4b748748ad1fb1a36b4e5695'}
# Optionally specify a separate version of AvalancheGo for building docker images
# Added to support the case there's no such docker image for the specified commit of AvalancheGo
AVALANCHE_DOCKER_VERSION=${AVALANCHE_DOCKER_VERSION:-'v1.12.2'}
Expand Down
7 changes: 1 addition & 6 deletions x/dsmr/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ var (
ErrInvalidBlockTimestamp = errors.New("invalid block timestamp")
ErrInvalidWarpSignature = errors.New("invalid warp signature")
ErrInvalidSignatureType = errors.New("invalid signature type")
ErrFailedToReplicate = errors.New("failed to replicate to sufficient stake")
)

type ChainState interface {
Expand Down Expand Up @@ -212,7 +211,7 @@ func (n *Node[T]) BuildChunk(
return fmt.Errorf("failed to get canonical validator set: %w", err)
}

aggregatedMsg, _, _, ok, err := n.chunkSignatureAggregator.AggregateSignatures(
aggregatedMsg, _, _, err := n.chunkSignatureAggregator.AggregateSignatures(
ctx,
msg,
chunk.bytes,
Expand All @@ -224,10 +223,6 @@ func (n *Node[T]) BuildChunk(
return fmt.Errorf("failed to aggregate signatures: %w", err)
}

if !ok {
return ErrFailedToReplicate
}

bitSetSignature, ok := aggregatedMsg.Signature.(*warp.BitSetSignature)
if !ok {
return ErrInvalidSignatureType
Expand Down
Loading