Skip to content

Commit

Permalink
Merge branch 'master' into acp-118
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-kim authored Jan 30, 2025
2 parents ac9eaaa + f5feb05 commit dd2838b
Show file tree
Hide file tree
Showing 84 changed files with 2,348 additions and 1,242 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
LICENSE
*.md

Dockerfile

# Ignore all dockerfiles not just the main one
Dockerfile*
22 changes: 11 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ FROM --platform=$BUILDPLATFORM golang:$GO_VERSION-bullseye AS builder
WORKDIR /build
# Copy and download avalanche dependencies using go mod
COPY go.mod .
COPY go.sum .
RUN go mod download
# Copy the code into the container
COPY . .
# Ensure pre-existing builds are not available for inclusion in the final image
RUN [ -d ./build ] && rm -rf ./build/* || true
ARG TARGETPLATFORM
ARG BUILDPLATFORM
Expand All @@ -25,17 +36,6 @@ RUN if [ "$TARGETPLATFORM" = "linux/arm64" ] && [ "$BUILDPLATFORM" != "linux/arm
echo "export CC=gcc" > ./build_env.sh \
; fi
# Copy and download avalanche dependencies using go mod
COPY go.mod .
COPY go.sum .
RUN go mod download
# Copy the code into the container
COPY . .
# Ensure pre-existing builds are not available for inclusion in the final image
RUN [ -d ./build ] && rm -rf ./build/* || true
# Build avalanchego. The build environment is configured with build_env.sh from the step
# enabling cross-compilation.
ARG RACE_FLAG=""
Expand Down
9 changes: 5 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"github.com/ava-labs/avalanchego/utils/compression"
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/utils/crypto/bls"
"github.com/ava-labs/avalanchego/utils/crypto/bls/signer/localsigner"
"github.com/ava-labs/avalanchego/utils/ips"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/perms"
Expand Down Expand Up @@ -640,7 +641,7 @@ func getStakingTLSCert(v *viper.Viper) (tls.Certificate, error) {

func getStakingSigner(v *viper.Viper) (bls.Signer, error) {
if v.GetBool(StakingEphemeralSignerEnabledKey) {
key, err := bls.NewSigner()
key, err := localsigner.New()
if err != nil {
return nil, fmt.Errorf("couldn't generate ephemeral signing key: %w", err)
}
Expand All @@ -653,7 +654,7 @@ func getStakingSigner(v *viper.Viper) (bls.Signer, error) {
if err != nil {
return nil, fmt.Errorf("unable to decode base64 content: %w", err)
}
key, err := bls.SecretKeyFromBytes(signerKeyContent)
key, err := localsigner.FromBytes(signerKeyContent)
if err != nil {
return nil, fmt.Errorf("couldn't parse signing key: %w", err)
}
Expand All @@ -667,7 +668,7 @@ func getStakingSigner(v *viper.Viper) (bls.Signer, error) {
if err != nil {
return nil, err
}
key, err := bls.SecretKeyFromBytes(signingKeyBytes)
key, err := localsigner.FromBytes(signingKeyBytes)
if err != nil {
return nil, fmt.Errorf("couldn't parse signing key: %w", err)
}
Expand All @@ -678,7 +679,7 @@ func getStakingSigner(v *viper.Viper) (bls.Signer, error) {
return nil, errMissingStakingSigningKeyFile
}

key, err := bls.NewSigner()
key, err := localsigner.New()
if err != nil {
return nil, fmt.Errorf("couldn't generate new signing key: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/DataDog/zstd v1.5.2
github.com/NYTimes/gziphandler v1.1.1
github.com/antithesishq/antithesis-sdk-go v0.3.8
github.com/ava-labs/coreth v0.14.1-rc.1
github.com/ava-labs/coreth v0.14.2-verify-interface4
github.com/ava-labs/ledger-avalanche/go v0.0.0-20241009183145-e6f90a8a1a60
github.com/btcsuite/btcd/btcutil v1.1.3
github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ github.com/antithesishq/antithesis-sdk-go v0.3.8/go.mod h1:IUpT2DPAKh6i/YhSbt6Gl
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/coreth v0.14.1-rc.1 h1:U72XlRm/fKyASmjThsWzfO/ZRvu1kaONFaX+KdJNxIc=
github.com/ava-labs/coreth v0.14.1-rc.1/go.mod h1:lxDSXLcrszMo0N/PVJzfZ//H+bRwXF/KQWtpEYgXZqM=
github.com/ava-labs/coreth v0.14.2-verify-interface4 h1:AYeN8R6ZnNu/K8KwBQD4ELphvLpvNxAjkX3SBcJ+bps=
github.com/ava-labs/coreth v0.14.2-verify-interface4/go.mod h1:wQaeiolUP0vCHS1mC0lIMXzHF05vbjugSLCBFDnO4Gs=
github.com/ava-labs/ledger-avalanche/go v0.0.0-20241009183145-e6f90a8a1a60 h1:EL66gtXOAwR/4KYBjOV03LTWgkEXvLePribLlJNu4g0=
github.com/ava-labs/ledger-avalanche/go v0.0.0-20241009183145-e6f90a8a1a60/go.mod h1:/7qKobTfbzBu7eSTVaXMTr56yTYk4j2Px6/8G+idxHo=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
Expand Down
4 changes: 2 additions & 2 deletions network/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/bloom"
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/utils/crypto/bls"
"github.com/ava-labs/avalanchego/utils/crypto/bls/signer/localsigner"
"github.com/ava-labs/avalanchego/utils/ips"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/math/meter"
Expand Down Expand Up @@ -175,7 +175,7 @@ func newTestNetwork(t *testing.T, count int) (*testDialer, []*testListener, []id
require.NoError(t, err)
nodeID := ids.NodeIDFromCert(cert)

blsKey, err := bls.NewSigner()
blsKey, err := localsigner.New()
require.NoError(t, err)

config := defaultConfig
Expand Down
3 changes: 2 additions & 1 deletion network/p2p/acp118/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/ava-labs/avalanchego/proto/pb/sdk"
"github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/utils/crypto/bls"
"github.com/ava-labs/avalanchego/utils/crypto/bls/signer/localsigner"
"github.com/ava-labs/avalanchego/utils/set"
"github.com/ava-labs/avalanchego/vms/platformvm/warp"
)
Expand Down Expand Up @@ -73,7 +74,7 @@ func TestHandler(t *testing.T) {
require := require.New(t)

ctx := context.Background()
sk, err := bls.NewSigner()
sk, err := localsigner.New()
require.NoError(err)
pk := sk.PublicKey()
networkID := uint32(123)
Expand Down
4 changes: 2 additions & 2 deletions network/peer/ip_signer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

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

func TestIPSigner(t *testing.T) {
Expand All @@ -28,7 +28,7 @@ func TestIPSigner(t *testing.T) {
require.NoError(err)

tlsKey := tlsCert.PrivateKey.(crypto.Signer)
blsKey, err := bls.NewSigner()
blsKey, err := localsigner.New()
require.NoError(err)

s := NewIPSigner(dynIP, tlsKey, blsKey)
Expand Down
3 changes: 2 additions & 1 deletion network/peer/ip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

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

func TestSignedIpVerify(t *testing.T) {
Expand All @@ -21,7 +22,7 @@ func TestSignedIpVerify(t *testing.T) {
cert1, err := staking.ParseCertificate(tlsCert1.Leaf.Raw)
require.NoError(t, err)
tlsKey1 := tlsCert1.PrivateKey.(crypto.Signer)
blsKey1, err := bls.NewSigner()
blsKey1, err := localsigner.New()
require.NoError(t, err)

tlsCert2, err := staking.NewTLSCert()
Expand Down
8 changes: 4 additions & 4 deletions network/peer/peer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/ava-labs/avalanchego/upgrade"
"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/utils/crypto/bls"
"github.com/ava-labs/avalanchego/utils/crypto/bls/signer/localsigner"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/math/meter"
"github.com/ava-labs/avalanchego/utils/resource"
Expand Down Expand Up @@ -111,7 +111,7 @@ func newRawTestPeer(t *testing.T, config Config) *rawTestPeer {
1,
))
tls := tlsCert.PrivateKey.(crypto.Signer)
bls, err := bls.NewSigner()
bls, err := localsigner.New()
require.NoError(err)

config.IPSigner = NewIPSigner(ip, tls, bls)
Expand Down Expand Up @@ -327,7 +327,7 @@ func TestInvalidBLSKeyDisconnects(t *testing.T) {
1,
))

bogusBLSKey, err := bls.NewSigner()
bogusBLSKey, err := localsigner.New()
require.NoError(err)
require.NoError(rawPeer1.config.Validators.AddStaker(
constants.PrimaryNetworkID,
Expand All @@ -348,7 +348,7 @@ func TestInvalidBLSKeyDisconnects(t *testing.T) {
func TestShouldDisconnect(t *testing.T) {
peerID := ids.GenerateTestNodeID()
txID := ids.GenerateTestID()
blsKey, err := bls.NewSigner()
blsKey, err := localsigner.New()
require.NoError(t, err)

tests := []struct {
Expand Down
4 changes: 2 additions & 2 deletions network/peer/test_peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/ava-labs/avalanchego/upgrade"
"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/utils/crypto/bls"
"github.com/ava-labs/avalanchego/utils/crypto/bls/signer/localsigner"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/math/meter"
"github.com/ava-labs/avalanchego/utils/resource"
Expand Down Expand Up @@ -101,7 +101,7 @@ func StartTestPeer(
}

tlsKey := tlsCert.PrivateKey.(crypto.Signer)
blsKey, err := bls.NewSigner()
blsKey, err := localsigner.New()
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions network/test_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/ava-labs/avalanchego/upgrade"
"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/utils/crypto/bls"
"github.com/ava-labs/avalanchego/utils/crypto/bls/signer/localsigner"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/math/meter"
"github.com/ava-labs/avalanchego/utils/resource"
Expand Down Expand Up @@ -84,7 +84,7 @@ func NewTestNetworkConfig(
return nil, err
}

blsKey, err := bls.NewSigner()
blsKey, err := localsigner.New()
if err != nil {
return nil, err
}
Expand Down
4 changes: 4 additions & 0 deletions snow/consensus/snowman/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,8 @@ type Consensus interface {
// RecordPoll collects the results of a network poll. Assumes all decisions
// have been previously added. Returns if a critical error has occurred.
RecordPoll(context.Context, bag.Bag[ids.ID]) error

// GetParent returns the ID of the parent block with the given ID, if it is known.
// Returns (Empty, false) if no such parent block is known.
GetParent(id ids.ID) (ids.ID, bool)
}
Loading

0 comments on commit dd2838b

Please sign in to comment.