diff --git a/abci/extend_vote.go b/abci/extend_vote.go index 2947f65d..054f72d7 100644 --- a/abci/extend_vote.go +++ b/abci/extend_vote.go @@ -14,13 +14,6 @@ import ( voteexthandler "github.com/node101-io/pulsar-chain/x/voteexthandler/types" ) -var hardcoded = [32]byte{ - 0x7a, 0x13, 0x9f, 0x42, 0xd1, 0x8c, 0x5e, 0xa7, - 0x2b, 0x6d, 0xf0, 0x91, 0x3c, 0x47, 0xb8, 0x0e, - 0x55, 0x1a, 0xcd, 0x72, 0x98, 0x04, 0xe6, 0xaf, - 0x39, 0xb2, 0x7c, 0x5d, 0x11, 0x8e, 0xf3, 0x64, -} - // ValidatorInfo represents a validator in the set type ValidatorInfo struct { MinaAddress string diff --git a/abci/helpers.go b/abci/helpers.go index 5aca897d..429b80cc 100644 --- a/abci/helpers.go +++ b/abci/helpers.go @@ -242,10 +242,10 @@ func (h *VoteExtHandler) buildExpectedVoteExtBody(height int64) (voteexthandler. } return voteexthandler.Body{ - InitialValidatorSetRoot: hardcoded[:], + InitialValidatorSetRoot: voteextkeeper.HardcodedValidatorSetRoot[:], InitialBlockHeight: height - 2, InitialStateRoot: initialStateRoot, - NewValidatorSetRoot: hardcoded[:], + NewValidatorSetRoot: voteextkeeper.HardcodedValidatorSetRoot[:], NewBlockHeight: height - 1, NewStateRoot: newStateRoot, }, nil diff --git a/abci/pre_blocker.go b/abci/pre_blocker.go index 74f460cf..dd8004d7 100644 --- a/abci/pre_blocker.go +++ b/abci/pre_blocker.go @@ -1,7 +1,6 @@ package vote_ext import ( - "encoding/hex" "encoding/json" "fmt" @@ -37,15 +36,14 @@ func (h *VoteExtHandler) PreBlocker() sdk.PreBlocker { if err := json.Unmarshal(ext, &ve); err != nil { continue } - - sigHex := hex.EncodeToString(ve.Signature) idx := fmt.Sprintf("%d/%s", targetHeight, minaAddress) record := types.VoteExt{ Index: idx, Height: targetHeight, ValidatorAddr: ve.MinaAddress, - Signature: sigHex, + Signature: ve.Signature, + Body: &ve.VoteExtBody, } err := h.voteextKeeper.SetVoteExt(ctx, record) diff --git a/docs/static/openapi.json b/docs/static/openapi.json index 0d8ab2a4..e9093c1f 100644 --- a/docs/static/openapi.json +++ b/docs/static/openapi.json @@ -1 +1 @@ -{"id":"github.com/node101-io/pulsar-chain","consumes":["application/json"],"produces":["application/json"],"swagger":"2.0","info":{"description":"Chain github.com/node101-io/pulsar-chain REST API","title":"HTTP API Console","contact":{"name":"github.com/node101-io/pulsar-chain"},"version":"version not set"},"paths":{"/node101-io/pulsar-chain/keyregistry/v1/get_user_cosmos_address/{user_mina_address}":{"get":{"tags":["Query"],"summary":"GetUserCosmosAddress Queries a list of GetUserCosmosAddress items.","operationId":"GithubComnode101IopulsarChainQuery_GetUserCosmosAddress","parameters":[{"type":"string","format":"byte","name":"user_mina_address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryGetUserCosmosAddressResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/get_user_mina_address/{user_cosmos_address}":{"get":{"tags":["Query"],"summary":"GetUserMinaAddress Queries a list of GetUserMinaAddress items.","operationId":"GithubComnode101IopulsarChainQuery_GetUserMinaAddress","parameters":[{"type":"string","format":"byte","name":"user_cosmos_address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryGetUserMinaAddressResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/get_validator_cosmos_pub_key/{validator_mina_pub_key}":{"get":{"tags":["Query"],"summary":"GetValidatorCosmosAddress Queries a list of GetValidatorCosmosAddress items.","operationId":"GithubComnode101IopulsarChainQuery_GetValidatorCosmosPubKey","parameters":[{"type":"string","format":"byte","name":"validator_mina_pub_key","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryGetValidatorCosmosPubKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/get_validator_mina_pub_key/{validator_cosmos_pub_key}":{"get":{"tags":["Query"],"summary":"GetValidatorMinaAddress Queries a list of GetValidatorMinaAddress items.","operationId":"GithubComnode101IopulsarChainQuery_GetValidatorMinaPubKey","parameters":[{"type":"string","format":"byte","name":"validator_cosmos_pub_key","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryGetValidatorMinaPubKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComnode101IopulsarChainQuery_ParamsMixin9","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/voteexthandler/v1/get_all_vote_exts":{"get":{"tags":["Query"],"summary":"GetAllVoteExts Queries a list of GetAllVoteExts items.","operationId":"GithubComnode101IopulsarChainQuery_GetAllVoteExts","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.voteexthandler.v1.QueryGetAllVoteExtsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/voteexthandler/v1/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComnode101IopulsarChainQuery_ParamsMixin13","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.voteexthandler.v1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/voteexthandler/v1/voteexts_by_height/{height}":{"get":{"tags":["Query"],"summary":"VoteextsByHeight Queries a list of VoteextsByHeight items.","operationId":"GithubComnode101IopulsarChainQuery_VoteextsByHeight","parameters":[{"type":"string","format":"uint64","name":"height","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.voteexthandler.v1.QueryVoteextsByHeightResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/pulsar/pulsar/v1/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComnode101IopulsarChainQuery_Params","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsar.pulsar.v1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}}},"definitions":{"google.protobuf.Any":{"type":"object","properties":{"@type":{"type":"string"}},"additionalProperties":{}},"google.rpc.Status":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"details":{"type":"array","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}},"message":{"type":"string"}}},"pulsar.pulsar.v1.Params":{"description":"Params defines the parameters for the module.","type":"object"},"pulsar.pulsar.v1.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/pulsar.pulsar.v1.Params"}}},"pulsarchain.keyregistry.v1.Params":{"description":"Params defines the parameters for the module.","type":"object"},"pulsarchain.keyregistry.v1.QueryGetUserCosmosAddressResponse":{"description":"QueryGetUserCosmosAddressResponse defines the QueryGetUserCosmosAddressResponse message.","type":"object","properties":{"user_cosmos_address":{"type":"string","format":"byte"}}},"pulsarchain.keyregistry.v1.QueryGetUserMinaAddressResponse":{"description":"QueryGetUserMinaAddressResponse defines the QueryGetUserMinaAddressResponse message.","type":"object","properties":{"user_mina_address":{"type":"string","format":"byte"}}},"pulsarchain.keyregistry.v1.QueryGetValidatorCosmosPubKeyResponse":{"description":"QueryGetValidatorCosmosAddressResponse defines the QueryGetValidatorCosmosAddressResponse message.","type":"object","properties":{"validator_cosmos_pub_key":{"type":"string","format":"byte"}}},"pulsarchain.keyregistry.v1.QueryGetValidatorMinaPubKeyResponse":{"description":"QueryGetValidatorMinaAddressResponse defines the QueryGetValidatorMinaAddressResponse message.","type":"object","properties":{"validator_mina_pub_key":{"type":"string","format":"byte"}}},"pulsarchain.keyregistry.v1.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/pulsarchain.keyregistry.v1.Params"}}},"pulsarchain.voteexthandler.v1.Params":{"description":"Params defines the parameters for the module.","type":"object"},"pulsarchain.voteexthandler.v1.QueryGetAllVoteExtsResponse":{"description":"QueryGetAllVoteExtsResponse defines the QueryGetAllVoteExtsResponse message.","type":"object","properties":{"vote_exts":{"type":"array","items":{"type":"object","$ref":"#/definitions/pulsarchain.voteexthandler.v1.VoteExt"}}}},"pulsarchain.voteexthandler.v1.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/pulsarchain.voteexthandler.v1.Params"}}},"pulsarchain.voteexthandler.v1.QueryVoteextsByHeightResponse":{"description":"QueryVoteextsByHeightResponse defines the QueryVoteextsByHeightResponse message.","type":"object","properties":{"vote_exts":{"type":"array","items":{"type":"object","$ref":"#/definitions/pulsarchain.voteexthandler.v1.VoteExt"}}}},"pulsarchain.voteexthandler.v1.VoteExt":{"description":"GenesisState defines the voteexthandler module's genesis state.","type":"object","properties":{"height":{"type":"string","format":"uint64"},"index":{"type":"string"},"signature":{"type":"string"},"validator_addr":{"type":"string"}}}},"tags":[{"name":"Query"},{"name":"Msg"}]} \ No newline at end of file +{"id":"github.com/node101-io/pulsar-chain","consumes":["application/json"],"produces":["application/json"],"swagger":"2.0","info":{"description":"Chain github.com/node101-io/pulsar-chain REST API","title":"HTTP API Console","contact":{"name":"github.com/node101-io/pulsar-chain"},"version":"version not set"},"paths":{"/node101-io/pulsar-chain/keyregistry/v1/get_user_cosmos_address/{user_mina_address}":{"get":{"tags":["Query"],"summary":"GetUserCosmosAddress Queries a list of GetUserCosmosAddress items.","operationId":"GithubComnode101IopulsarChainQuery_GetUserCosmosAddress","parameters":[{"type":"string","format":"byte","name":"user_mina_address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryGetUserCosmosAddressResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/get_user_mina_address/{user_cosmos_address}":{"get":{"tags":["Query"],"summary":"GetUserMinaAddress Queries a list of GetUserMinaAddress items.","operationId":"GithubComnode101IopulsarChainQuery_GetUserMinaAddress","parameters":[{"type":"string","format":"byte","name":"user_cosmos_address","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryGetUserMinaAddressResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/get_validator_cosmos_pub_key/{validator_mina_pub_key}":{"get":{"tags":["Query"],"summary":"GetValidatorCosmosAddress Queries a list of GetValidatorCosmosAddress items.","operationId":"GithubComnode101IopulsarChainQuery_GetValidatorCosmosPubKey","parameters":[{"type":"string","format":"byte","name":"validator_mina_pub_key","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryGetValidatorCosmosPubKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/get_validator_mina_pub_key/{validator_cosmos_pub_key}":{"get":{"tags":["Query"],"summary":"GetValidatorMinaAddress Queries a list of GetValidatorMinaAddress items.","operationId":"GithubComnode101IopulsarChainQuery_GetValidatorMinaPubKey","parameters":[{"type":"string","format":"byte","name":"validator_cosmos_pub_key","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryGetValidatorMinaPubKeyResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/keyregistry/v1/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComnode101IopulsarChainQuery_ParamsMixin9","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.keyregistry.v1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/voteexthandler/v1/get_all_vote_exts":{"get":{"tags":["Query"],"summary":"GetAllVoteExts Queries a list of GetAllVoteExts items.","operationId":"GithubComnode101IopulsarChainQuery_GetAllVoteExts","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.voteexthandler.v1.QueryGetAllVoteExtsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/voteexthandler/v1/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComnode101IopulsarChainQuery_ParamsMixin13","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.voteexthandler.v1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/node101-io/pulsar-chain/voteexthandler/v1/voteexts_by_height/{height}":{"get":{"tags":["Query"],"summary":"VoteextsByHeight Queries a list of VoteextsByHeight items.","operationId":"GithubComnode101IopulsarChainQuery_VoteextsByHeight","parameters":[{"type":"string","format":"uint64","name":"height","in":"path","required":true}],"responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsarchain.voteexthandler.v1.QueryVoteextsByHeightResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}},"/pulsar/pulsar/v1/params":{"get":{"tags":["Query"],"summary":"Parameters queries the parameters of the module.","operationId":"GithubComnode101IopulsarChainQuery_Params","responses":{"200":{"description":"A successful response.","schema":{"$ref":"#/definitions/pulsar.pulsar.v1.QueryParamsResponse"}},"default":{"description":"An unexpected error response.","schema":{"$ref":"#/definitions/google.rpc.Status"}}}}}},"definitions":{"google.protobuf.Any":{"type":"object","properties":{"@type":{"type":"string"}},"additionalProperties":{}},"google.rpc.Status":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"details":{"type":"array","items":{"type":"object","$ref":"#/definitions/google.protobuf.Any"}},"message":{"type":"string"}}},"pulsar.pulsar.v1.Params":{"description":"Params defines the parameters for the module.","type":"object"},"pulsar.pulsar.v1.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/pulsar.pulsar.v1.Params"}}},"pulsarchain.keyregistry.v1.Params":{"description":"Params defines the parameters for the module.","type":"object"},"pulsarchain.keyregistry.v1.QueryGetUserCosmosAddressResponse":{"description":"QueryGetUserCosmosAddressResponse defines the QueryGetUserCosmosAddressResponse message.","type":"object","properties":{"user_cosmos_address":{"type":"string","format":"byte"}}},"pulsarchain.keyregistry.v1.QueryGetUserMinaAddressResponse":{"description":"QueryGetUserMinaAddressResponse defines the QueryGetUserMinaAddressResponse message.","type":"object","properties":{"user_mina_address":{"type":"string","format":"byte"}}},"pulsarchain.keyregistry.v1.QueryGetValidatorCosmosPubKeyResponse":{"description":"QueryGetValidatorCosmosAddressResponse defines the QueryGetValidatorCosmosAddressResponse message.","type":"object","properties":{"validator_cosmos_pub_key":{"type":"string","format":"byte"}}},"pulsarchain.keyregistry.v1.QueryGetValidatorMinaPubKeyResponse":{"description":"QueryGetValidatorMinaAddressResponse defines the QueryGetValidatorMinaAddressResponse message.","type":"object","properties":{"validator_mina_pub_key":{"type":"string","format":"byte"}}},"pulsarchain.keyregistry.v1.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/pulsarchain.keyregistry.v1.Params"}}},"pulsarchain.voteexthandler.v1.Body":{"description":"Body defines the VoteExtBody message.","type":"object","properties":{"initial_block_height":{"type":"string","format":"int64"},"initial_state_root":{"type":"string","format":"byte"},"initial_validator_set_root":{"type":"string","format":"byte"},"new_block_height":{"type":"string","format":"int64"},"new_state_root":{"type":"string","format":"byte"},"new_validator_set_root":{"type":"string","format":"byte"}}},"pulsarchain.voteexthandler.v1.Params":{"description":"Params defines the parameters for the module.","type":"object"},"pulsarchain.voteexthandler.v1.QueryGetAllVoteExtsResponse":{"description":"QueryGetAllVoteExtsResponse defines the QueryGetAllVoteExtsResponse message.","type":"object","properties":{"validator_set_root":{"type":"string","format":"byte"},"vote_exts":{"type":"array","items":{"type":"object","$ref":"#/definitions/pulsarchain.voteexthandler.v1.VoteExt"}}}},"pulsarchain.voteexthandler.v1.QueryParamsResponse":{"description":"QueryParamsResponse is response type for the Query/Params RPC method.","type":"object","properties":{"params":{"description":"params holds all the parameters of this module.","$ref":"#/definitions/pulsarchain.voteexthandler.v1.Params"}}},"pulsarchain.voteexthandler.v1.QueryVoteextsByHeightResponse":{"description":"QueryVoteextsByHeightResponse defines the QueryVoteextsByHeightResponse message.","type":"object","properties":{"vote_exts":{"type":"array","items":{"type":"object","$ref":"#/definitions/pulsarchain.voteexthandler.v1.VoteExt"}}}},"pulsarchain.voteexthandler.v1.VoteExt":{"description":"GenesisState defines the voteexthandler module's genesis state.","type":"object","properties":{"body":{"$ref":"#/definitions/pulsarchain.voteexthandler.v1.Body"},"height":{"type":"string","format":"uint64"},"index":{"type":"string"},"signature":{"type":"string","format":"byte"},"validator_addr":{"type":"string"}}}},"tags":[{"name":"Query"},{"name":"Msg"}]} \ No newline at end of file diff --git a/go.mod b/go.mod index 683381c7..ae86ca2e 100644 --- a/go.mod +++ b/go.mod @@ -45,6 +45,7 @@ require ( github.com/spf13/pflag v1.0.10 github.com/spf13/viper v1.21.0 github.com/stretchr/testify v1.11.1 + go.uber.org/mock v0.6.0 google.golang.org/genproto/googleapis/api v0.0.0-20260217215200-42d3e9bedb6d google.golang.org/grpc v1.79.1 google.golang.org/protobuf v1.36.11 @@ -404,7 +405,6 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.40.0 // indirect go.opentelemetry.io/otel/trace v1.40.0 // indirect go.uber.org/automaxprocs v1.6.0 // indirect - go.uber.org/mock v0.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.1 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect diff --git a/proto/pulsarchain/voteexthandler/v1/query.proto b/proto/pulsarchain/voteexthandler/v1/query.proto index 12a0781c..400e14e4 100644 --- a/proto/pulsarchain/voteexthandler/v1/query.proto +++ b/proto/pulsarchain/voteexthandler/v1/query.proto @@ -57,4 +57,5 @@ message QueryGetAllVoteExtsRequest {} // QueryGetAllVoteExtsResponse defines the QueryGetAllVoteExtsResponse message. message QueryGetAllVoteExtsResponse { repeated VoteExt vote_exts = 1; + bytes validator_set_root = 2; } diff --git a/proto/pulsarchain/voteexthandler/v1/vote_ext.proto b/proto/pulsarchain/voteexthandler/v1/vote_ext.proto index c13f47f6..8287b764 100644 --- a/proto/pulsarchain/voteexthandler/v1/vote_ext.proto +++ b/proto/pulsarchain/voteexthandler/v1/vote_ext.proto @@ -4,6 +4,7 @@ package pulsarchain.voteexthandler.v1; import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "pulsarchain/voteexthandler/v1/params.proto"; +import "pulsarchain/voteexthandler/v1/vote_ext_body.proto"; option go_package = "github.com/node101-io/pulsar-chain/x/voteexthandler/types"; @@ -12,5 +13,6 @@ message VoteExt { string index = 1; uint64 height = 2; string validator_addr = 3; - string signature = 4; + bytes signature = 4; + Body body = 5; } diff --git a/x/voteexthandler/keeper/query_get_all_vote_exts.go b/x/voteexthandler/keeper/query_get_all_vote_exts.go index 76a569c5..424f7b24 100644 --- a/x/voteexthandler/keeper/query_get_all_vote_exts.go +++ b/x/voteexthandler/keeper/query_get_all_vote_exts.go @@ -18,5 +18,5 @@ func (q queryServer) GetAllVoteExts(ctx context.Context, req *types.QueryGetAllV return nil, err } - return &types.QueryGetAllVoteExtsResponse{VoteExts: allVoteExts}, nil + return &types.QueryGetAllVoteExtsResponse{VoteExts: allVoteExts, ValidatorSetRoot: HardcodedValidatorSetRoot[:]}, nil } diff --git a/x/voteexthandler/keeper/query_get_all_vote_exts_test.go b/x/voteexthandler/keeper/query_get_all_vote_exts_test.go index 00924ac8..2e13ba01 100644 --- a/x/voteexthandler/keeper/query_get_all_vote_exts_test.go +++ b/x/voteexthandler/keeper/query_get_all_vote_exts_test.go @@ -26,7 +26,7 @@ func TestGetAllVoteExts_SingleVote(t *testing.T) { ctx := f.ctx q := keeper.NewQueryServerImpl(f.keeper) - v := types.VoteExt{Index: "v1", Height: 100, ValidatorAddr: "val1", Signature: "sig1"} + v := types.VoteExt{Index: "v1", Height: 100, ValidatorAddr: "val1", Signature: []byte("sig1")} err := f.keeper.SetVoteExt(ctx, v) require.NoError(t, err) @@ -43,9 +43,9 @@ func TestGetAllVoteExts_MultipleVotes(t *testing.T) { q := keeper.NewQueryServerImpl(f.keeper) votes := []types.VoteExt{ - {Index: "v1", Height: 100, ValidatorAddr: "val1", Signature: "sig1"}, - {Index: "v2", Height: 101, ValidatorAddr: "val2", Signature: "sig2"}, - {Index: "v3", Height: 102, ValidatorAddr: "val3", Signature: "sig3"}, + {Index: "v1", Height: 100, ValidatorAddr: "val1", Signature: []byte("sig1")}, + {Index: "v2", Height: 101, ValidatorAddr: "val2", Signature: []byte("sig2")}, + {Index: "v3", Height: 102, ValidatorAddr: "val3", Signature: []byte("sig3")}, } for _, v := range votes { err := f.keeper.SetVoteExt(ctx, v) diff --git a/x/voteexthandler/keeper/query_voteexts_test.go b/x/voteexthandler/keeper/query_voteexts_test.go index 161caf35..47221829 100644 --- a/x/voteexthandler/keeper/query_voteexts_test.go +++ b/x/voteexthandler/keeper/query_voteexts_test.go @@ -15,8 +15,8 @@ func TestVoteextsByHeight_ValidHeight(t *testing.T) { q := keeper.NewQueryServerImpl(f.keeper) // Setup votes - v1 := types.VoteExt{Index: "v1", Height: 100, ValidatorAddr: "val1", Signature: "sig1"} - v2 := types.VoteExt{Index: "v2", Height: 100, ValidatorAddr: "val2", Signature: "sig2"} + v1 := types.VoteExt{Index: "v1", Height: 100, ValidatorAddr: "val1", Signature: []byte("sig1")} + v2 := types.VoteExt{Index: "v2", Height: 100, ValidatorAddr: "val2", Signature: []byte("sig2")} _ = f.keeper.SetVoteExt(ctx, v1) _ = f.keeper.SetVoteExt(ctx, v2) diff --git a/x/voteexthandler/keeper/vote_ext.go b/x/voteexthandler/keeper/vote_ext.go index a08fc8f3..0e794abf 100644 --- a/x/voteexthandler/keeper/vote_ext.go +++ b/x/voteexthandler/keeper/vote_ext.go @@ -6,6 +6,13 @@ import ( "github.com/node101-io/pulsar-chain/x/voteexthandler/types" ) +var HardcodedValidatorSetRoot = [32]byte{ + 0x7a, 0x13, 0x9f, 0x42, 0xd1, 0x8c, 0x5e, 0xa7, + 0x2b, 0x6d, 0xf0, 0x91, 0x3c, 0x47, 0xb8, 0x0e, + 0x55, 0x1a, 0xcd, 0x72, 0x98, 0x04, 0xe6, 0xaf, + 0x39, 0xb2, 0x7c, 0x5d, 0x11, 0x8e, 0xf3, 0x64, +} + // SetVoteExt set a specific voteExt in the store from its index func (k Keeper) SetVoteExt(ctx context.Context, voteExt types.VoteExt) error { err := k.VoteExts.Set(ctx, voteExt.Index, voteExt) diff --git a/x/voteexthandler/keeper/vote_ext_test.go b/x/voteexthandler/keeper/vote_ext_test.go index a4c3e998..6e78f0d0 100644 --- a/x/voteexthandler/keeper/vote_ext_test.go +++ b/x/voteexthandler/keeper/vote_ext_test.go @@ -19,7 +19,7 @@ func TestSetAndGetVoteExt(t *testing.T) { Index: "vote1", Height: 100, ValidatorAddr: "validator1", - Signature: "sig1", + Signature: []byte("sig1"), } err := k.SetVoteExt(ctx, vote) diff --git a/x/voteexthandler/types/query.pb.go b/x/voteexthandler/types/query.pb.go index ba76bfba..116392c6 100644 --- a/x/voteexthandler/types/query.pb.go +++ b/x/voteexthandler/types/query.pb.go @@ -243,7 +243,8 @@ var xxx_messageInfo_QueryGetAllVoteExtsRequest proto.InternalMessageInfo // QueryGetAllVoteExtsResponse defines the QueryGetAllVoteExtsResponse message. type QueryGetAllVoteExtsResponse struct { - VoteExts []*VoteExt `protobuf:"bytes,1,rep,name=vote_exts,json=voteExts,proto3" json:"vote_exts,omitempty"` + VoteExts []*VoteExt `protobuf:"bytes,1,rep,name=vote_exts,json=voteExts,proto3" json:"vote_exts,omitempty"` + ValidatorSetRoot []byte `protobuf:"bytes,2,opt,name=validator_set_root,json=validatorSetRoot,proto3" json:"validator_set_root,omitempty"` } func (m *QueryGetAllVoteExtsResponse) Reset() { *m = QueryGetAllVoteExtsResponse{} } @@ -286,6 +287,13 @@ func (m *QueryGetAllVoteExtsResponse) GetVoteExts() []*VoteExt { return nil } +func (m *QueryGetAllVoteExtsResponse) GetValidatorSetRoot() []byte { + if m != nil { + return m.ValidatorSetRoot + } + return nil +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "pulsarchain.voteexthandler.v1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "pulsarchain.voteexthandler.v1.QueryParamsResponse") @@ -300,40 +308,42 @@ func init() { } var fileDescriptor_fb1c23ae06aadedd = []byte{ - // 523 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff,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0x30, 0xe3, 0x5d, 0xea, 0xdd, 0xf5, 0x36, 0x63, 0x8e, - 0x35, 0xcd, 0x66, 0xf9, 0x04, 0xa2, 0x9f, 0x00, 0x5e, 0x3c, 0x7c, 0x35, 0xe8, 0xc1, 0x49, 0x3c, - 0xcc, 0x18, 0x04, 0x6b, 0x7b, 0x31, 0xb0, 0x89, 0xf2, 0x42, 0x45, 0x69, 0xa1, 0x67, 0x73, 0x44, - 0x31, 0x15, 0xe1, 0x07, 0x43, 0x5f, 0x4f, 0x1d, 0x7e, 0xa7, 0xdf, 0xef, 0xd1, 0x37, 0x00, 0x2f, - 0x4c, 0x5f, 0x3b, 0x6a, 0x9c, 0xc4, 0xe0, 0x91, 0x83, 0x64, 0xdd, 0x5f, 0x04, 0x6a, 0x92, 0x3d, - 0x51, 0xc9, 0x1e, 0xa2, 0xed, 0x39, 0x92, 0x85, 0x54, 0xfa, 0x24, 0x49, 0xfc, 0x83, 0xf1, 0x6c, - 0xbe, 0xde, 0x1d, 0xd9, 0x60, 0x6f, 0x64, 0x83, 0xdf, 0x23, 0x1b, 0x7c, 0x1c, 0xdb, 0x95, 0xbd, - 0xb1, 0x5d, 0xf9, 0x31, 0xb6, 0x2b, 0x6f, 0x1b, 0x61, 0x2c, 0xa3, 0x7e, 0xe0, 0x76, 0x78, 0x6f, - 0xa6, 0xc2, 0xe0, 0xb0, 0x86, 0x1c, 0xa6, 0x54, 0x04, 0x55, 0xf5, 0x67, 0xd9, 0xfa, 0x1b, 0x00, - 0x00, 0xff, 0xff, 0x59, 0x6c, 0xda, 0x97, 0x72, 0x05, 0x00, 0x00, + // 558 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4f, 0x6b, 0x13, 0x4f, + 0x18, 0xce, 0xf4, 0xd7, 0x5f, 0xb0, 0x53, 0x91, 0x3a, 0x16, 0x29, 0x6b, 0xba, 0x96, 0x05, 0x25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 0xca, 0x3c, 0x10, 0x6d, + 0xd7, 0xaa, 0xbe, 0xff, 0x7a, 0xfc, 0x61, 0x61, 0x87, 0x38, 0x34, 0x82, 0x16, 0x77, 0xee, 0x3a, + 0xdb, 0x01, 0x50, 0x3d, 0x66, 0x7b, 0x76, 0x60, 0xc9, 0x77, 0x84, 0x57, 0x4e, 0xde, 0x24, 0x79, + 0x70, 0x1e, 0x0d, 0x53, 0x72, 0x63, 0xec, 0x5e, 0x0c, 0x9c, 0x5b, 0x79, 0xa1, 0xac, 0xd4, 0xc9, + 0xb3, 0x39, 0xac, 0xe4, 0x15, 0xe1, 0x35, 0xfa, 0x9e, 0x0e, 0x29, 0x7d, 0xab, 0xdf, 0xef, 0xc8, + 0x17, 0x84, 0xaf, 0x4c, 0x86, 0x84, 0x54, 0xcf, 0x23, 0xf0, 0xd4, 0xdc, 0x19, 0xf7, 0x2f, 0x02, + 0xcd, 0x9d, 0x3d, 0x51, 0xce, 0x1e, 0x92, 0xdd, 0x39, 0x9c, 0xf9, 0x5c, 0x7a, 0x2c, 0x0c, 0xbd, + 0x71, 0x98, 0x6b, 0x7b, 0x87, 0x03, 0x13, 0x1d, 0x0d, 0x4c, 0xf4, 0x73, 0x60, 0xa2, 0x83, 0xa1, + 0x59, 0x38, 0x1a, 0x9a, 0x85, 0x6f, 0x43, 0xb3, 0xf0, 0xa6, 0xea, 0x07, 0xb2, 0xdd, 0x6d, 0xd8, + 0x4d, 0xe8, 0x4c, 0x65, 0xe8, 0x9d, 0xe4, 0x90, 0xfd, 0x98, 0x8b, 0x46, 0x51, 0xfd, 0x88, 0x76, + 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0x12, 0xe6, 0xef, 0x9d, 0xa1, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -659,6 +669,13 @@ func (m *QueryGetAllVoteExtsResponse) MarshalToSizedBuffer(dAtA []byte) (int, er _ = i var l int _ = l + if len(m.ValidatorSetRoot) > 0 { + i -= len(m.ValidatorSetRoot) + copy(dAtA[i:], m.ValidatorSetRoot) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorSetRoot))) + i-- + dAtA[i] = 0x12 + } if len(m.VoteExts) > 0 { for iNdEx := len(m.VoteExts) - 1; iNdEx >= 0; iNdEx-- { { @@ -755,6 +772,10 @@ func (m *QueryGetAllVoteExtsResponse) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) } } + l = len(m.ValidatorSetRoot) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -1163,6 +1184,40 @@ func (m *QueryGetAllVoteExtsResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSetRoot", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorSetRoot = append(m.ValidatorSetRoot[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorSetRoot == nil { + m.ValidatorSetRoot = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/voteexthandler/types/vote_ext.pb.go b/x/voteexthandler/types/vote_ext.pb.go index c86677a1..3896e5cd 100644 --- a/x/voteexthandler/types/vote_ext.pb.go +++ b/x/voteexthandler/types/vote_ext.pb.go @@ -29,7 +29,8 @@ type VoteExt struct { Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` ValidatorAddr string `protobuf:"bytes,3,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` - Signature string `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` + Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` + Body *Body `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"` } func (m *VoteExt) Reset() { *m = VoteExt{} } @@ -86,11 +87,18 @@ func (m *VoteExt) GetValidatorAddr() string { return "" } -func (m *VoteExt) GetSignature() string { +func (m *VoteExt) GetSignature() []byte { if m != nil { return m.Signature } - return "" + return nil +} + +func (m *VoteExt) GetBody() *Body { + if m != nil { + return m.Body + } + return nil } func init() { @@ -102,25 +110,27 @@ func init() { } var fileDescriptor_acfe772305a00414 = []byte{ - // 277 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x8f, 0xcd, 0x4a, 0xf3, 0x40, - 0x14, 0x40, 0x33, 0xdf, 0x57, 0x2b, 0x1d, 0x50, 0x30, 0x14, 0x09, 0x45, 0x87, 0x22, 0x08, 0x45, - 0x6c, 0xc6, 0xe0, 0xca, 0xa5, 0x82, 0x2f, 0x50, 0xc1, 0x85, 0x9b, 0x32, 0xed, 0x0c, 0xc9, 0x40, - 0x32, 0x37, 0x4c, 0x6e, 0x42, 0x04, 0x1f, 0xc2, 0xc7, 0x72, 0xd9, 0xa5, 0x4b, 0x49, 0x5e, 0x44, - 0x9c, 0x29, 0xfe, 0x2d, 0xdc, 0x0c, 0xf7, 0x1e, 0xce, 0x65, 0x38, 0xf4, 0xbc, 0xac, 0xf3, 0x4a, - 0xd8, 0x75, 0x26, 0xb4, 0xe1, 0x0d, 0xa0, 0x52, 0x2d, 0x66, 0xc2, 0xc8, 0x5c, 0x59, 0xde, 0x24, - 0x8e, 0x2c, 0x55, 0x8b, 0x71, 0x69, 0x01, 0x21, 0x3c, 0xfe, 0x66, 0xc7, 0x3f, 0xed, 0xb8, 0x49, - 0x26, 0x07, 0xa2, 0xd0, 0x06, 0xb8, 0x7b, 0xfd, 0xc5, 0x64, 0x9c, 0x42, 0x0a, 0x6e, 0xe4, 0x1f, - 0xd3, 0x96, 0x9e, 0xfd, 0xfd, 0x6b, 0x29, 0xac, 0x28, 0x2a, 0xef, 0x9e, 0x3c, 0xd1, 0xdd, 0x7b, - 0x40, 0x75, 0xdb, 0x62, 0x38, 0xa6, 0x3b, 0xda, 0x48, 0xd5, 0x46, 0x64, 0x4a, 0x66, 0xa3, 0x85, - 0x5f, 0xc2, 0x43, 0x3a, 0xcc, 0x94, 0x4e, 0x33, 0x8c, 0xfe, 0x4d, 0xc9, 0x6c, 0xb0, 0xd8, 0x6e, - 0xe1, 0x29, 0xdd, 0x6f, 0x44, 0xae, 0xa5, 0x40, 0xb0, 0x4b, 0x21, 0xa5, 0x8d, 0xfe, 0xbb, 0xb3, - 0xbd, 0x4f, 0x7a, 0x2d, 0xa5, 0x0d, 0x8f, 0xe8, 0xa8, 0xd2, 0xa9, 0x11, 0x58, 0x5b, 0x15, 0x0d, - 0x9c, 0xf1, 0x05, 0x6e, 0xee, 0x5e, 0x3a, 0x46, 0x36, 0x1d, 0x23, 0x6f, 0x1d, 0x23, 0xcf, 0x3d, - 0x0b, 0x36, 0x3d, 0x0b, 0x5e, 0x7b, 0x16, 0x3c, 0x5c, 0xa5, 0x1a, 0xb3, 0x7a, 0x15, 0xaf, 0xa1, - 0xe0, 0x06, 0xa4, 0x4a, 0x2e, 0x92, 0xb9, 0x06, 0xee, 0xcb, 0xe6, 0x3e, 0xad, 0xfd, 0x1d, 0x87, - 0x8f, 0xa5, 0xaa, 0x56, 0x43, 0x57, 0x76, 0xf9, 0x1e, 0x00, 0x00, 0xff, 0xff, 0x0e, 0x6c, 0x9c, - 0x70, 0x7d, 0x01, 0x00, 0x00, + // 315 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff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, 0x27, 0x4a, 0x70, 0x0b, 0x66, 0xc8, 0x85, 0x30, 0xfe, 0xb6, 0x8b, 0xed, 0x7f, 0xa9, 0xf7, + 0x42, 0x18, 0xef, 0x18, 0x77, 0x72, 0x95, 0x68, 0x6e, 0x67, 0x46, 0xfa, 0xcd, 0x00, 0x85, 0x7b, + 0xf1, 0xb7, 0xe0, 0xdd, 0xe2, 0xe6, 0xba, 0x8c, 0xdf, 0x0a, 0x50, 0xb8, 0x7b, 0x7d, 0x46, 0x37, + 0x42, 0xa3, 0x03, 0x10, 0xf3, 0xd8, 0x05, 0x06, 0x8f, 0x6f, 0x4b, 0x82, 0x16, 0x4b, 0x82, 0x3e, + 0x96, 0x04, 0xbd, 0xac, 0x48, 0x63, 0xb1, 0x22, 0x8d, 0xf7, 0x15, 0x69, 0x3c, 0xdf, 0x25, 0xca, + 0xa6, 0xb3, 0x11, 0x1d, 0xc3, 0x94, 0x69, 0x10, 0x32, 0xba, 0x8a, 0xfa, 0x0a, 0x58, 0xf5, 0x73, + 0xbf, 0x62, 0x53, 0xfe, 0xa5, 0x63, 0xe7, 0x99, 0xcc, 0x47, 0x6d, 0xc7, 0xe4, 0xe6, 0x33, 0x00, + 0x00, 0xff, 0xff, 0x47, 0x8e, 0x2c, 0xd9, 0xea, 0x01, 0x00, 0x00, } func (m *VoteExt) Marshal() (dAtA []byte, err error) { @@ -143,6 +153,18 @@ func (m *VoteExt) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Body != nil { + { + size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVoteExt(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } if len(m.Signature) > 0 { i -= len(m.Signature) copy(dAtA[i:], m.Signature) @@ -204,6 +226,10 @@ func (m *VoteExt) Size() (n int) { if l > 0 { n += 1 + l + sovVoteExt(uint64(l)) } + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovVoteExt(uint64(l)) + } return n } @@ -329,7 +355,7 @@ func (m *VoteExt) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowVoteExt @@ -339,23 +365,61 @@ func (m *VoteExt) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthVoteExt } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVoteExt + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVoteExt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVoteExt + } + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthVoteExt } if postIndex > l { return io.ErrUnexpectedEOF } - m.Signature = string(dAtA[iNdEx:postIndex]) + if m.Body == nil { + m.Body = &Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex