Skip to content

Commit

Permalink
Bump avago master (#1316)
Browse files Browse the repository at this point in the history
* bump avalanchego to master

* go mod tidy
  • Loading branch information
darioush authored Aug 29, 2024
1 parent d75df50 commit 8e9dbc0
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21.12
require (
github.com/VictoriaMetrics/fastcache v1.12.1
github.com/antithesishq/antithesis-sdk-go v0.3.8
github.com/ava-labs/avalanchego v1.11.11-0.20240821175119-35c66e33f0dc
github.com/ava-labs/avalanchego v1.11.11-monitoring-url.0.20240827194054-0117ab96791c
github.com/cespare/cp v0.1.0
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233
github.com/davecgh/go-spew v1.1.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax
github.com/antithesishq/antithesis-sdk-go v0.3.8 h1:OvGoHxIcOXFJLyn9IJQ5DzByZ3YVAWNBc394ObzDRb8=
github.com/antithesishq/antithesis-sdk-go v0.3.8/go.mod h1:IUpT2DPAKh6i/YhSbt6Gl3v2yvUZjmKncl7U91fup7E=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/ava-labs/avalanchego v1.11.11-0.20240821175119-35c66e33f0dc h1:cUz1N+LJIeQAR0Z6zTBiuZ7s8GqIE5QQbRWs423VFRA=
github.com/ava-labs/avalanchego v1.11.11-0.20240821175119-35c66e33f0dc/go.mod h1:UkyrRDXK2E15Lq2abyae2Pt+JsWvgsg1pe0/AtoMyAM=
github.com/ava-labs/avalanchego v1.11.11-monitoring-url.0.20240827194054-0117ab96791c h1:WAbq2clkTkoxELkCePFe7sqwOvD32SZPzoWtciUmzQI=
github.com/ava-labs/avalanchego v1.11.11-monitoring-url.0.20240827194054-0117ab96791c/go.mod h1:UkyrRDXK2E15Lq2abyae2Pt+JsWvgsg1pe0/AtoMyAM=
github.com/ava-labs/coreth v0.13.8-fixed-genesis-upgrade.0.20240813194342-7635a96aa180 h1:6aIHp7wbyGVYdhHVQUbG7BEcbCMEQ5SYopPPJyipyvk=
github.com/ava-labs/coreth v0.13.8-fixed-genesis-upgrade.0.20240813194342-7635a96aa180/go.mod h1:/wNBVq7J7wlC2Kbov7kk6LV5xZvau7VF9zwTVOeyAjY=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
Expand Down
11 changes: 0 additions & 11 deletions precompile/contracts/warp/predicate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/ava-labs/subnet-evm/predicate"
"github.com/ava-labs/subnet-evm/utils"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
)

const pChainHeight uint64 = 1337
Expand All @@ -49,7 +48,6 @@ var (
numTestVdrs = 10_000
testVdrs []*testValidator
vdrs map[ids.NodeID]*validators.GetValidatorOutput
tests []signatureTest

predicateTests = make(map[string]testutils.PredicateTest)
)
Expand Down Expand Up @@ -132,15 +130,6 @@ func newTestValidator() *testValidator {
}
}

type signatureTest struct {
name string
stateF func(*gomock.Controller) validators.State
quorumNum uint64
quorumDen uint64
msgF func(*require.Assertions) *avalancheWarp.Message
err error
}

// createWarpMessage constructs a signed warp message using the global variable [unsignedMsg]
// and the first [numKeys] signatures from [blsSignatures]
func createWarpMessage(numKeys int) *avalancheWarp.Message {
Expand Down
44 changes: 27 additions & 17 deletions precompile/contracts/warp/signature_verification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,31 @@ import (

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow/validators"
"github.com/ava-labs/avalanchego/snow/validators/validatorsmock"
"github.com/ava-labs/avalanchego/utils/crypto/bls"
"github.com/ava-labs/avalanchego/utils/set"
avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
)

// This test copies the test coverage from https://github.com/ava-labs/avalanchego/blob/v1.10.0/vms/platformvm/warp/signature_test.go#L137.
type signatureTest struct {
name string
stateF func(*gomock.Controller) validators.State
quorumNum uint64
quorumDen uint64
msgF func(*require.Assertions) *avalancheWarp.Message
err error
}

// This test copies the test coverage from https://github.com/ava-labs/avalanchego/blob/0117ab96/vms/platformvm/warp/signature_test.go#L137.
// These tests are only expected to fail if there is a breaking change in AvalancheGo that unexpectedly changes behavior.
func TestSignatureVerification(t *testing.T) {
tests = []signatureTest{
tests := []signatureTest{
{
name: "can't get subnetID",
stateF: func(ctrl *gomock.Controller) validators.State {
state := validators.NewMockState(ctrl)
state := validatorsmock.NewState(ctrl)
state.EXPECT().GetSubnetID(gomock.Any(), sourceChainID).Return(sourceSubnetID, errTest)
return state
},
Expand All @@ -50,7 +60,7 @@ func TestSignatureVerification(t *testing.T) {
{
name: "can't get validator set",
stateF: func(ctrl *gomock.Controller) validators.State {
state := validators.NewMockState(ctrl)
state := validatorsmock.NewState(ctrl)
state.EXPECT().GetSubnetID(gomock.Any(), sourceChainID).Return(sourceSubnetID, nil)
state.EXPECT().GetValidatorSet(gomock.Any(), pChainHeight, sourceSubnetID).Return(nil, errTest)
return state
Expand All @@ -77,7 +87,7 @@ func TestSignatureVerification(t *testing.T) {
{
name: "weight overflow",
stateF: func(ctrl *gomock.Controller) validators.State {
state := validators.NewMockState(ctrl)
state := validatorsmock.NewState(ctrl)
state.EXPECT().GetSubnetID(gomock.Any(), sourceChainID).Return(sourceSubnetID, nil)
state.EXPECT().GetValidatorSet(gomock.Any(), pChainHeight, sourceSubnetID).Return(map[ids.NodeID]*validators.GetValidatorOutput{
testVdrs[0].nodeID: {
Expand Down Expand Up @@ -117,7 +127,7 @@ func TestSignatureVerification(t *testing.T) {
{
name: "invalid bit set index",
stateF: func(ctrl *gomock.Controller) validators.State {
state := validators.NewMockState(ctrl)
state := validatorsmock.NewState(ctrl)
state.EXPECT().GetSubnetID(gomock.Any(), sourceChainID).Return(sourceSubnetID, nil)
state.EXPECT().GetValidatorSet(gomock.Any(), pChainHeight, sourceSubnetID).Return(vdrs, nil)
return state
Expand Down Expand Up @@ -147,7 +157,7 @@ func TestSignatureVerification(t *testing.T) {
{
name: "unknown index",
stateF: func(ctrl *gomock.Controller) validators.State {
state := validators.NewMockState(ctrl)
state := validatorsmock.NewState(ctrl)
state.EXPECT().GetSubnetID(gomock.Any(), sourceChainID).Return(sourceSubnetID, nil)
state.EXPECT().GetValidatorSet(gomock.Any(), pChainHeight, sourceSubnetID).Return(vdrs, nil)
return state
Expand Down Expand Up @@ -180,7 +190,7 @@ func TestSignatureVerification(t *testing.T) {
{
name: "insufficient weight",
stateF: func(ctrl *gomock.Controller) validators.State {
state := validators.NewMockState(ctrl)
state := validatorsmock.NewState(ctrl)
state.EXPECT().GetSubnetID(gomock.Any(), sourceChainID).Return(sourceSubnetID, nil)
state.EXPECT().GetValidatorSet(gomock.Any(), pChainHeight, sourceSubnetID).Return(vdrs, nil)
return state
Expand Down Expand Up @@ -224,7 +234,7 @@ func TestSignatureVerification(t *testing.T) {
{
name: "can't parse sig",
stateF: func(ctrl *gomock.Controller) validators.State {
state := validators.NewMockState(ctrl)
state := validatorsmock.NewState(ctrl)
state.EXPECT().GetSubnetID(gomock.Any(), sourceChainID).Return(sourceSubnetID, nil)
state.EXPECT().GetValidatorSet(gomock.Any(), pChainHeight, sourceSubnetID).Return(vdrs, nil)
return state
Expand Down Expand Up @@ -258,7 +268,7 @@ func TestSignatureVerification(t *testing.T) {
{
name: "no validators",
stateF: func(ctrl *gomock.Controller) validators.State {
state := validators.NewMockState(ctrl)
state := validatorsmock.NewState(ctrl)
state.EXPECT().GetSubnetID(gomock.Any(), sourceChainID).Return(sourceSubnetID, nil)
state.EXPECT().GetValidatorSet(gomock.Any(), pChainHeight, sourceSubnetID).Return(nil, nil)
return state
Expand Down Expand Up @@ -293,7 +303,7 @@ func TestSignatureVerification(t *testing.T) {
{
name: "invalid signature (substitute)",
stateF: func(ctrl *gomock.Controller) validators.State {
state := validators.NewMockState(ctrl)
state := validatorsmock.NewState(ctrl)
state.EXPECT().GetSubnetID(gomock.Any(), sourceChainID).Return(sourceSubnetID, nil)
state.EXPECT().GetValidatorSet(gomock.Any(), pChainHeight, sourceSubnetID).Return(vdrs, nil)
return state
Expand Down Expand Up @@ -337,7 +347,7 @@ func TestSignatureVerification(t *testing.T) {
{
name: "invalid signature (missing one)",
stateF: func(ctrl *gomock.Controller) validators.State {
state := validators.NewMockState(ctrl)
state := validatorsmock.NewState(ctrl)
state.EXPECT().GetSubnetID(gomock.Any(), sourceChainID).Return(sourceSubnetID, nil)
state.EXPECT().GetValidatorSet(gomock.Any(), pChainHeight, sourceSubnetID).Return(vdrs, nil)
return state
Expand Down Expand Up @@ -377,7 +387,7 @@ func TestSignatureVerification(t *testing.T) {
{
name: "invalid signature (extra one)",
stateF: func(ctrl *gomock.Controller) validators.State {
state := validators.NewMockState(ctrl)
state := validatorsmock.NewState(ctrl)
state.EXPECT().GetSubnetID(gomock.Any(), sourceChainID).Return(sourceSubnetID, nil)
state.EXPECT().GetValidatorSet(gomock.Any(), pChainHeight, sourceSubnetID).Return(vdrs, nil)
return state
Expand Down Expand Up @@ -422,7 +432,7 @@ func TestSignatureVerification(t *testing.T) {
{
name: "valid signature",
stateF: func(ctrl *gomock.Controller) validators.State {
state := validators.NewMockState(ctrl)
state := validatorsmock.NewState(ctrl)
state.EXPECT().GetSubnetID(gomock.Any(), sourceChainID).Return(sourceSubnetID, nil)
state.EXPECT().GetValidatorSet(gomock.Any(), pChainHeight, sourceSubnetID).Return(vdrs, nil)
return state
Expand Down Expand Up @@ -466,7 +476,7 @@ func TestSignatureVerification(t *testing.T) {
{
name: "valid signature (boundary)",
stateF: func(ctrl *gomock.Controller) validators.State {
state := validators.NewMockState(ctrl)
state := validatorsmock.NewState(ctrl)
state.EXPECT().GetSubnetID(gomock.Any(), sourceChainID).Return(sourceSubnetID, nil)
state.EXPECT().GetValidatorSet(gomock.Any(), pChainHeight, sourceSubnetID).Return(vdrs, nil)
return state
Expand Down Expand Up @@ -510,7 +520,7 @@ func TestSignatureVerification(t *testing.T) {
{
name: "valid signature (missing key)",
stateF: func(ctrl *gomock.Controller) validators.State {
state := validators.NewMockState(ctrl)
state := validatorsmock.NewState(ctrl)
state.EXPECT().GetSubnetID(gomock.Any(), sourceChainID).Return(sourceSubnetID, nil)
state.EXPECT().GetValidatorSet(gomock.Any(), pChainHeight, sourceSubnetID).Return(map[ids.NodeID]*validators.GetValidatorOutput{
testVdrs[0].nodeID: {
Expand Down Expand Up @@ -571,7 +581,7 @@ func TestSignatureVerification(t *testing.T) {
{
name: "valid signature (duplicate key)",
stateF: func(ctrl *gomock.Controller) validators.State {
state := validators.NewMockState(ctrl)
state := validatorsmock.NewState(ctrl)
state.EXPECT().GetSubnetID(gomock.Any(), sourceChainID).Return(sourceSubnetID, nil)
state.EXPECT().GetValidatorSet(gomock.Any(), pChainHeight, sourceSubnetID).Return(map[ids.NodeID]*validators.GetValidatorOutput{
testVdrs[0].nodeID: {
Expand Down
2 changes: 1 addition & 1 deletion scripts/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# shellcheck disable=SC2034

# Don't export them as they're used in the context of other calls
AVALANCHE_VERSION=${AVALANCHE_VERSION:-'35c66e33'}
AVALANCHE_VERSION=${AVALANCHE_VERSION:-'0117ab96'}
GINKGO_VERSION=${GINKGO_VERSION:-'v2.2.0'}

# This won't be used, but it's here to make code syncs easier
Expand Down
3 changes: 2 additions & 1 deletion warp/validators/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow/validators"
"github.com/ava-labs/avalanchego/snow/validators/validatorsmock"
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/subnet-evm/utils"
"github.com/stretchr/testify/require"
Expand All @@ -22,7 +23,7 @@ func TestGetValidatorSetPrimaryNetwork(t *testing.T) {
mySubnetID := ids.GenerateTestID()
otherSubnetID := ids.GenerateTestID()

mockState := validators.NewMockState(ctrl)
mockState := validatorsmock.NewState(ctrl)
snowCtx := utils.TestSnowContext()
snowCtx.SubnetID = mySubnetID
snowCtx.ValidatorState = mockState
Expand Down

0 comments on commit 8e9dbc0

Please # to comment.