Skip to content

Commit

Permalink
feat: new vote extenison type THRESHOLD_RAW (#715)
Browse files Browse the repository at this point in the history
* feat: allow passing sign id used to sign vote extensions

* chore: improve docs

* chore: rename proto sign_id

* chore: doc

* doc: typo

* feat: add vote extension sign request id

* test: fix tests build

* chore: remove printf

* doc: proto  THRESHOLD_RECOVER_RAW docs

* chore: vote extension fixes

* chore: self review

* chore: fix tests

* fix: tests

* chore: code cleanup

* feat: allow pwldtx prefix in sign_request_id

* fix: return checksum of SignRequestId

* doc: update api spec

* chore: change prefix

* refactor: sign item refactoring and removal of reversals in sign id

* test: update test vectors in TestVoteExtensionsRawSignDataRawVector

* refactor: SIgnItem moved to crypto and replaces all crypto.SignID calls

* test: fix tests

* refactor(types): vote extensions support for multiple types

* test(e2e): workaround for broken ConsensusParams

* refactor: vote extensions refactoring

* refactor: further vote extensions refactoring

* chore: don't reverse signhash

* test: update sign id test vectors

* test(e2e): double-check that each vote extension has signature

* test: fix test vector

* build: allow choice of docker image architecture to use

* test(e2e): TestApp_TxTooBig needs correct tx order

* fix: vote extension marshal panic

* build: fix platform selection for docker build

* test(types): test vote extension marshaling

* chore: reverse sign request id

* chore: simplify code

* chore: remove reverse

* refactor: rename SignItem.Raw -> Msg

* chore: reverse bytes in extension and require 32 bytes for RAW

* chore: reverse generated request id

* chore: add debug

* test: working test vector for withdrawals

* test: withdrawals

* test: vote extension test fix

* test(consensus): fix vote extension tests

* chore: update protobuf

* revert: move SignItem back to types

* chore: remove log

* build: update golangci-lint 1.55.0 to 1.55.2

* chore: apply linter comments

* chore: decrease logs size

* test(e2e): increase e2e test timeout
  • Loading branch information
lklimek authored Jan 31, 2024
1 parent 86a79ac commit f10efa0
Show file tree
Hide file tree
Showing 66 changed files with 2,300 additions and 1,092 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: true
matrix:
testnet: ["dashcore", "rotate"]
timeout-minutes: 25
timeout-minutes: 30
env:
FULLNODE_PUBKEY_KEEP: false
CGO_LDFLAGS: "-L/usr/local/lib -ldashbls -lrelic_s -lmimalloc-secure -lgmp"
Expand Down
4 changes: 2 additions & 2 deletions abci/example/kvstore/kvstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,8 @@ func (app *Application) FinalizeBlock(_ context.Context, req *abci.RequestFinali
if app.shouldCommitVerify {
vsu := app.getActiveValidatorSetUpdates()
qsd := types.QuorumSignData{
Block: makeBlockSignItem(req, btcjson.LLMQType_5_60, vsu.QuorumHash),
Extensions: makeVoteExtensionSignItems(req, btcjson.LLMQType_5_60, vsu.QuorumHash),
Block: makeBlockSignItem(req, btcjson.LLMQType_5_60, vsu.QuorumHash),
VoteExtensionSignItems: makeVoteExtensionSignItems(req, btcjson.LLMQType_5_60, vsu.QuorumHash),
}
err := app.verifyBlockCommit(qsd, req.Commit)
if err != nil {
Expand Down
49 changes: 16 additions & 33 deletions abci/example/kvstore/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
abci "github.com/dashpay/tenderdash/abci/types"
"github.com/dashpay/tenderdash/crypto/encoding"
tmbytes "github.com/dashpay/tenderdash/libs/bytes"
types1 "github.com/dashpay/tenderdash/proto/tendermint/types"
"github.com/dashpay/tenderdash/types"
)

Expand All @@ -23,27 +22,16 @@ func (app *Application) verifyBlockCommit(qsd types.QuorumSignData, commit abci.
if err != nil {
return err
}
return verifier.Verify(pubKey, types.QuorumSigns{
BlockSign: commit.BlockSignature,
ExtensionSigns: makeThresholdVoteExtensions(commit.ThresholdVoteExtensions),
})
}

func makeThresholdVoteExtensions(pbVoteExtensions []*types1.VoteExtension) []types.ThresholdExtensionSign {
voteExtensions := types.VoteExtensionsFromProto(pbVoteExtensions)
var thresholdExtensionSigns []types.ThresholdExtensionSign
thresholdVoteExtensions, ok := voteExtensions[types1.VoteExtensionType_THRESHOLD_RECOVER]
if !ok {
return nil
extSigs := make([][]byte, 0, len(commit.ThresholdVoteExtensions))
for _, ext := range commit.ThresholdVoteExtensions {
extSigs = append(extSigs, ext.Signature)
}
thresholdExtensionSigns = make([]types.ThresholdExtensionSign, len(thresholdVoteExtensions))
for i, voteExtension := range thresholdVoteExtensions {
thresholdExtensionSigns[i] = types.ThresholdExtensionSign{
Extension: voteExtension.Extension,
ThresholdSignature: voteExtension.Signature,
}
}
return thresholdExtensionSigns

return verifier.Verify(pubKey, types.QuorumSigns{
BlockSign: commit.BlockSignature,
VoteExtensionSignatures: extSigs,
})
}

func makeBlockSignItem(
Expand All @@ -67,19 +55,14 @@ func makeVoteExtensionSignItems(
req *abci.RequestFinalizeBlock,
quorumType btcjson.LLMQType,
quorumHash []byte,
) map[types1.VoteExtensionType][]types.SignItem {
items := make(map[types1.VoteExtensionType][]types.SignItem)
reqID := types.VoteExtensionRequestID(req.Height, req.Round)
protoExtensionsMap := types1.VoteExtensionsToMap(req.Commit.ThresholdVoteExtensions)
for t, exts := range protoExtensionsMap {
if items[t] == nil && len(exts) > 0 {
items[t] = make([]types.SignItem, len(exts))
}
chainID := req.Block.Header.ChainID
for i, ext := range exts {
raw := types.VoteExtensionSignBytes(chainID, req.Height, req.Round, ext)
items[t][i] = types.NewSignItem(quorumType, quorumHash, reqID, raw)
}
) []types.SignItem {

extensions := types.VoteExtensionsFromProto(req.Commit.ThresholdVoteExtensions...)
chainID := req.Block.Header.ChainID

items, err := extensions.SignItems(chainID, quorumType, quorumHash, req.Height, req.Round)
if err != nil {
panic(fmt.Errorf("vote extension sign items: %w", err))
}
return items
}
20 changes: 20 additions & 0 deletions abci/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,23 @@ func (m *RequestFinalizeBlock) ToCanonicalVote() (types.CanonicalVote, error) {
}
return cv, nil
}

// Convert to proto.types.VoteExtension.
// Signature field will be nil, as ExtendVoteExtension doesn't have it.
func (m *ExtendVoteExtension) ToVoteExtension() types.VoteExtension {
ve := types.VoteExtension{
Type: m.Type,
Extension: m.Extension,
}

// workaround for a bug in gogoproto
if m.XSignRequestId != nil {
src := m.GetSignRequestId()

ve.XSignRequestId = &types.VoteExtension_SignRequestId{
SignRequestId: bytes.Clone(src),
}
}

return ve
}
504 changes: 309 additions & 195 deletions abci/types/types.pb.go

Large diffs are not rendered by default.

26 changes: 0 additions & 26 deletions crypto/quorum.go

This file was deleted.

16 changes: 4 additions & 12 deletions dash/core/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,8 @@ func (mc *MockClient) QuorumSign(
if !mc.canSign {
return nil, errors.New("dash core mock client not set up for signing")
}
signID := types.NewSignItemFromHash(quorumType, quorumHash, requestID, messageHash).SignHash

signID := crypto.SignID(
quorumType,
tmbytes.Reverse(quorumHash),
tmbytes.Reverse(requestID),
tmbytes.Reverse(messageHash),
)
privateKey, err := mc.localPV.GetPrivateKey(context.Background(), quorumHash)
if err != nil {
panic(err)
Expand Down Expand Up @@ -190,12 +185,9 @@ func (mc *MockClient) QuorumVerify(
if err := quorumType.Validate(); err != nil {
return false, err
}
signID := crypto.SignID(
quorumType,
tmbytes.Reverse(quorumHash),
tmbytes.Reverse(requestID),
tmbytes.Reverse(messageHash),
)

signID := types.NewSignItemFromHash(quorumType, quorumHash, requestID, messageHash).SignHash

thresholdPublicKey, err := mc.localPV.GetThresholdPublicKey(context.Background(), quorumHash)
if err != nil {
panic(err)
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.5.2
github.com/golang/snappy v0.0.4 // indirect
github.com/golangci/golangci-lint v1.55.0
github.com/golangci/golangci-lint v1.55.2
github.com/google/btree v1.1.2 // indirect
github.com/google/gopacket v1.1.19
github.com/google/orderedcode v0.0.1
Expand Down Expand Up @@ -51,7 +51,7 @@ require (
github.com/creachadair/atomicfile v0.2.6
github.com/creachadair/taskgroup v0.3.2
github.com/go-pkgz/jrpc v0.2.0
github.com/google/go-cmp v0.5.9
github.com/google/go-cmp v0.6.0
github.com/vektra/mockery/v2 v2.33.2
gotest.tools v2.2.0+incompatible
)
Expand Down Expand Up @@ -98,7 +98,7 @@ require (
github.com/moby/buildkit v0.10.3 // indirect
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/nunnatsa/ginkgolinter v0.14.0 // indirect
github.com/nunnatsa/ginkgolinter v0.14.1 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
Expand Down Expand Up @@ -138,7 +138,7 @@ require (
github.com/bombsimon/wsl/v3 v3.4.0 // indirect
github.com/breml/bidichk v0.2.7 // indirect
github.com/breml/errchkjson v0.3.6 // indirect
github.com/butuzov/ireturn v0.2.1 // indirect
github.com/butuzov/ireturn v0.2.2 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
Expand Down Expand Up @@ -181,7 +181,7 @@ require (
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect
github.com/golangci/misspell v0.4.1 // indirect
github.com/golangci/revgrep v0.5.0 // indirect
github.com/golangci/revgrep v0.5.2 // indirect
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect
github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
Expand Down Expand Up @@ -248,7 +248,7 @@ require (
github.com/ryancurrah/gomodguard v1.3.0 // indirect
github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect
github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect
github.com/securego/gosec/v2 v2.18.1 // indirect
github.com/securego/gosec/v2 v2.18.2 // indirect
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sivchari/containedctx v1.0.3 // indirect
Expand Down
32 changes: 16 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ github.com/bufbuild/buf v1.7.0 h1:uWRjhIXcrWkzIkA5TqXGyJbF51VW54QJsQZ3nwaes5Q=
github.com/bufbuild/buf v1.7.0/go.mod h1:Go40fMAF46PnPLC7jJgTQhAI95pmC0+VtxFKVC0qLq0=
github.com/bufbuild/connect-go v0.2.0 h1:WuMI/jLiJIhysHWvLWlxRozV67mGjCOUuDSl/lkDVic=
github.com/bufbuild/connect-go v0.2.0/go.mod h1:4efZ2eXFENwd4p7tuLaL9m0qtTsCOzuBvrohvRGevDM=
github.com/butuzov/ireturn v0.2.1 h1:w5Ks4tnfeFDZskGJ2x1GAkx5gaQV+kdU3NKNr3NEBzY=
github.com/butuzov/ireturn v0.2.1/go.mod h1:RfGHUvvAuFFxoHKf4Z8Yxuh6OjlCw1KvR2zM1NFHeBk=
github.com/butuzov/ireturn v0.2.2 h1:jWI36dxXwVrI+RnXDwux2IZOewpmfv930OuIRfaBUJ0=
github.com/butuzov/ireturn v0.2.2/go.mod h1:RfGHUvvAuFFxoHKf4Z8Yxuh6OjlCw1KvR2zM1NFHeBk=
github.com/butuzov/mirror v1.1.0 h1:ZqX54gBVMXu78QLoiqdwpl2mgmoOJTk7s4p4o+0avZI=
github.com/butuzov/mirror v1.1.0/go.mod h1:8Q0BdQU6rC6WILDiBM60DBfvV78OLJmMmixe7GF45AE=
github.com/catenacyber/perfsprint v0.2.0 h1:azOocHLscPjqXVJ7Mf14Zjlkn4uNua0+Hcg1wTR6vUo=
Expand Down Expand Up @@ -410,16 +410,16 @@ github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6
github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ=
github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e h1:ULcKCDV1LOZPFxGZaA6TlQbiM3J2GCPnkx/bGF6sX/g=
github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e/go.mod h1:Pm5KhLPA8gSnQwrQ6ukebRcapGb/BG9iUkdaiCcGHJM=
github.com/golangci/golangci-lint v1.55.0 h1:ePpc6YhM1ZV8kHU8dwmHDHAdeedZHdK8cmTXlkkRdi8=
github.com/golangci/golangci-lint v1.55.0/go.mod h1:Z/OawFQ4yqFo2/plDYlIjoZlJeVYkRcqS9dW55p0FXg=
github.com/golangci/golangci-lint v1.55.2 h1:yllEIsSJ7MtlDBwDJ9IMBkyEUz2fYE0b5B8IUgO1oP8=
github.com/golangci/golangci-lint v1.55.2/go.mod h1:H60CZ0fuqoTwlTvnbyjhpZPWp7KmsjwV2yupIMiMXbM=
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA=
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg=
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA=
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o=
github.com/golangci/misspell v0.4.1 h1:+y73iSicVy2PqyX7kmUefHusENlrP9YwuHZHPLGQj/g=
github.com/golangci/misspell v0.4.1/go.mod h1:9mAN1quEo3DlpbaIKKyEvRxK1pwqR9s/Sea1bJCtlNI=
github.com/golangci/revgrep v0.5.0 h1:GGBqHFtFOeHiSUQtFVZXPJtVZYOGB4iVlAjaoFRBQvY=
github.com/golangci/revgrep v0.5.0/go.mod h1:bjAMA+Sh/QUfTDcHzxfyHxr4xKvllVr/0sCv2e7jJHA=
github.com/golangci/revgrep v0.5.2 h1:EndcWoRhcnfj2NHQ+28hyuXpLMF+dQmCN+YaeeIl4FU=
github.com/golangci/revgrep v0.5.2/go.mod h1:bjAMA+Sh/QUfTDcHzxfyHxr4xKvllVr/0sCv2e7jJHA=
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys=
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
Expand All @@ -439,8 +439,8 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
Expand Down Expand Up @@ -660,8 +660,8 @@ github.com/nishanths/exhaustive v0.11.0 h1:T3I8nUGhl/Cwu5Z2hfc92l0e04D2GEW6e0l8p
github.com/nishanths/exhaustive v0.11.0/go.mod h1:RqwDsZ1xY0dNdqHho2z6X+bgzizwbLYOWnZbbl2wLB4=
github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk=
github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c=
github.com/nunnatsa/ginkgolinter v0.14.0 h1:XQPNmw+kZz5cC/HbFK3mQutpjzAQv1dHregRA+4CGGg=
github.com/nunnatsa/ginkgolinter v0.14.0/go.mod h1:cm2xaqCUCRd7qcP4DqbVvpcyEMkuLM9CF0wY6VASohk=
github.com/nunnatsa/ginkgolinter v0.14.1 h1:khx0CqR5U4ghsscjJ+lZVthp3zjIFytRXPTaQ/TMiyA=
github.com/nunnatsa/ginkgolinter v0.14.1/go.mod h1:nY0pafUSst7v7F637e7fymaMlQqI9c0Wka2fGsDkzWg=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
Expand All @@ -677,13 +677,13 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108
github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/ginkgo/v2 v2.12.1 h1:uHNEO1RP2SpuZApSkel9nEh1/Mu+hmQe7Q+Pepg5OYA=
github.com/onsi/ginkgo/v2 v2.12.1/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o=
github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4=
github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c=
github.com/onsi/gomega v1.28.0/go.mod h1:A1H2JE76sI14WIP57LMKj7FVfCHx3g3BcZVjJG8bjX8=
github.com/onsi/gomega v1.28.1 h1:MijcGUbfYuznzK/5R4CPNoUP/9Xvuo20sXfEm6XxoTA=
github.com/onsi/gomega v1.28.1/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 h1:rc3tiVYb5z54aKaDfakKn0dDjIyPpTtszkjuMzyt7ec=
Expand Down Expand Up @@ -781,8 +781,8 @@ github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84d
github.com/sashamelentyev/usestdlibvars v1.24.0 h1:MKNzmXtGh5N0y74Z/CIaJh4GlB364l0K1RUT08WSWAc=
github.com/sashamelentyev/usestdlibvars v1.24.0/go.mod h1:9cYkq+gYJ+a5W2RPdhfaSCnTVUC1OQP/bSiiBhq3OZE=
github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
github.com/securego/gosec/v2 v2.18.1 h1:xnnehWg7dIW8qrRPGm8ykY21zp2MueKyC99Vlcuj96I=
github.com/securego/gosec/v2 v2.18.1/go.mod h1:ZUTcKD9gAFip1lLGHWCjkoBQJyaEzePTNzjwlL2HHoE=
github.com/securego/gosec/v2 v2.18.2 h1:DkDt3wCiOtAHf1XkiXZBhQ6m6mK/b9T/wD257R3/c+I=
github.com/securego/gosec/v2 v2.18.2/go.mod h1:xUuqSF6i0So56Y2wwohWAmB07EdBkUN6crbLlHwbyJs=
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU=
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs=
github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk=
Expand Down
7 changes: 4 additions & 3 deletions internal/blocksync/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (rts *reactorTestSuite) addNode(
peerEvents := func(ctx context.Context, _ string) *p2p.PeerUpdates { return rts.peerUpdates[nodeID] }
reactor := makeReactor(ctx, t, rts.config, proTxHash, nodeID, genDoc, privVal, chCreator, peerEvents)

commit := types.NewCommit(0, 0, types.BlockID{}, nil)
commit := types.NewCommit(0, 0, types.BlockID{}, nil, nil)

state, err := reactor.stateStore.Load()
require.NoError(t, err)
Expand Down Expand Up @@ -237,10 +237,11 @@ func makeNextBlock(ctx context.Context,
vote.Height,
vote.Round,
blockID,
vote.VoteExtensions,
&types.CommitSigns{
QuorumSigns: types.QuorumSigns{
BlockSign: vote.BlockSignature,
ExtensionSigns: types.MakeThresholdExtensionSigns(vote.VoteExtensions),
BlockSign: vote.BlockSignature,
VoteExtensionSignatures: vote.VoteExtensions.GetSignatures(),
},
QuorumHash: state.Validators.QuorumHash,
},
Expand Down
2 changes: 1 addition & 1 deletion internal/consensus/block_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (c *blockExecutor) create(ctx context.Context, rs *cstypes.RoundState, roun
case rs.Height == c.committedState.InitialHeight:
// We're creating a proposal for the first block.
// The commit is empty, but not nil.
commit = types.NewCommit(0, 0, types.BlockID{}, nil)
commit = types.NewCommit(0, 0, types.BlockID{}, nil, nil)
case rs.LastCommit != nil:
// Make the commit from LastPrecommits
commit = rs.LastCommit
Expand Down
14 changes: 7 additions & 7 deletions internal/consensus/block_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ import (
"github.com/dashpay/tenderdash/types/mocks"
)

type BockExecutorTestSuite struct {
type BlockExecutorTestSuite struct {
suite.Suite

blockExec *blockExecutor
mockPrivVal *mocks.PrivValidator
mockBlockExec *smmocks.Executor
}

func TestBockExecutor(t *testing.T) {
suite.Run(t, new(BockExecutorTestSuite))
func TestBlockExecutor(t *testing.T) {
suite.Run(t, new(BlockExecutorTestSuite))
}

func (suite *BockExecutorTestSuite) SetupTest() {
func (suite *BlockExecutorTestSuite) SetupTest() {
logger := log.NewTestingLogger(suite.T())
suite.mockPrivVal = mocks.NewPrivValidator(suite.T())
suite.mockBlockExec = smmocks.NewExecutor(suite.T())
Expand All @@ -47,13 +47,13 @@ func (suite *BockExecutorTestSuite) SetupTest() {
}
}

func (suite *BockExecutorTestSuite) TestCreate() {
func (suite *BlockExecutorTestSuite) TestCreate() {
ctx := context.Background()
commitH99R0 := &types.Commit{
Height: 99,
Round: 0,
}
emptyCommit := types.NewCommit(0, 0, types.BlockID{}, nil)
emptyCommit := types.NewCommit(0, 0, types.BlockID{}, nil, nil)
testCases := []struct {
round int32
initialHeight int64
Expand Down Expand Up @@ -137,7 +137,7 @@ func (suite *BockExecutorTestSuite) TestCreate() {
}
}

func (suite *BockExecutorTestSuite) TestProcess() {
func (suite *BlockExecutorTestSuite) TestProcess() {
ctx := context.Background()
const round = int32(0)
wantDefaultCRS := sm.CurrentRoundState{
Expand Down
Loading

0 comments on commit f10efa0

Please sign in to comment.