From fdb40c82946253c9ee23c87c0d5a8f5035c8e93b Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Wed, 4 Nov 2026 01:35:55 +0700 Subject: [PATCH 01/18] feat(abci)!: add the ApplyBlockRandomness method and commit beacon fields Add a new ABCI method, ApplyBlockRandomness, for same-block randomness. Tenderdash will call it at consensus version 2 with the random beacon of a block and round (the BLS threshold signature recovered from its prevotes), and the application returns the app hash the precommits sign. - proto: RequestApplyBlockRandomness {hash, height, round, beacon} and ResponseApplyBlockRandomness {app_hash} in the Request/Response oneofs and the ABCI service; CommitInfo.beacon and CommitInfo.app_hash; Commit.beacon and Commit.app_hash. - Go: Application interface, socket, gRPC, routed and local clients, socket server, proxy client with timing metrics, regenerated mocks. - BaseApplication returns ErrApplyBlockRandomnessNotImplemented: an empty app hash must never pass as an answer. - kvstore example: returns the app hash of the processed block unchanged. - types.Commit carries Beacon and AppHash through protobuf and CommitInfo. MaxCommitOverheadBytes grows by 132 bytes (96+2 for the beacon, 32+2 for the app hash). Nothing calls the method yet, and the new fields stay empty, so behaviour is unchanged apart from the larger commit overhead reserved by the mempool size pre-check. Refs dashpay/platform#4682 Co-Authored-By: Claude Opus 5.5 --- abci/client/grpc_client.go | 4 + abci/client/mocks/client.go | 68 ++ abci/client/routed_client.go | 5 + abci/client/socket_client.go | 10 + abci/example/kvstore/kvstore.go | 35 + abci/example/kvstore/kvstore_test.go | 42 + abci/server/socket_server.go | 6 + abci/types/application.go | 12 + abci/types/messages.go | 12 + abci/types/mocks/application.go | 68 ++ abci/types/types.pb.go | 1495 ++++++++++++++++++++------ abci/types/types_test.go | 9 + internal/proxy/client.go | 5 + internal/state/tx_filter_test.go | 2 +- node/node_test.go | 4 +- proto/tendermint/abci/types.proto | 111 +- proto/tendermint/types/types.pb.go | 311 ++++-- proto/tendermint/types/types.proto | 6 + spec/abci++/abci++_methods.md | 56 +- spec/abci++/api.md | 66 ++ types/block.go | 17 +- types/block_test.go | 31 +- 22 files changed, 1899 insertions(+), 476 deletions(-) diff --git a/abci/client/grpc_client.go b/abci/client/grpc_client.go index 0ffed9b399..b66dea9390 100644 --- a/abci/client/grpc_client.go +++ b/abci/client/grpc_client.go @@ -274,3 +274,7 @@ func (cli *grpcClient) VerifyVoteExtension(ctx context.Context, params *types.Re func (cli *grpcClient) FinalizeBlock(ctx context.Context, params *types.RequestFinalizeBlock) (*types.ResponseFinalizeBlock, error) { return cli.client.FinalizeBlock(ctx, types.ToRequestFinalizeBlock(params).GetFinalizeBlock(), grpc.WaitForReady(true)) } + +func (cli *grpcClient) ApplyBlockRandomness(ctx context.Context, params *types.RequestApplyBlockRandomness) (*types.ResponseApplyBlockRandomness, error) { + return cli.client.ApplyBlockRandomness(ctx, types.ToRequestApplyBlockRandomness(params).GetApplyBlockRandomness(), grpc.WaitForReady(true)) +} diff --git a/abci/client/mocks/client.go b/abci/client/mocks/client.go index b39444b38f..e75bf4676b 100644 --- a/abci/client/mocks/client.go +++ b/abci/client/mocks/client.go @@ -47,6 +47,74 @@ func (_m *Client) EXPECT() *Client_Expecter { return &Client_Expecter{mock: &_m.Mock} } +// ApplyBlockRandomness provides a mock function for the type Client +func (_mock *Client) ApplyBlockRandomness(context1 context.Context, requestApplyBlockRandomness *types.RequestApplyBlockRandomness) (*types.ResponseApplyBlockRandomness, error) { + ret := _mock.Called(context1, requestApplyBlockRandomness) + + if len(ret) == 0 { + panic("no return value specified for ApplyBlockRandomness") + } + + var r0 *types.ResponseApplyBlockRandomness + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *types.RequestApplyBlockRandomness) (*types.ResponseApplyBlockRandomness, error)); ok { + return returnFunc(context1, requestApplyBlockRandomness) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *types.RequestApplyBlockRandomness) *types.ResponseApplyBlockRandomness); ok { + r0 = returnFunc(context1, requestApplyBlockRandomness) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.ResponseApplyBlockRandomness) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *types.RequestApplyBlockRandomness) error); ok { + r1 = returnFunc(context1, requestApplyBlockRandomness) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// Client_ApplyBlockRandomness_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyBlockRandomness' +type Client_ApplyBlockRandomness_Call struct { + *mock.Call +} + +// ApplyBlockRandomness is a helper method to define mock.On call +// - context1 context.Context +// - requestApplyBlockRandomness *types.RequestApplyBlockRandomness +func (_e *Client_Expecter) ApplyBlockRandomness(context1 any, requestApplyBlockRandomness any) *Client_ApplyBlockRandomness_Call { + return &Client_ApplyBlockRandomness_Call{Call: _e.mock.On("ApplyBlockRandomness", context1, requestApplyBlockRandomness)} +} + +func (_c *Client_ApplyBlockRandomness_Call) Run(run func(context1 context.Context, requestApplyBlockRandomness *types.RequestApplyBlockRandomness)) *Client_ApplyBlockRandomness_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *types.RequestApplyBlockRandomness + if args[1] != nil { + arg1 = args[1].(*types.RequestApplyBlockRandomness) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *Client_ApplyBlockRandomness_Call) Return(responseApplyBlockRandomness *types.ResponseApplyBlockRandomness, err error) *Client_ApplyBlockRandomness_Call { + _c.Call.Return(responseApplyBlockRandomness, err) + return _c +} + +func (_c *Client_ApplyBlockRandomness_Call) RunAndReturn(run func(context1 context.Context, requestApplyBlockRandomness *types.RequestApplyBlockRandomness) (*types.ResponseApplyBlockRandomness, error)) *Client_ApplyBlockRandomness_Call { + _c.Call.Return(run) + return _c +} + // ApplySnapshotChunk provides a mock function for the type Client func (_mock *Client) ApplySnapshotChunk(context1 context.Context, requestApplySnapshotChunk *types.RequestApplySnapshotChunk) (*types.ResponseApplySnapshotChunk, error) { ret := _mock.Called(context1, requestApplySnapshotChunk) diff --git a/abci/client/routed_client.go b/abci/client/routed_client.go index fa1afc1bc3..9878f20537 100644 --- a/abci/client/routed_client.go +++ b/abci/client/routed_client.go @@ -375,3 +375,8 @@ func (cli *routedClient) FinalizeBlock(ctx context.Context, req *types.RequestFi result, err := cli.delegate(ctx, req) return result.(*types.ResponseFinalizeBlock), err } + +func (cli *routedClient) ApplyBlockRandomness(ctx context.Context, req *types.RequestApplyBlockRandomness) (*types.ResponseApplyBlockRandomness, error) { + result, err := cli.delegate(ctx, req) + return result.(*types.ResponseApplyBlockRandomness), err +} diff --git a/abci/client/socket_client.go b/abci/client/socket_client.go index fb046187d8..5c3b2a8270 100644 --- a/abci/client/socket_client.go +++ b/abci/client/socket_client.go @@ -397,6 +397,14 @@ func (cli *socketClient) FinalizeBlock(ctx context.Context, req *types.RequestFi return res.GetFinalizeBlock(), nil } +func (cli *socketClient) ApplyBlockRandomness(ctx context.Context, req *types.RequestApplyBlockRandomness) (*types.ResponseApplyBlockRandomness, error) { + res, err := cli.doRequest(ctx, types.ToRequestApplyBlockRandomness(req)) + if err != nil { + return nil, err + } + return res.GetApplyBlockRandomness(), nil +} + //---------------------------------------- func resMatchesReq(req *types.Request, res *types.Response) (ok bool) { @@ -431,6 +439,8 @@ func resMatchesReq(req *types.Request, res *types.Response) (ok bool) { _, ok = res.Value.(*types.Response_OfferSnapshot) case *types.Request_FinalizeBlock: _, ok = res.Value.(*types.Response_FinalizeBlock) + case *types.Request_ApplyBlockRandomness: + _, ok = res.Value.(*types.Response_ApplyBlockRandomness) } return ok } diff --git a/abci/example/kvstore/kvstore.go b/abci/example/kvstore/kvstore.go index 02e287e7a0..82016f0eda 100644 --- a/abci/example/kvstore/kvstore.go +++ b/abci/example/kvstore/kvstore.go @@ -490,6 +490,41 @@ func (app *Application) FinalizeBlock(_ context.Context, req *abci.RequestFinali return resp, nil } +// ApplyBlockRandomness implements ABCI. The example application uses no randomness, so it returns +// the app hash of the state that PrepareProposal or ProcessProposal left for the block and round. +func (app *Application) ApplyBlockRandomness(_ context.Context, req *abci.RequestApplyBlockRandomness) (*abci.ResponseApplyBlockRandomness, error) { + app.mu.Lock() + defer app.mu.Unlock() + + roundState, err := app.processedRoundState(req.Height, req.Round) + if err != nil { + return nil, fmt.Errorf("apply block randomness (hash: %X): %w", req.Hash, err) + } + + resp := &abci.ResponseApplyBlockRandomness{AppHash: roundState.GetAppHash()} + app.logger.Debug("ApplyBlockRandomness", "req", req, "resp", resp) + return resp, nil +} + +// processedRoundState returns the state of the proposal executed at the given height and round. +// Caller should lock the Application. +func (app *Application) processedRoundState(height int64, round int32) (State, error) { + var found State + for _, state := range app.roundStates { + if state.GetHeight() != height || state.GetRound() != round { + continue + } + if found != nil { + return nil, fmt.Errorf("more than one proposal executed at height %d round %d", height, round) + } + found = state + } + if found == nil { + return nil, fmt.Errorf("no proposal executed at height %d round %d", height, round) + } + return found, nil +} + // eventValUpdate generates an event that contains info about current validator set func (app *Application) eventValUpdate(height int64) abci.Event { size := 0 diff --git a/abci/example/kvstore/kvstore_test.go b/abci/example/kvstore/kvstore_test.go index e109c851d2..d541b83b5f 100644 --- a/abci/example/kvstore/kvstore_test.go +++ b/abci/example/kvstore/kvstore_test.go @@ -441,6 +441,13 @@ func testClient(ctx context.Context, t *testing.T, app abciclient.Client, height require.False(t, rpp.TxResults[0].IsErr()) require.Len(t, rpp.Events, 1) + rabr, err := app.ApplyBlockRandomness(ctx, &types.RequestApplyBlockRandomness{ + Height: height, + Beacon: tmcrypto.CRandBytes(tmtypes.SignatureSize), + }) + require.NoError(t, err) + require.Equal(t, rpp.AppHash, rabr.AppHash, "no randomness is applied, so the app hash is unchanged") + rfb := &types.RequestFinalizeBlock{Height: height} rfb.Block, rfb.BlockID = makeBlock(t, height, [][]byte{tx}, rpp.AppHash) ar, err := app.FinalizeBlock(ctx, rfb) @@ -644,3 +651,38 @@ func TestProcessProposalRoundReprocessing(t *testing.T) { _, err = app.FinalizeBlock(ctx, reqFin) require.NoError(t, err) } + +// TestApplyBlockRandomness checks that ApplyBlockRandomness answers for the round that was processed, +// gives the same answer when called again, and fails for a round that was not processed. +func TestApplyBlockRandomness(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + app := newKvApp(ctx, t, 1) + const height = 1 + resp, err := app.ProcessProposal(ctx, &types.RequestProcessProposal{ + Txs: [][]byte{[]byte(testKey)}, + Hash: []byte("block-hash"), + Height: height, + Round: 1, + Version: &pbversion.Consensus{App: uint64(height)}, + }) + require.NoError(t, err) + + req := &types.RequestApplyBlockRandomness{ + Hash: []byte("block-hash"), + Height: height, + Round: 1, + Beacon: tmcrypto.CRandBytes(tmtypes.SignatureSize), + } + first, err := app.ApplyBlockRandomness(ctx, req) + require.NoError(t, err) + require.Equal(t, resp.AppHash, first.AppHash) + + again, err := app.ApplyBlockRandomness(ctx, req) + require.NoError(t, err) + require.Equal(t, first.AppHash, again.AppHash) + + _, err = app.ApplyBlockRandomness(ctx, &types.RequestApplyBlockRandomness{Height: height, Round: 0}) + require.ErrorContains(t, err, "no proposal executed") +} diff --git a/abci/server/socket_server.go b/abci/server/socket_server.go index 650d9828f2..c1ef4e627c 100644 --- a/abci/server/socket_server.go +++ b/abci/server/socket_server.go @@ -280,6 +280,12 @@ func (s *SocketServer) processRequest(ctx context.Context, req *types.Request) ( return nil, err } return types.ToResponseFinalizeBlock(res), nil + case *types.Request_ApplyBlockRandomness: + res, err := s.app.ApplyBlockRandomness(ctx, r.ApplyBlockRandomness) + if err != nil { + return nil, err + } + return types.ToResponseApplyBlockRandomness(res), nil default: return types.ToResponseException("Unknown request"), errors.New("unknown request type") } diff --git a/abci/types/application.go b/abci/types/application.go index fe7b60bca4..a77149b554 100644 --- a/abci/types/application.go +++ b/abci/types/application.go @@ -2,10 +2,14 @@ package types import ( "context" + "errors" "github.com/dashpay/tenderdash/crypto" ) +// ErrApplyBlockRandomnessNotImplemented is returned by BaseApplication.ApplyBlockRandomness. +var ErrApplyBlockRandomnessNotImplemented = errors.New("ApplyBlockRandomness is not implemented by the application") + // StateSyncer is an interface that handles the state sync protocol type StateSyncer interface { // ListSnapshots returns list available snapshots @@ -42,6 +46,8 @@ type Application interface { VerifyVoteExtension(context.Context, *RequestVerifyVoteExtension) (*ResponseVerifyVoteExtension, error) // Deliver the decided block with its txs to the Application FinalizeBlock(context.Context, *RequestFinalizeBlock) (*ResponseFinalizeBlock, error) + // Apply the block's random beacon and return the app hash the precommit signs (consensus version 2) + ApplyBlockRandomness(context.Context, *RequestApplyBlockRandomness) (*ResponseApplyBlockRandomness, error) } //------------------------------------------------------- @@ -137,3 +143,9 @@ func (BaseApplication) FinalizeBlock(_ context.Context, _req *RequestFinalizeBlo return &ResponseFinalizeBlock{}, nil } + +// ApplyBlockRandomness returns an error: an empty app hash must never pass as an answer, so applications +// that run at consensus version 2 must implement it. +func (BaseApplication) ApplyBlockRandomness(_ context.Context, _req *RequestApplyBlockRandomness) (*ResponseApplyBlockRandomness, error) { + return nil, ErrApplyBlockRandomnessNotImplemented +} diff --git a/abci/types/messages.go b/abci/types/messages.go index fed82db198..1e762f5243 100644 --- a/abci/types/messages.go +++ b/abci/types/messages.go @@ -117,6 +117,12 @@ func ToRequestFinalizeBlock(req *RequestFinalizeBlock) *Request { } } +func ToRequestApplyBlockRandomness(req *RequestApplyBlockRandomness) *Request { + return &Request{ + Value: &Request_ApplyBlockRandomness{req}, + } +} + //---------------------------------------- func ToResponseException(errStr string) *Response { @@ -214,3 +220,9 @@ func ToResponseFinalizeBlock(res *ResponseFinalizeBlock) *Response { Value: &Response_FinalizeBlock{res}, } } + +func ToResponseApplyBlockRandomness(res *ResponseApplyBlockRandomness) *Response { + return &Response{ + Value: &Response_ApplyBlockRandomness{res}, + } +} diff --git a/abci/types/mocks/application.go b/abci/types/mocks/application.go index c63b765649..e47bde6873 100644 --- a/abci/types/mocks/application.go +++ b/abci/types/mocks/application.go @@ -47,6 +47,74 @@ func (_m *Application) EXPECT() *Application_Expecter { return &Application_Expecter{mock: &_m.Mock} } +// ApplyBlockRandomness provides a mock function for the type Application +func (_mock *Application) ApplyBlockRandomness(context1 context.Context, requestApplyBlockRandomness *types.RequestApplyBlockRandomness) (*types.ResponseApplyBlockRandomness, error) { + ret := _mock.Called(context1, requestApplyBlockRandomness) + + if len(ret) == 0 { + panic("no return value specified for ApplyBlockRandomness") + } + + var r0 *types.ResponseApplyBlockRandomness + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, *types.RequestApplyBlockRandomness) (*types.ResponseApplyBlockRandomness, error)); ok { + return returnFunc(context1, requestApplyBlockRandomness) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, *types.RequestApplyBlockRandomness) *types.ResponseApplyBlockRandomness); ok { + r0 = returnFunc(context1, requestApplyBlockRandomness) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.ResponseApplyBlockRandomness) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, *types.RequestApplyBlockRandomness) error); ok { + r1 = returnFunc(context1, requestApplyBlockRandomness) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// Application_ApplyBlockRandomness_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyBlockRandomness' +type Application_ApplyBlockRandomness_Call struct { + *mock.Call +} + +// ApplyBlockRandomness is a helper method to define mock.On call +// - context1 context.Context +// - requestApplyBlockRandomness *types.RequestApplyBlockRandomness +func (_e *Application_Expecter) ApplyBlockRandomness(context1 any, requestApplyBlockRandomness any) *Application_ApplyBlockRandomness_Call { + return &Application_ApplyBlockRandomness_Call{Call: _e.mock.On("ApplyBlockRandomness", context1, requestApplyBlockRandomness)} +} + +func (_c *Application_ApplyBlockRandomness_Call) Run(run func(context1 context.Context, requestApplyBlockRandomness *types.RequestApplyBlockRandomness)) *Application_ApplyBlockRandomness_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 *types.RequestApplyBlockRandomness + if args[1] != nil { + arg1 = args[1].(*types.RequestApplyBlockRandomness) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *Application_ApplyBlockRandomness_Call) Return(responseApplyBlockRandomness *types.ResponseApplyBlockRandomness, err error) *Application_ApplyBlockRandomness_Call { + _c.Call.Return(responseApplyBlockRandomness, err) + return _c +} + +func (_c *Application_ApplyBlockRandomness_Call) RunAndReturn(run func(context1 context.Context, requestApplyBlockRandomness *types.RequestApplyBlockRandomness) (*types.ResponseApplyBlockRandomness, error)) *Application_ApplyBlockRandomness_Call { + _c.Call.Return(run) + return _c +} + // ApplySnapshotChunk provides a mock function for the type Application func (_mock *Application) ApplySnapshotChunk(context1 context.Context, requestApplySnapshotChunk *types.RequestApplySnapshotChunk) (*types.ResponseApplySnapshotChunk, error) { ret := _mock.Called(context1, requestApplySnapshotChunk) diff --git a/abci/types/types.pb.go b/abci/types/types.pb.go index 87837539b6..972df8ed8f 100644 --- a/abci/types/types.pb.go +++ b/abci/types/types.pb.go @@ -125,7 +125,7 @@ func (x ResponseOfferSnapshot_Result) String() string { } func (ResponseOfferSnapshot_Result) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{25, 0} + return fileDescriptor_252557cfdd89a31a, []int{26, 0} } type ResponseApplySnapshotChunk_Result int32 @@ -165,7 +165,7 @@ func (x ResponseApplySnapshotChunk_Result) String() string { } func (ResponseApplySnapshotChunk_Result) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{27, 0} + return fileDescriptor_252557cfdd89a31a, []int{28, 0} } type ResponseProcessProposal_ProposalStatus int32 @@ -193,7 +193,7 @@ func (x ResponseProcessProposal_ProposalStatus) String() string { } func (ResponseProcessProposal_ProposalStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{29, 0} + return fileDescriptor_252557cfdd89a31a, []int{30, 0} } type ResponseVerifyVoteExtension_VerifyStatus int32 @@ -221,7 +221,7 @@ func (x ResponseVerifyVoteExtension_VerifyStatus) String() string { } func (ResponseVerifyVoteExtension_VerifyStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{32, 0} + return fileDescriptor_252557cfdd89a31a, []int{33, 0} } // TxAction contains App-provided information on what to do with a transaction that is part of a raw proposal @@ -256,7 +256,7 @@ func (x TxRecord_TxAction) String() string { } func (TxRecord_TxAction) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{39, 0} + return fileDescriptor_252557cfdd89a31a, []int{41, 0} } // Request types @@ -277,6 +277,7 @@ type Request struct { // *Request_ExtendVote // *Request_VerifyVoteExtension // *Request_FinalizeBlock + // *Request_ApplyBlockRandomness Value isRequest_Value `protobuf_oneof:"value"` } @@ -364,22 +365,26 @@ type Request_VerifyVoteExtension struct { type Request_FinalizeBlock struct { FinalizeBlock *RequestFinalizeBlock `protobuf:"bytes,19,opt,name=finalize_block,json=finalizeBlock,proto3,oneof" json:"finalize_block,omitempty"` } - -func (*Request_Echo) isRequest_Value() {} -func (*Request_Flush) isRequest_Value() {} -func (*Request_Info) isRequest_Value() {} -func (*Request_InitChain) isRequest_Value() {} -func (*Request_Query) isRequest_Value() {} -func (*Request_CheckTx) isRequest_Value() {} -func (*Request_ListSnapshots) isRequest_Value() {} -func (*Request_OfferSnapshot) isRequest_Value() {} -func (*Request_LoadSnapshotChunk) isRequest_Value() {} -func (*Request_ApplySnapshotChunk) isRequest_Value() {} -func (*Request_PrepareProposal) isRequest_Value() {} -func (*Request_ProcessProposal) isRequest_Value() {} -func (*Request_ExtendVote) isRequest_Value() {} -func (*Request_VerifyVoteExtension) isRequest_Value() {} -func (*Request_FinalizeBlock) isRequest_Value() {} +type Request_ApplyBlockRandomness struct { + ApplyBlockRandomness *RequestApplyBlockRandomness `protobuf:"bytes,20,opt,name=apply_block_randomness,json=applyBlockRandomness,proto3,oneof" json:"apply_block_randomness,omitempty"` +} + +func (*Request_Echo) isRequest_Value() {} +func (*Request_Flush) isRequest_Value() {} +func (*Request_Info) isRequest_Value() {} +func (*Request_InitChain) isRequest_Value() {} +func (*Request_Query) isRequest_Value() {} +func (*Request_CheckTx) isRequest_Value() {} +func (*Request_ListSnapshots) isRequest_Value() {} +func (*Request_OfferSnapshot) isRequest_Value() {} +func (*Request_LoadSnapshotChunk) isRequest_Value() {} +func (*Request_ApplySnapshotChunk) isRequest_Value() {} +func (*Request_PrepareProposal) isRequest_Value() {} +func (*Request_ProcessProposal) isRequest_Value() {} +func (*Request_ExtendVote) isRequest_Value() {} +func (*Request_VerifyVoteExtension) isRequest_Value() {} +func (*Request_FinalizeBlock) isRequest_Value() {} +func (*Request_ApplyBlockRandomness) isRequest_Value() {} func (m *Request) GetValue() isRequest_Value { if m != nil { @@ -493,6 +498,13 @@ func (m *Request) GetFinalizeBlock() *RequestFinalizeBlock { return nil } +func (m *Request) GetApplyBlockRandomness() *RequestApplyBlockRandomness { + if x, ok := m.GetValue().(*Request_ApplyBlockRandomness); ok { + return x.ApplyBlockRandomness + } + return nil +} + // XXX_OneofWrappers is for the internal use of the proto package. func (*Request) XXX_OneofWrappers() []interface{} { return []interface{}{ @@ -511,6 +523,7 @@ func (*Request) XXX_OneofWrappers() []interface{} { (*Request_ExtendVote)(nil), (*Request_VerifyVoteExtension)(nil), (*Request_FinalizeBlock)(nil), + (*Request_ApplyBlockRandomness)(nil), } } @@ -1998,6 +2011,101 @@ func (m *RequestFinalizeBlock) GetBlockID() *types1.BlockID { return nil } +// Applies the block's randomness and returns the app hash the Precommit signs. +// +// #### Usage +// +// - Used from consensus version 2 (`VersionParams.consensus_version`). Before that, Tenderdash never calls it. +// - `RequestApplyBlockRandomness.beacon` is the random beacon of the block and round: the 96-byte BLS threshold +// signature recovered from the Prevotes of round `round` for the block `hash`. Tenderdash has verified it against +// the quorum's threshold public key before the call. +// - The Application applies the randomness to the state that `ProcessProposal` (or `PrepareProposal`) left for +// that block and round, and returns the resulting Merkle root hash in `ResponseApplyBlockRandomness.app_hash`. +// When nothing in the block uses randomness, `app_hash` equals the app hash of the block header. +// - The header keeps the app hash from `ProcessProposal`, which Prevotes sign. Precommits and the commit sign +// `ResponseApplyBlockRandomness.app_hash`, and the commit carries it in `Commit.app_hash`. +// - The implementation MUST be deterministic: every process that applies the same beacon to the same block +// and round MUST return the same `app_hash`. +// - Tenderdash may call it more than once for the same block, round and beacon; the Application MUST return +// the same `app_hash` each time. +// - An ABCI error is fatal, as for `ExtendVote`. +// +// #### When does Tenderdash call it? +// +// - On a validator, once the Prevotes of round _r_ for block _v_ reach the threshold and their signature is +// recovered, before `ExtendVote` and before signing its Precommit for _v_. +// - On every path that finalizes a block from a commit it did not assemble itself (block sync, replay, a +// node that did not vote): after `ProcessProposal` of the committed block for the commit round, with the +// commit's beacon, and before `FinalizeBlock`. Tenderdash compares the returned `app_hash` with +// `Commit.app_hash` and stops on a mismatch. +type RequestApplyBlockRandomness struct { + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,3,opt,name=round,proto3" json:"round,omitempty"` + Beacon []byte `protobuf:"bytes,4,opt,name=beacon,proto3" json:"beacon,omitempty"` +} + +func (m *RequestApplyBlockRandomness) Reset() { *m = RequestApplyBlockRandomness{} } +func (m *RequestApplyBlockRandomness) String() string { return proto.CompactTextString(m) } +func (*RequestApplyBlockRandomness) ProtoMessage() {} +func (*RequestApplyBlockRandomness) Descriptor() ([]byte, []int) { + return fileDescriptor_252557cfdd89a31a, []int{16} +} +func (m *RequestApplyBlockRandomness) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestApplyBlockRandomness) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RequestApplyBlockRandomness.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RequestApplyBlockRandomness) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestApplyBlockRandomness.Merge(m, src) +} +func (m *RequestApplyBlockRandomness) XXX_Size() int { + return m.Size() +} +func (m *RequestApplyBlockRandomness) XXX_DiscardUnknown() { + xxx_messageInfo_RequestApplyBlockRandomness.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestApplyBlockRandomness proto.InternalMessageInfo + +func (m *RequestApplyBlockRandomness) GetHash() []byte { + if m != nil { + return m.Hash + } + return nil +} + +func (m *RequestApplyBlockRandomness) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *RequestApplyBlockRandomness) GetRound() int32 { + if m != nil { + return m.Round + } + return 0 +} + +func (m *RequestApplyBlockRandomness) GetBeacon() []byte { + if m != nil { + return m.Beacon + } + return nil +} + type Response struct { // Types that are valid to be assigned to Value: // *Response_Exception @@ -2016,6 +2124,7 @@ type Response struct { // *Response_ExtendVote // *Response_VerifyVoteExtension // *Response_FinalizeBlock + // *Response_ApplyBlockRandomness Value isResponse_Value `protobuf_oneof:"value"` } @@ -2023,7 +2132,7 @@ func (m *Response) Reset() { *m = Response{} } func (m *Response) String() string { return proto.CompactTextString(m) } func (*Response) ProtoMessage() {} func (*Response) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{16} + return fileDescriptor_252557cfdd89a31a, []int{17} } func (m *Response) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2106,23 +2215,27 @@ type Response_VerifyVoteExtension struct { type Response_FinalizeBlock struct { FinalizeBlock *ResponseFinalizeBlock `protobuf:"bytes,16,opt,name=finalize_block,json=finalizeBlock,proto3,oneof" json:"finalize_block,omitempty"` } - -func (*Response_Exception) isResponse_Value() {} -func (*Response_Echo) isResponse_Value() {} -func (*Response_Flush) isResponse_Value() {} -func (*Response_Info) isResponse_Value() {} -func (*Response_InitChain) isResponse_Value() {} -func (*Response_Query) isResponse_Value() {} -func (*Response_CheckTx) isResponse_Value() {} -func (*Response_ListSnapshots) isResponse_Value() {} -func (*Response_OfferSnapshot) isResponse_Value() {} -func (*Response_LoadSnapshotChunk) isResponse_Value() {} -func (*Response_ApplySnapshotChunk) isResponse_Value() {} -func (*Response_PrepareProposal) isResponse_Value() {} -func (*Response_ProcessProposal) isResponse_Value() {} -func (*Response_ExtendVote) isResponse_Value() {} -func (*Response_VerifyVoteExtension) isResponse_Value() {} -func (*Response_FinalizeBlock) isResponse_Value() {} +type Response_ApplyBlockRandomness struct { + ApplyBlockRandomness *ResponseApplyBlockRandomness `protobuf:"bytes,17,opt,name=apply_block_randomness,json=applyBlockRandomness,proto3,oneof" json:"apply_block_randomness,omitempty"` +} + +func (*Response_Exception) isResponse_Value() {} +func (*Response_Echo) isResponse_Value() {} +func (*Response_Flush) isResponse_Value() {} +func (*Response_Info) isResponse_Value() {} +func (*Response_InitChain) isResponse_Value() {} +func (*Response_Query) isResponse_Value() {} +func (*Response_CheckTx) isResponse_Value() {} +func (*Response_ListSnapshots) isResponse_Value() {} +func (*Response_OfferSnapshot) isResponse_Value() {} +func (*Response_LoadSnapshotChunk) isResponse_Value() {} +func (*Response_ApplySnapshotChunk) isResponse_Value() {} +func (*Response_PrepareProposal) isResponse_Value() {} +func (*Response_ProcessProposal) isResponse_Value() {} +func (*Response_ExtendVote) isResponse_Value() {} +func (*Response_VerifyVoteExtension) isResponse_Value() {} +func (*Response_FinalizeBlock) isResponse_Value() {} +func (*Response_ApplyBlockRandomness) isResponse_Value() {} func (m *Response) GetValue() isResponse_Value { if m != nil { @@ -2243,6 +2356,13 @@ func (m *Response) GetFinalizeBlock() *ResponseFinalizeBlock { return nil } +func (m *Response) GetApplyBlockRandomness() *ResponseApplyBlockRandomness { + if x, ok := m.GetValue().(*Response_ApplyBlockRandomness); ok { + return x.ApplyBlockRandomness + } + return nil +} + // XXX_OneofWrappers is for the internal use of the proto package. func (*Response) XXX_OneofWrappers() []interface{} { return []interface{}{ @@ -2262,6 +2382,7 @@ func (*Response) XXX_OneofWrappers() []interface{} { (*Response_ExtendVote)(nil), (*Response_VerifyVoteExtension)(nil), (*Response_FinalizeBlock)(nil), + (*Response_ApplyBlockRandomness)(nil), } } @@ -2274,7 +2395,7 @@ func (m *ResponseException) Reset() { *m = ResponseException{} } func (m *ResponseException) String() string { return proto.CompactTextString(m) } func (*ResponseException) ProtoMessage() {} func (*ResponseException) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{17} + return fileDescriptor_252557cfdd89a31a, []int{18} } func (m *ResponseException) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2318,7 +2439,7 @@ func (m *ResponseEcho) Reset() { *m = ResponseEcho{} } func (m *ResponseEcho) String() string { return proto.CompactTextString(m) } func (*ResponseEcho) ProtoMessage() {} func (*ResponseEcho) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{18} + return fileDescriptor_252557cfdd89a31a, []int{19} } func (m *ResponseEcho) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2361,7 +2482,7 @@ func (m *ResponseFlush) Reset() { *m = ResponseFlush{} } func (m *ResponseFlush) String() string { return proto.CompactTextString(m) } func (*ResponseFlush) ProtoMessage() {} func (*ResponseFlush) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{19} + return fileDescriptor_252557cfdd89a31a, []int{20} } func (m *ResponseFlush) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2402,7 +2523,7 @@ func (m *ResponseInfo) Reset() { *m = ResponseInfo{} } func (m *ResponseInfo) String() string { return proto.CompactTextString(m) } func (*ResponseInfo) ProtoMessage() {} func (*ResponseInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{20} + return fileDescriptor_252557cfdd89a31a, []int{21} } func (m *ResponseInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2486,7 +2607,7 @@ func (m *ResponseInitChain) Reset() { *m = ResponseInitChain{} } func (m *ResponseInitChain) String() string { return proto.CompactTextString(m) } func (*ResponseInitChain) ProtoMessage() {} func (*ResponseInitChain) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{21} + return fileDescriptor_252557cfdd89a31a, []int{22} } func (m *ResponseInitChain) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2603,7 +2724,7 @@ func (m *ResponseQuery) Reset() { *m = ResponseQuery{} } func (m *ResponseQuery) String() string { return proto.CompactTextString(m) } func (*ResponseQuery) ProtoMessage() {} func (*ResponseQuery) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{22} + return fileDescriptor_252557cfdd89a31a, []int{23} } func (m *ResponseQuery) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2709,7 +2830,7 @@ func (m *ResponseCheckTx) Reset() { *m = ResponseCheckTx{} } func (m *ResponseCheckTx) String() string { return proto.CompactTextString(m) } func (*ResponseCheckTx) ProtoMessage() {} func (*ResponseCheckTx) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{23} + return fileDescriptor_252557cfdd89a31a, []int{24} } func (m *ResponseCheckTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2795,7 +2916,7 @@ func (m *ResponseListSnapshots) Reset() { *m = ResponseListSnapshots{} } func (m *ResponseListSnapshots) String() string { return proto.CompactTextString(m) } func (*ResponseListSnapshots) ProtoMessage() {} func (*ResponseListSnapshots) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{24} + return fileDescriptor_252557cfdd89a31a, []int{25} } func (m *ResponseListSnapshots) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2839,7 +2960,7 @@ func (m *ResponseOfferSnapshot) Reset() { *m = ResponseOfferSnapshot{} } func (m *ResponseOfferSnapshot) String() string { return proto.CompactTextString(m) } func (*ResponseOfferSnapshot) ProtoMessage() {} func (*ResponseOfferSnapshot) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{25} + return fileDescriptor_252557cfdd89a31a, []int{26} } func (m *ResponseOfferSnapshot) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2885,7 +3006,7 @@ func (m *ResponseLoadSnapshotChunk) Reset() { *m = ResponseLoadSnapshotC func (m *ResponseLoadSnapshotChunk) String() string { return proto.CompactTextString(m) } func (*ResponseLoadSnapshotChunk) ProtoMessage() {} func (*ResponseLoadSnapshotChunk) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{26} + return fileDescriptor_252557cfdd89a31a, []int{27} } func (m *ResponseLoadSnapshotChunk) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2938,7 +3059,7 @@ func (m *ResponseApplySnapshotChunk) Reset() { *m = ResponseApplySnapsho func (m *ResponseApplySnapshotChunk) String() string { return proto.CompactTextString(m) } func (*ResponseApplySnapshotChunk) ProtoMessage() {} func (*ResponseApplySnapshotChunk) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{27} + return fileDescriptor_252557cfdd89a31a, []int{28} } func (m *ResponseApplySnapshotChunk) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3016,7 +3137,7 @@ func (m *ResponsePrepareProposal) Reset() { *m = ResponsePrepareProposal func (m *ResponsePrepareProposal) String() string { return proto.CompactTextString(m) } func (*ResponsePrepareProposal) ProtoMessage() {} func (*ResponsePrepareProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{28} + return fileDescriptor_252557cfdd89a31a, []int{29} } func (m *ResponsePrepareProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3113,7 +3234,7 @@ func (m *ResponseProcessProposal) Reset() { *m = ResponseProcessProposal func (m *ResponseProcessProposal) String() string { return proto.CompactTextString(m) } func (*ResponseProcessProposal) ProtoMessage() {} func (*ResponseProcessProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{29} + return fileDescriptor_252557cfdd89a31a, []int{30} } func (m *ResponseProcessProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3202,7 +3323,7 @@ func (m *ExtendVoteExtension) Reset() { *m = ExtendVoteExtension{} } func (m *ExtendVoteExtension) String() string { return proto.CompactTextString(m) } func (*ExtendVoteExtension) ProtoMessage() {} func (*ExtendVoteExtension) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{30} + return fileDescriptor_252557cfdd89a31a, []int{31} } func (m *ExtendVoteExtension) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3286,7 +3407,7 @@ func (m *ResponseExtendVote) Reset() { *m = ResponseExtendVote{} } func (m *ResponseExtendVote) String() string { return proto.CompactTextString(m) } func (*ResponseExtendVote) ProtoMessage() {} func (*ResponseExtendVote) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{31} + return fileDescriptor_252557cfdd89a31a, []int{32} } func (m *ResponseExtendVote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3330,7 +3451,7 @@ func (m *ResponseVerifyVoteExtension) Reset() { *m = ResponseVerifyVoteE func (m *ResponseVerifyVoteExtension) String() string { return proto.CompactTextString(m) } func (*ResponseVerifyVoteExtension) ProtoMessage() {} func (*ResponseVerifyVoteExtension) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{32} + return fileDescriptor_252557cfdd89a31a, []int{33} } func (m *ResponseVerifyVoteExtension) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3381,7 +3502,7 @@ func (m *ResponseFinalizeBlock) Reset() { *m = ResponseFinalizeBlock{} } func (m *ResponseFinalizeBlock) String() string { return proto.CompactTextString(m) } func (*ResponseFinalizeBlock) ProtoMessage() {} func (*ResponseFinalizeBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{33} + return fileDescriptor_252557cfdd89a31a, []int{34} } func (m *ResponseFinalizeBlock) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3424,18 +3545,70 @@ func (m *ResponseFinalizeBlock) GetProposeNextBlockImmediately() bool { return false } +type ResponseApplyBlockRandomness struct { + // The Merkle root hash of the application state after the randomness is applied. 32 bytes. + // Equals the header app hash when nothing in the block uses randomness. + AppHash []byte `protobuf:"bytes,1,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` +} + +func (m *ResponseApplyBlockRandomness) Reset() { *m = ResponseApplyBlockRandomness{} } +func (m *ResponseApplyBlockRandomness) String() string { return proto.CompactTextString(m) } +func (*ResponseApplyBlockRandomness) ProtoMessage() {} +func (*ResponseApplyBlockRandomness) Descriptor() ([]byte, []int) { + return fileDescriptor_252557cfdd89a31a, []int{35} +} +func (m *ResponseApplyBlockRandomness) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResponseApplyBlockRandomness) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResponseApplyBlockRandomness.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ResponseApplyBlockRandomness) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseApplyBlockRandomness.Merge(m, src) +} +func (m *ResponseApplyBlockRandomness) XXX_Size() int { + return m.Size() +} +func (m *ResponseApplyBlockRandomness) XXX_DiscardUnknown() { + xxx_messageInfo_ResponseApplyBlockRandomness.DiscardUnknown(m) +} + +var xxx_messageInfo_ResponseApplyBlockRandomness proto.InternalMessageInfo + +func (m *ResponseApplyBlockRandomness) GetAppHash() []byte { + if m != nil { + return m.AppHash + } + return nil +} + type CommitInfo struct { Round int32 `protobuf:"varint,1,opt,name=round,proto3" json:"round,omitempty"` QuorumHash []byte `protobuf:"bytes,2,opt,name=quorum_hash,json=quorumHash,proto3" json:"quorum_hash,omitempty"` BlockSignature []byte `protobuf:"bytes,3,opt,name=block_signature,json=blockSignature,proto3" json:"block_signature,omitempty"` ThresholdVoteExtensions []*types1.VoteExtension `protobuf:"bytes,4,rep,name=threshold_vote_extensions,json=thresholdVoteExtensions,proto3" json:"threshold_vote_extensions,omitempty"` + // Random beacon of the committed block: the threshold signature recovered from the prevotes of + // the commit round. Set from consensus version 2; empty before. + Beacon []byte `protobuf:"bytes,5,opt,name=beacon,proto3" json:"beacon,omitempty"` + // App hash the commit signs: the result of `ApplyBlockRandomness` for the committed block and + // round. Set from consensus version 2; empty before. + AppHash []byte `protobuf:"bytes,6,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` } func (m *CommitInfo) Reset() { *m = CommitInfo{} } func (m *CommitInfo) String() string { return proto.CompactTextString(m) } func (*CommitInfo) ProtoMessage() {} func (*CommitInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{34} + return fileDescriptor_252557cfdd89a31a, []int{36} } func (m *CommitInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3492,6 +3665,20 @@ func (m *CommitInfo) GetThresholdVoteExtensions() []*types1.VoteExtension { return nil } +func (m *CommitInfo) GetBeacon() []byte { + if m != nil { + return m.Beacon + } + return nil +} + +func (m *CommitInfo) GetAppHash() []byte { + if m != nil { + return m.AppHash + } + return nil +} + // Event allows application developers to attach additional information to // ResponseCheckTx, ResponsePrepareProposal, ResponseProcessProposal // and ResponseFinalizeBlock. @@ -3506,7 +3693,7 @@ func (m *Event) Reset() { *m = Event{} } func (m *Event) String() string { return proto.CompactTextString(m) } func (*Event) ProtoMessage() {} func (*Event) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{35} + return fileDescriptor_252557cfdd89a31a, []int{37} } func (m *Event) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3560,7 +3747,7 @@ func (m *EventAttribute) Reset() { *m = EventAttribute{} } func (m *EventAttribute) String() string { return proto.CompactTextString(m) } func (*EventAttribute) ProtoMessage() {} func (*EventAttribute) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{36} + return fileDescriptor_252557cfdd89a31a, []int{38} } func (m *EventAttribute) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3626,7 +3813,7 @@ func (m *ExecTxResult) Reset() { *m = ExecTxResult{} } func (m *ExecTxResult) String() string { return proto.CompactTextString(m) } func (*ExecTxResult) ProtoMessage() {} func (*ExecTxResult) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{37} + return fileDescriptor_252557cfdd89a31a, []int{39} } func (m *ExecTxResult) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3718,7 +3905,7 @@ func (m *TxResult) Reset() { *m = TxResult{} } func (m *TxResult) String() string { return proto.CompactTextString(m) } func (*TxResult) ProtoMessage() {} func (*TxResult) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{38} + return fileDescriptor_252557cfdd89a31a, []int{40} } func (m *TxResult) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3784,7 +3971,7 @@ func (m *TxRecord) Reset() { *m = TxRecord{} } func (m *TxRecord) String() string { return proto.CompactTextString(m) } func (*TxRecord) ProtoMessage() {} func (*TxRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{39} + return fileDescriptor_252557cfdd89a31a, []int{41} } func (m *TxRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3837,7 +4024,7 @@ func (m *Validator) Reset() { *m = Validator{} } func (m *Validator) String() string { return proto.CompactTextString(m) } func (*Validator) ProtoMessage() {} func (*Validator) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{40} + return fileDescriptor_252557cfdd89a31a, []int{42} } func (m *Validator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3894,7 +4081,7 @@ func (m *ValidatorUpdate) Reset() { *m = ValidatorUpdate{} } func (m *ValidatorUpdate) String() string { return proto.CompactTextString(m) } func (*ValidatorUpdate) ProtoMessage() {} func (*ValidatorUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{41} + return fileDescriptor_252557cfdd89a31a, []int{43} } func (m *ValidatorUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3976,7 +4163,7 @@ func (m *ValidatorSetUpdate) Reset() { *m = ValidatorSetUpdate{} } func (m *ValidatorSetUpdate) String() string { return proto.CompactTextString(m) } func (*ValidatorSetUpdate) ProtoMessage() {} func (*ValidatorSetUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{42} + return fileDescriptor_252557cfdd89a31a, []int{44} } func (m *ValidatorSetUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4034,7 +4221,7 @@ func (m *ThresholdPublicKeyUpdate) Reset() { *m = ThresholdPublicKeyUpda func (m *ThresholdPublicKeyUpdate) String() string { return proto.CompactTextString(m) } func (*ThresholdPublicKeyUpdate) ProtoMessage() {} func (*ThresholdPublicKeyUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{43} + return fileDescriptor_252557cfdd89a31a, []int{45} } func (m *ThresholdPublicKeyUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4078,7 +4265,7 @@ func (m *QuorumHashUpdate) Reset() { *m = QuorumHashUpdate{} } func (m *QuorumHashUpdate) String() string { return proto.CompactTextString(m) } func (*QuorumHashUpdate) ProtoMessage() {} func (*QuorumHashUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{44} + return fileDescriptor_252557cfdd89a31a, []int{46} } func (m *QuorumHashUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4124,7 +4311,7 @@ func (m *VoteInfo) Reset() { *m = VoteInfo{} } func (m *VoteInfo) String() string { return proto.CompactTextString(m) } func (*VoteInfo) ProtoMessage() {} func (*VoteInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{45} + return fileDescriptor_252557cfdd89a31a, []int{47} } func (m *VoteInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4181,7 +4368,7 @@ func (m *ExtendedVoteInfo) Reset() { *m = ExtendedVoteInfo{} } func (m *ExtendedVoteInfo) String() string { return proto.CompactTextString(m) } func (*ExtendedVoteInfo) ProtoMessage() {} func (*ExtendedVoteInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{46} + return fileDescriptor_252557cfdd89a31a, []int{48} } func (m *ExtendedVoteInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4249,7 +4436,7 @@ func (m *Misbehavior) Reset() { *m = Misbehavior{} } func (m *Misbehavior) String() string { return proto.CompactTextString(m) } func (*Misbehavior) ProtoMessage() {} func (*Misbehavior) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{47} + return fileDescriptor_252557cfdd89a31a, []int{49} } func (m *Misbehavior) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4324,7 +4511,7 @@ func (m *Snapshot) Reset() { *m = Snapshot{} } func (m *Snapshot) String() string { return proto.CompactTextString(m) } func (*Snapshot) ProtoMessage() {} func (*Snapshot) Descriptor() ([]byte, []int) { - return fileDescriptor_252557cfdd89a31a, []int{48} + return fileDescriptor_252557cfdd89a31a, []int{50} } func (m *Snapshot) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -4405,6 +4592,7 @@ func init() { proto.RegisterType((*RequestExtendVote)(nil), "tendermint.abci.RequestExtendVote") proto.RegisterType((*RequestVerifyVoteExtension)(nil), "tendermint.abci.RequestVerifyVoteExtension") proto.RegisterType((*RequestFinalizeBlock)(nil), "tendermint.abci.RequestFinalizeBlock") + proto.RegisterType((*RequestApplyBlockRandomness)(nil), "tendermint.abci.RequestApplyBlockRandomness") proto.RegisterType((*Response)(nil), "tendermint.abci.Response") proto.RegisterType((*ResponseException)(nil), "tendermint.abci.ResponseException") proto.RegisterType((*ResponseEcho)(nil), "tendermint.abci.ResponseEcho") @@ -4423,6 +4611,7 @@ func init() { proto.RegisterType((*ResponseExtendVote)(nil), "tendermint.abci.ResponseExtendVote") proto.RegisterType((*ResponseVerifyVoteExtension)(nil), "tendermint.abci.ResponseVerifyVoteExtension") proto.RegisterType((*ResponseFinalizeBlock)(nil), "tendermint.abci.ResponseFinalizeBlock") + proto.RegisterType((*ResponseApplyBlockRandomness)(nil), "tendermint.abci.ResponseApplyBlockRandomness") proto.RegisterType((*CommitInfo)(nil), "tendermint.abci.CommitInfo") proto.RegisterType((*Event)(nil), "tendermint.abci.Event") proto.RegisterType((*EventAttribute)(nil), "tendermint.abci.EventAttribute") @@ -4443,241 +4632,248 @@ func init() { func init() { proto.RegisterFile("tendermint/abci/types.proto", fileDescriptor_252557cfdd89a31a) } var fileDescriptor_252557cfdd89a31a = []byte{ - // 3737 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x5b, 0xcb, 0x73, 0xdb, 0x56, - 0x77, 0x27, 0xf8, 0xe6, 0xe1, 0x0b, 0xba, 0x92, 0x6d, 0x9a, 0xb6, 0x25, 0x05, 0x6e, 0x62, 0xc7, - 0x49, 0xa4, 0xc4, 0x6e, 0xe2, 0xa4, 0x49, 0x3b, 0x43, 0x51, 0x74, 0x29, 0x59, 0x96, 0x14, 0x88, - 0x52, 0x26, 0x4d, 0x13, 0x0c, 0x44, 0x5e, 0x89, 0x88, 0x49, 0x02, 0x01, 0x40, 0x99, 0xca, 0xb6, - 0xcd, 0x4c, 0x27, 0x9b, 0xe6, 0x1f, 0xc8, 0xae, 0x5d, 0x76, 0xdf, 0x55, 0x3b, 0x5d, 0x35, 0x9d, - 0x6e, 0xb2, 0xec, 0x4c, 0xa7, 0x6e, 0xc6, 0xd9, 0x75, 0x97, 0x55, 0x37, 0xdf, 0xe2, 0x9b, 0xfb, - 0x00, 0x08, 0x10, 0x00, 0x1f, 0x71, 0x66, 0xbe, 0xf9, 0x76, 0xb8, 0xe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4d, 0x66, 0xb3, 0x62, 0x6e, 0x37, - 0x99, 0xcd, 0x89, 0xb0, 0x9b, 0xcc, 0x82, 0x98, 0x97, 0xee, 0x40, 0xde, 0xe3, 0x5e, 0x50, 0x05, - 0x32, 0x7d, 0x6c, 0x59, 0xea, 0x39, 0xa6, 0xde, 0x28, 0x27, 0x3b, 0x4d, 0xa9, 0x04, 0x05, 0xaf, - 0x4b, 0x91, 0xbe, 0x13, 0x20, 0xef, 0xf1, 0x16, 0x44, 0x92, 0xbb, 0x47, 0x47, 0x92, 0x37, 0xd1, - 0x6d, 0x28, 0xd2, 0xa9, 0x28, 0x4e, 0x3f, 0x71, 0x59, 0x49, 0xb9, 0x40, 0x89, 0x27, 0x9c, 0x69, - 0x0d, 0xf2, 0xc6, 0x7d, 0xc3, 0x65, 0x49, 0x50, 0x16, 0x30, 0xee, 0x1b, 0x0e, 0xc3, 0x2b, 0x50, - 0x20, 0xf3, 0x76, 0x39, 0x92, 0xf4, 0x47, 0xf2, 0x84, 0xc6, 0x59, 0xa4, 0xbf, 0x4d, 0x80, 0x38, - 0xe9, 0x86, 0xd0, 0xfb, 0x90, 0x24, 0x1e, 0x99, 0x3b, 0xd7, 0xea, 0x06, 0x73, 0xd7, 0x1b, 0x8e, - 0xbb, 0xde, 0x68, 0x39, 0xee, 0x7a, 0x2b, 0xfb, 0xc3, 0xf3, 0xb5, 0xd8, 0x77, 0xff, 0xbb, 0x26, - 0xc8, 0x54, 0x02, 0x5d, 0x27, 0xce, 0x47, 0xd5, 0x06, 0x8a, 0xd6, 0xa1, 0x43, 0xce, 0x11, 0xcf, - 0xa2, 0x6a, 0x83, 0x9d, 0x0e, 0xda, 0x03, 0xb1, 0xad, 0x0f, 0x2c, 0x3c, 0xb0, 0x86, 0x96, 0xc2, - 0xc2, 0x45, 0x25, 0x11, 0x74, 0x8c, 0x2c, 0x4e, 0xd4, 0x1d, 0xce, 0x43, 0xca, 0x28, 0x97, 0xdb, - 0x7e, 0x02, 0xda, 0x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a, 0xe0, 0x88, 0xbe, 0xf0, 0xa2, 0xcf, 0x60, 0xc5, 0x87, - 0x7d, 0x38, 0xc9, 0x5f, 0x62, 0x31, 0x08, 0x24, 0xe6, 0xc9, 0x45, 0xdc, 0x1e, 0xf4, 0x39, 0xdc, - 0xa0, 0x69, 0x6c, 0x44, 0x82, 0x99, 0x9c, 0x2f, 0xc1, 0xbc, 0x46, 0x74, 0xd4, 0x43, 0x92, 0xcc, - 0x08, 0x60, 0x24, 0x15, 0x01, 0x8c, 0xa0, 0x3d, 0x28, 0x9c, 0xe3, 0x01, 0xb6, 0x34, 0x4b, 0x59, - 0xe0, 0x66, 0x28, 0x90, 0xbc, 0xbc, 0x19, 0x93, 0xf3, 0x5c, 0x96, 0xf4, 0xfe, 0x9d, 0x20, 0x6c, - 0x95, 0xa1, 0xa8, 0x78, 0xd5, 0x49, 0xff, 0x2f, 0x40, 0xd1, 0x17, 0x59, 0x88, 0x15, 0xb6, 0xf5, - 0x0e, 0x33, 0xdf, 0xa2, 0x4c, 0xbf, 0xc9, 0x1d, 0xa8, 0xa7, 0x9f, 0x73, 0x0b, 0x24, 0x9f, 0x84, - 0xcb, 0xad, 0x09, 0xe4, 0x78, 0x1c, 0x5c, 0x81, 0x94, 0x36, 0xe8, 0xe0, 0x11, 0x37, 0x32, 0xd6, - 0x20, 0xb2, 0x4f, 0xf1, 0x25, 0x37, 0x25, 0xf2, 0x89, 0x56, 0xf8, 0x39, 0xa3, 0x73, 0x29, 0xc8, - 0xac, 0x81, 0xde, 0x87, 0x1c, 0x2d, 0xec, 0x28, 0xba, 0x61, 0x55, 0x32, 0xc1, 0x84, 0x8b, 0x15, - 0x61, 0x36, 0x0e, 0x09, 0xcf, 0x81, 0x61, 0xc9, 0x59, 0x83, 0x7f, 0x79, 0x52, 0xa2, 0xac, 0x2f, - 0x25, 0xba, 0x09, 0x39, 0x32, 0x7a, 0xcb, 0x50, 0xdb, 0x98, 0x46, 0xa1, 0x9c, 0x3c, 0x26, 0x48, - 0xff, 0x22, 0x40, 0x79, 0x22, 0x30, 0x86, 0xce, 0xdd, 0x39, 0x95, 0x71, 0x3f, 0x12, 0x15, 0x98, - 0xfd, 0x2d, 0x80, 0x73, 0xd5, 0x52, 0x9e, 0xa9, 0x03, 0x1b, 0x77, 0xf8, 0x12, 0xe4, 0xce, 0x55, - 0xeb, 0x13, 0x4a, 0xf0, 0x0f, 0x26, 0x35, 0x31, 0x18, 0x0f, 0x16, 0x92, 0xf6, 0x62, 0x21, 0xa8, - 0x0a, 0x59, 0xc3, 0xd4, 0x74, 0x53, 0xb3, 0x2f, 0xe9, 0x9a, 0x24, 0x64, 0xb7, 0x2d, 0x1d, 0xc2, - 0x95, 0xd0, 0x98, 0x8c, 0x1e, 0x42, 0x6e, 0x1c, 0xce, 0x85, 0xf5, 0xc4, 0x64, 0x1a, 0xe7, 0x87, - 0x98, 0xc6, 0xbc, 0x64, 0x49, 0xae, 0x84, 0x46, 0x65, 0xd4, 0x80, 0xb4, 0x89, 0xad, 0x61, 0x8f, - 0xa5, 0xc2, 0xa5, 0xfb, 0x6f, 0xcd, 0x17, 0xcd, 0x09, 0x75, 0xd8, 0xb3, 0x65, 0x2e, 0x2c, 0x7d, - 0x01, 0x69, 0x46, 0x41, 0x79, 0xc8, 0x1c, 0xef, 0x3f, 0xde, 0x3f, 0xf8, 0x64, 0x5f, 0x8c, 0x21, - 0x80, 0x74, 0xad, 0x5e, 0x6f, 0x1c, 0xb6, 0x44, 0x01, 0xe5, 0x20, 0x55, 0xdb, 0x3a, 0x90, 0x5b, - 0x62, 0x9c, 0x90, 0xe5, 0xc6, 0x6e, 0xa3, 0xde, 0x12, 0x13, 0x68, 0x09, 0x8a, 0xec, 0x5b, 0x79, - 0x74, 0x20, 0x3f, 0xa9, 0xb5, 0xc4, 0xa4, 0x87, 0x74, 0xd4, 0xd8, 0xdf, 0x6e, 0xc8, 0x62, 0x4a, - 0x7a, 0x07, 0xae, 0x3b, 0xe3, 0x08, 0x42, 0x61, 0x2e, 0x0a, 0x25, 0x78, 0x50, 0x28, 0xe9, 0xc7, - 0x38, 0x54, 0x1d, 0x99, 0x10, 0x54, 0x6b, 0x77, 0x62, 0xe2, 0xf7, 0x17, 0xc8, 0x08, 0x26, 0x66, - 0x4f, 0xa0, 0x53, 0x13, 0x9f, 0x61, 0xbb, 0xdd, 0x65, 0x49, 0x86, 0x03, 0x53, 0x15, 0x39, 0x95, - 0x0a, 0x59, 0x8c, 0xed, 0x4b, 0xdc, 0xb6, 0x15, 0x66, 0x04, 0x16, 0x05, 0x03, 0x72, 0x72, 0x91, - 0x51, 0x8f, 0x18, 0x91, 0xf8, 0x7f, 0xe6, 0xa7, 0x98, 0xaa, 0x24, 0x55, 0x05, 0xd4, 0xed, 0x50, - 0x8a, 0xf4, 0x6c, 0xa1, 0xc5, 0xce, 0x41, 0x4a, 0x6e, 0xb4, 0xe4, 0x4f, 0xc5, 0x04, 0x42, 0x50, - 0xa2, 0x9f, 0xca, 0xd1, 0x7e, 0xed, 0xf0, 0xa8, 0x79, 0x40, 0x16, 0x7b, 0x19, 0xca, 0xce, 0x62, - 0x3b, 0xc4, 0x14, 0xba, 0x02, 0x4b, 0xf5, 0x83, 0x27, 0x87, 0x7b, 0x8d, 0x56, 0x63, 0x4c, 0x4e, - 0x4b, 0xff, 0x9d, 0x80, 0x6b, 0x11, 0xa9, 0x0c, 0x7a, 0x1f, 0xc0, 0x1e, 0x29, 0x26, 0x6e, 0xeb, - 0x66, 0x27, 0xda, 0x38, 0x5b, 0x23, 0x99, 0x72, 0xc8, 0x39, 0x9b, 0x7f, 0x4d, 0x8d, 0x07, 0x1f, - 0x71, 0xa5, 0x64, 0xb2, 0x16, 0x87, 0x4e, 0x6e, 0x85, 0xdc, 0x05, 0x71, 0x9b, 0x28, 0xa6, 0x7b, - 0x92, 0xb3, 0xf9, 0x97, 0x85, 0x3e, 0x85, 0x6b, 0x13, 0x61, 0x8b, 0xfb, 0x7a, 0x2b, 0xac, 0x6e, - 0x19,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, 0x2b, 0x61, 0x10, 0x92, 0xf0, 0x12, 0x10, 0xd2, 0x3f, 0x0a, - 0x70, 0x63, 0xca, 0x0d, 0x06, 0x7d, 0x3c, 0x71, 0x2e, 0x3e, 0x58, 0xe4, 0xfe, 0xb3, 0xc1, 0x68, - 0xfe, 0x93, 0x21, 0x3d, 0x80, 0x82, 0x97, 0x3e, 0xdf, 0xe6, 0xfd, 0xbd, 0x27, 0xc0, 0xfb, 0xb1, - 0xae, 0xdb, 0x50, 0x34, 0xb1, 0x4d, 0xbc, 0x94, 0x0f, 0x1c, 0x2c, 0x30, 0x22, 0xcf, 0x45, 0xeb, - 0xb0, 0xca, 0x31, 0x4d, 0x85, 0x86, 0x1e, 0x8e, 0x15, 0xf5, 0xfb, 0xb8, 0xa3, 0xa9, 0x36, 0xee, - 0x5d, 0xd2, 0xbd, 0xc9, 0xca, 0x37, 0x38, 0xd7, 0x3e, 0x1e, 0xb1, 0x7b, 0xc3, 0xce, 0x98, 0x65, - 0x37, 0x99, 0x15, 0xc4, 0xb8, 0x6b, 0x85, 0xff, 0x21, 0x00, 0x8c, 0x51, 0xb4, 0x31, 0x8a, 0x25, - 0x78, 0x51, 0xac, 0x09, 0xf0, 0x33, 0x3e, 0x09, 0x7e, 0xa2, 0x3b, 0x50, 0x66, 0x63, 0x21, 0xbb, - 0xaf, 0xda, 0x43, 0x13, 0x73, 0xcc, 0xac, 0x44, 0xc9, 0x47, 0x0e, 0x15, 0x7d, 0x06, 0xd7, 0xed, - 0xae, 0x89, 0xad, 0xae, 0xde, 0xeb, 0x28, 0x93, 0x16, 0xc0, 0x6a, 0x39, 0x6b, 0x33, 0x4c, 0x57, - 0xbe, 0xe6, 0x6a, 0x38, 0xf1, 0x5b, 0xc1, 0xd7, 0x90, 0xa2, 0x87, 0x8f, 0xa4, 0x87, 0xee, 0x59, - 0xc8, 0x71, 0x33, 0xff, 0x1c, 0x40, 0xb5, 0x6d, 0x53, 0x3b, 0x1d, 0xda, 0x98, 0x05, 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b, 0x9b, 0x5c, 0x9d, 0xb3, 0xa4, 0x87, 0xbe, 0x84, 0xa5, 0x20, - 0x1a, 0x37, 0xff, 0x53, 0xe5, 0xea, 0x02, 0x45, 0x3e, 0xd4, 0x07, 0x14, 0x82, 0xe2, 0x2d, 0xf0, - 0x72, 0xb9, 0xba, 0x48, 0xcd, 0x0f, 0x75, 0xa0, 0x3c, 0x89, 0x70, 0xcd, 0xfb, 0x92, 0xb9, 0x3a, - 0x77, 0xfd, 0x8f, 0xfd, 0x8a, 0x1f, 0x69, 0x99, 0xf7, 0x65, 0x73, 0x75, 0xee, 0x72, 0x20, 0x3a, - 0x06, 0xf0, 0xdc, 0x90, 0xe7, 0x78, 0xe9, 0x5c, 0x9d, 0xa7, 0x30, 0x88, 0x0c, 0x58, 0x0e, 0xbb, - 0x12, 0x2f, 0xf2, 0xf0, 0xb9, 0xba, 0x50, 0xbd, 0x90, 0xd8, 0xb3, 0xff, 0x72, 0x3b, 0xdf, 0x43, - 0xe8, 0xea, 0x9c, 0x85, 0xc3, 0xad, 0xad, 0x1f, 0x5e, 0xac, 0x0a, 0x3f, 0xbe, 0x58, 0x15, 0x7e, - 0x7a, 0xb1, 0x2a, 0x7c, 0xf7, 0xf3, 0x6a, 0xec, 0xc7, 0x9f, 0x57, 0x63, 0xff, 0xf5, 0xf3, 0x6a, - 0xec, 0xaf, 0xee, 0x9e, 0x6b, 0x76, 0x77, 0x78, 0xba, 0xd1, 0xd6, 0xfb, 0xf4, 0x7f, 0x28, 0x86, - 0x7a, 0xb9, 0xc9, 0x74, 0x92, 0x96, 0xe7, 0xdf, 0x2e, 0xa7, 0x69, 0x1a, 0xeb, 0x1e, 0xfc, 0x7e, - 0x00, 0xb8, 0x8f, 0x2b, 0xda, 0x0d, 0x33, 0x00, 0x00, + // 3845 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x5b, 0xcd, 0x73, 0x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x16, 0xdf, 0xbe, 0xd9, 0xcc, 0xf1, 0x86, 0x9c, 0xa3, 0x72, 0xfb, + 0x9a, 0xf4, 0x1a, 0xee, 0xcc, 0xb9, 0x73, 0xbc, 0xbb, 0x45, 0x12, 0xee, 0x73, 0xac, 0xf6, 0x78, + 0x36, 0x5f, 0x92, 0x79, 0x4b, 0xfa, 0x7b, 0x80, 0xbc, 0x8c, 0x6d, 0x93, 0x9c, 0x1d, 0xb4, 0x0b, + 0x05, 0x3c, 0xe9, 0x61, 0xd3, 0x71, 0xaf, 0x16, 0xd1, 0x17, 0x44, 0xc6, 0xdd, 0x76, 0x39, 0x09, + 0xc8, 0xe1, 0x89, 0xa1, 0xc7, 0x1c, 0xc7, 0x89, 0x87, 0x64, 0xb8, 0xb8, 0x1f, 0xc8, 0xf9, 0x89, + 0x0b, 0xe4, 0xb0, 0x0c, 0x63, 0x23, 0x56, 0x6a, 0x06, 0xc9, 0x79, 0xcc, 0x91, 0x9c, 0xf4, 0x82, + 0x1f, 0x0b, 0x40, 0x39, 0xad, 0x00, 0x94, 0x93, 0x59, 0x30, 0xcd, 0x18, 0x2c, 0xe7, 0x27, 0x2e, + 0x96, 0x93, 0x5d, 0x30, 0xe2, 0x19, 0x30, 0xe7, 0x8f, 0x43, 0x60, 0xce, 0x56, 0xac, 0x68, 0x04, + 0x9a, 0x73, 0x1c, 0x42, 0x73, 0xf2, 0x54, 0xc9, 0x0f, 0x62, 0x95, 0x2c, 0x80, 0x73, 0x8e, 0x43, + 0x70, 0x4e, 0x61, 0x81, 0xc2, 0x05, 0x78, 0xce, 0x9f, 0x47, 0xe3, 0x39, 0x10, 0x8b, 0xb8, 0xf0, + 0x61, 0x2e, 0x07, 0xe8, 0x28, 0x31, 0x80, 0x4e, 0x31, 0x16, 0x7c, 0x60, 0xea, 0x97, 0x46, 0x74, + 0xce, 0x22, 0x10, 0x1d, 0x96, 0x35, 0x3d, 0x88, 0x55, 0xbe, 0x04, 0xa4, 0x73, 0x16, 0x01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+ 0x61, 0x36, 0x35, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -4708,6 +4904,7 @@ type ABCIApplicationClient interface { ExtendVote(ctx context.Context, in *RequestExtendVote, opts ...grpc.CallOption) (*ResponseExtendVote, error) VerifyVoteExtension(ctx context.Context, in *RequestVerifyVoteExtension, opts ...grpc.CallOption) (*ResponseVerifyVoteExtension, error) FinalizeBlock(ctx context.Context, in *RequestFinalizeBlock, opts ...grpc.CallOption) (*ResponseFinalizeBlock, error) + ApplyBlockRandomness(ctx context.Context, in *RequestApplyBlockRandomness, opts ...grpc.CallOption) (*ResponseApplyBlockRandomness, error) } type aBCIApplicationClient struct { @@ -4853,6 +5050,15 @@ func (c *aBCIApplicationClient) FinalizeBlock(ctx context.Context, in *RequestFi return out, nil } +func (c *aBCIApplicationClient) ApplyBlockRandomness(ctx context.Context, in *RequestApplyBlockRandomness, opts ...grpc.CallOption) (*ResponseApplyBlockRandomness, error) { + out := new(ResponseApplyBlockRandomness) + err := c.cc.Invoke(ctx, "/tendermint.abci.ABCIApplication/ApplyBlockRandomness", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ABCIApplicationServer is the server API for ABCIApplication service. type ABCIApplicationServer interface { // Echo a string to test an abci client/server implementation @@ -4871,6 +5077,7 @@ type ABCIApplicationServer interface { ExtendVote(context.Context, *RequestExtendVote) (*ResponseExtendVote, error) VerifyVoteExtension(context.Context, *RequestVerifyVoteExtension) (*ResponseVerifyVoteExtension, error) FinalizeBlock(context.Context, *RequestFinalizeBlock) (*ResponseFinalizeBlock, error) + ApplyBlockRandomness(context.Context, *RequestApplyBlockRandomness) (*ResponseApplyBlockRandomness, error) } // UnimplementedABCIApplicationServer can be embedded to have forward compatible implementations. @@ -4922,6 +5129,9 @@ func (*UnimplementedABCIApplicationServer) VerifyVoteExtension(ctx context.Conte func (*UnimplementedABCIApplicationServer) FinalizeBlock(ctx context.Context, req *RequestFinalizeBlock) (*ResponseFinalizeBlock, error) { return nil, status.Errorf(codes.Unimplemented, "method FinalizeBlock not implemented") } +func (*UnimplementedABCIApplicationServer) ApplyBlockRandomness(ctx context.Context, req *RequestApplyBlockRandomness) (*ResponseApplyBlockRandomness, error) { + return nil, status.Errorf(codes.Unimplemented, "method ApplyBlockRandomness not implemented") +} func RegisterABCIApplicationServer(s grpc1.Server, srv ABCIApplicationServer) { s.RegisterService(&_ABCIApplication_serviceDesc, srv) @@ -5197,6 +5407,24 @@ func _ABCIApplication_FinalizeBlock_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } +func _ABCIApplication_ApplyBlockRandomness_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RequestApplyBlockRandomness) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABCIApplicationServer).ApplyBlockRandomness(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tendermint.abci.ABCIApplication/ApplyBlockRandomness", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABCIApplicationServer).ApplyBlockRandomness(ctx, req.(*RequestApplyBlockRandomness)) + } + return interceptor(ctx, in, info, handler) +} + var ABCIApplication_serviceDesc = _ABCIApplication_serviceDesc var _ABCIApplication_serviceDesc = grpc.ServiceDesc{ ServiceName: "tendermint.abci.ABCIApplication", @@ -5262,6 +5490,10 @@ var _ABCIApplication_serviceDesc = grpc.ServiceDesc{ MethodName: "FinalizeBlock", Handler: _ABCIApplication_FinalizeBlock_Handler, }, + { + MethodName: "ApplyBlockRandomness", + Handler: _ABCIApplication_ApplyBlockRandomness_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "tendermint/abci/types.proto", @@ -5670,6 +5902,32 @@ func (m *Request_FinalizeBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { } return len(dAtA) - i, nil } +func (m *Request_ApplyBlockRandomness) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Request_ApplyBlockRandomness) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + if m.ApplyBlockRandomness != nil { + { + size, err := m.ApplyBlockRandomness.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xa2 + } + return len(dAtA) - i, nil +} func (m *RequestEcho) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -5850,12 +6108,12 @@ func (m *RequestInitChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - n18, err18 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) - if err18 != nil { - return 0, err18 + n19, err19 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) + if err19 != nil { + return 0, err19 } - i -= n18 - i = encodeVarintTypes(dAtA, i, uint64(n18)) + i -= n19 + i = encodeVarintTypes(dAtA, i, uint64(n19)) i-- dAtA[i] = 0xa return len(dAtA) - i, nil @@ -6186,12 +6444,12 @@ func (m *RequestPrepareProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x3a } - n21, err21 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) - if err21 != nil { - return 0, err21 + n22, err22 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) + if err22 != nil { + return 0, err22 } - i -= n21 - i = encodeVarintTypes(dAtA, i, uint64(n21)) + i -= n22 + i = encodeVarintTypes(dAtA, i, uint64(n22)) i-- dAtA[i] = 0x32 if m.Height != 0 { @@ -6318,12 +6576,12 @@ func (m *RequestProcessProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x42 } - n25, err25 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) - if err25 != nil { - return 0, err25 + n26, err26 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) + if err26 != nil { + return 0, err26 } - i -= n25 - i = encodeVarintTypes(dAtA, i, uint64(n25)) + i -= n26 + i = encodeVarintTypes(dAtA, i, uint64(n26)) i-- dAtA[i] = 0x3a if m.Round != 0 { @@ -6577,6 +6835,56 @@ func (m *RequestFinalizeBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *RequestApplyBlockRandomness) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RequestApplyBlockRandomness) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestApplyBlockRandomness) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Beacon) > 0 { + i -= len(m.Beacon) + copy(dAtA[i:], m.Beacon) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Beacon))) + i-- + dAtA[i] = 0x22 + } + if m.Round != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Round)) + i-- + dAtA[i] = 0x18 + } + if m.Height != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x10 + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *Response) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -6998,10 +7306,36 @@ func (m *Response_FinalizeBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) } return len(dAtA) - i, nil } -func (m *ResponseException) Marshal() (dAtA []byte, err error) { +func (m *Response_ApplyBlockRandomness) MarshalTo(dAtA []byte) (int, error) { size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Response_ApplyBlockRandomness) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + if m.ApplyBlockRandomness != nil { + { + size, err := m.ApplyBlockRandomness.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x8a + } + return len(dAtA) - i, nil +} +func (m *ResponseException) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7239,12 +7573,12 @@ func (m *ResponseInitChain_GenesisTime) MarshalToSizedBuffer(dAtA []byte) (int, } i := len(dAtA) if m.GenesisTime != nil { - n49, err49 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.GenesisTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.GenesisTime):]) - if err49 != nil { - return 0, err49 + n51, err51 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.GenesisTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.GenesisTime):]) + if err51 != nil { + return 0, err51 } - i -= n49 - i = encodeVarintTypes(dAtA, i, uint64(n49)) + i -= n51 + i = encodeVarintTypes(dAtA, i, uint64(n51)) i-- dAtA[i] = 0x32 } @@ -7939,6 +8273,39 @@ func (m *ResponseFinalizeBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ResponseApplyBlockRandomness) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResponseApplyBlockRandomness) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseApplyBlockRandomness) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AppHash) > 0 { + i -= len(m.AppHash) + copy(dAtA[i:], m.AppHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.AppHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *CommitInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -7962,6 +8329,20 @@ func (m *CommitInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.AppHash) > 0 { + i -= len(m.AppHash) + copy(dAtA[i:], m.AppHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.AppHash))) + i-- + dAtA[i] = 0x32 + } + if len(m.Beacon) > 0 { + i -= len(m.Beacon) + copy(dAtA[i:], m.Beacon) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Beacon))) + i-- + dAtA[i] = 0x2a + } if len(m.ThresholdVoteExtensions) > 0 { for iNdEx := len(m.ThresholdVoteExtensions) - 1; iNdEx >= 0; iNdEx-- { { @@ -8612,12 +8993,12 @@ func (m *Misbehavior) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x28 } - n62, err62 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) - if err62 != nil { - return 0, err62 + n64, err64 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) + if err64 != nil { + return 0, err64 } - i -= n62 - i = encodeVarintTypes(dAtA, i, uint64(n62)) + i -= n64 + i = encodeVarintTypes(dAtA, i, uint64(n64)) i-- dAtA[i] = 0x22 if m.Height != 0 { @@ -8896,6 +9277,18 @@ func (m *Request_FinalizeBlock) Size() (n int) { } return n } +func (m *Request_ApplyBlockRandomness) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ApplyBlockRandomness != nil { + l = m.ApplyBlockRandomness.Size() + n += 2 + l + sovTypes(uint64(l)) + } + return n +} func (m *RequestEcho) Size() (n int) { if m == nil { return 0 @@ -9279,6 +9672,29 @@ func (m *RequestFinalizeBlock) Size() (n int) { return n } +func (m *RequestApplyBlockRandomness) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovTypes(uint64(m.Height)) + } + if m.Round != 0 { + n += 1 + sovTypes(uint64(m.Round)) + } + l = len(m.Beacon) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + func (m *Response) Size() (n int) { if m == nil { return 0 @@ -9483,6 +9899,18 @@ func (m *Response_FinalizeBlock) Size() (n int) { } return n } +func (m *Response_ApplyBlockRandomness) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ApplyBlockRandomness != nil { + l = m.ApplyBlockRandomness.Size() + n += 2 + l + sovTypes(uint64(l)) + } + return n +} func (m *ResponseException) Size() (n int) { if m == nil { return 0 @@ -9881,6 +10309,19 @@ func (m *ResponseFinalizeBlock) Size() (n int) { return n } +func (m *ResponseApplyBlockRandomness) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AppHash) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + func (m *CommitInfo) Size() (n int) { if m == nil { return 0 @@ -9904,6 +10345,14 @@ func (m *CommitInfo) Size() (n int) { n += 1 + l + sovTypes(uint64(l)) } } + l = len(m.Beacon) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.AppHash) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } return n } @@ -10742,6 +11191,41 @@ func (m *Request) Unmarshal(dAtA []byte) error { } m.Value = &Request_FinalizeBlock{v} iNdEx = postIndex + case 20: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ApplyBlockRandomness", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &RequestApplyBlockRandomness{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &Request_ApplyBlockRandomness{v} + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) @@ -13460,6 +13944,162 @@ func (m *RequestFinalizeBlock) Unmarshal(dAtA []byte) error { } return nil } +func (m *RequestApplyBlockRandomness) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RequestApplyBlockRandomness: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RequestApplyBlockRandomness: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Round", wireType) + } + m.Round = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Round |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Beacon", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Beacon = append(m.Beacon[:0], dAtA[iNdEx:postIndex]...) + if m.Beacon == nil { + m.Beacon = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Response) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -14049,6 +14689,41 @@ func (m *Response) Unmarshal(dAtA []byte) error { } m.Value = &Response_FinalizeBlock{v} iNdEx = postIndex + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ApplyBlockRandomness", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &ResponseApplyBlockRandomness{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &Response_ApplyBlockRandomness{v} + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) @@ -16559,6 +17234,90 @@ func (m *ResponseFinalizeBlock) Unmarshal(dAtA []byte) error { } return nil } +func (m *ResponseApplyBlockRandomness) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResponseApplyBlockRandomness: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResponseApplyBlockRandomness: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AppHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AppHash = append(m.AppHash[:0], dAtA[iNdEx:postIndex]...) + if m.AppHash == nil { + m.AppHash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *CommitInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -16709,6 +17468,74 @@ func (m *CommitInfo) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Beacon", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Beacon = append(m.Beacon[:0], dAtA[iNdEx:postIndex]...) + if m.Beacon == nil { + m.Beacon = []byte{} + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AppHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AppHash = append(m.AppHash[:0], dAtA[iNdEx:postIndex]...) + if m.AppHash == nil { + m.AppHash = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) diff --git a/abci/types/types_test.go b/abci/types/types_test.go index ca178c8e23..8d3e846f00 100644 --- a/abci/types/types_test.go +++ b/abci/types/types_test.go @@ -1,6 +1,7 @@ package types_test import ( + "context" "encoding/json" "testing" @@ -130,3 +131,11 @@ func TestVoteExtensionDoesNotSharetheApplicationsBytes(t *testing.T) { require.Equal(t, []byte("returned by the application"), converted.Extension) require.Equal(t, []byte("also returned by the application"), converted.GetSignRequestId()) } + +// TestBaseApplicationApplyBlockRandomness checks that the base application refuses ApplyBlockRandomness: +// an empty app hash must never pass as an answer. +func TestBaseApplicationApplyBlockRandomness(t *testing.T) { + resp, err := abci.NewBaseApplication().ApplyBlockRandomness(context.Background(), &abci.RequestApplyBlockRandomness{}) + require.ErrorIs(t, err, abci.ErrApplyBlockRandomnessNotImplemented) + require.Nil(t, resp) +} diff --git a/internal/proxy/client.go b/internal/proxy/client.go index 9421d6b8ea..cb83c412dc 100644 --- a/internal/proxy/client.go +++ b/internal/proxy/client.go @@ -167,6 +167,11 @@ func (app *proxyClient) FinalizeBlock(ctx context.Context, req *types.RequestFin return app.client.FinalizeBlock(ctx, req) } +func (app *proxyClient) ApplyBlockRandomness(ctx context.Context, req *types.RequestApplyBlockRandomness) (r *types.ResponseApplyBlockRandomness, err error) { + defer addTimeSample(app.metrics.MethodTiming.With("method", "apply_block_randomness", "type", "sync"))(&err) + return app.client.ApplyBlockRandomness(ctx, req) +} + func (app *proxyClient) Flush(ctx context.Context) (err error) { defer addTimeSample(app.metrics.MethodTiming.With("method", "flush", "type", "sync"))(&err) return app.client.Flush(ctx) diff --git a/internal/state/tx_filter_test.go b/internal/state/tx_filter_test.go index 3456fed3b1..ef1e833f09 100644 --- a/internal/state/tx_filter_test.go +++ b/internal/state/tx_filter_test.go @@ -15,7 +15,7 @@ import ( func TestTxFilter(t *testing.T) { const maxBlockBytes = 3241 - maxTxSize := maxBlockBytes - 1132 + maxTxSize := maxBlockBytes - 1264 genDoc := factory.MinimalGenesisDoc() genDoc.ConsensusParams.Block.MaxBytes = maxBlockBytes genDoc.ConsensusParams.Evidence.MaxBytes = 1500 diff --git a/node/node_test.go b/node/node_test.go index 849bc6ee84..ce33a25126 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -850,6 +850,8 @@ func TestMaxProposalBlockSize(t *testing.T) { BlockID: blockID, QuorumHash: crypto.RandQuorumHash(), ThresholdBlockSignature: crypto.CRandBytes(bls12381.SignatureSize), + Beacon: crypto.CRandBytes(bls12381.SignatureSize), + AppHash: crypto.Checksum([]byte("final_app_hash")), } block, _, err := blockExec.CreateProposalBlock( @@ -875,7 +877,7 @@ func TestMaxProposalBlockSize(t *testing.T) { require.Equal(t, types.MaxHeaderBytes, int64(pb.Header.Size())) require.Equal(t, types.MaxCommitOverheadBytes, int64(pb.LastCommit.Size())) // make sure that the block is less than the max possible size - assert.Equal(t, int64(1116+cfg.Mempool.MaxTxBytes), int64(pb.Size())) + assert.Equal(t, int64(1248+cfg.Mempool.MaxTxBytes), int64(pb.Size())) // because of the proto overhead we expect the part set bytes to be equal or // less than the pb block size assert.LessOrEqual(t, partSet.ByteSize(), int64(pb.Size())) diff --git a/proto/tendermint/abci/types.proto b/proto/tendermint/abci/types.proto index 155086841a..780dfabb47 100644 --- a/proto/tendermint/abci/types.proto +++ b/proto/tendermint/abci/types.proto @@ -22,21 +22,22 @@ import "gogoproto/gogo.proto"; // Request types message Request { oneof value { - RequestEcho echo = 1; - RequestFlush flush = 2; - RequestInfo info = 3; - RequestInitChain init_chain = 4; - RequestQuery query = 5; - RequestCheckTx check_tx = 7; - RequestListSnapshots list_snapshots = 11; - RequestOfferSnapshot offer_snapshot = 12; - RequestLoadSnapshotChunk load_snapshot_chunk = 13; - RequestApplySnapshotChunk apply_snapshot_chunk = 14; - RequestPrepareProposal prepare_proposal = 15; - RequestProcessProposal process_proposal = 16; - RequestExtendVote extend_vote = 17; - RequestVerifyVoteExtension verify_vote_extension = 18; - RequestFinalizeBlock finalize_block = 19; + RequestEcho echo = 1; + RequestFlush flush = 2; + RequestInfo info = 3; + RequestInitChain init_chain = 4; + RequestQuery query = 5; + RequestCheckTx check_tx = 7; + RequestListSnapshots list_snapshots = 11; + RequestOfferSnapshot offer_snapshot = 12; + RequestLoadSnapshotChunk load_snapshot_chunk = 13; + RequestApplySnapshotChunk apply_snapshot_chunk = 14; + RequestPrepareProposal prepare_proposal = 15; + RequestProcessProposal process_proposal = 16; + RequestExtendVote extend_vote = 17; + RequestVerifyVoteExtension verify_vote_extension = 18; + RequestFinalizeBlock finalize_block = 19; + RequestApplyBlockRandomness apply_block_randomness = 20; } reserved 6, 8, 9, 10; // RequestBeginBlock, RequestDeliverTx, RequestEndBlock, RequestCommit } @@ -559,27 +560,62 @@ message RequestFinalizeBlock { tendermint.types.BlockID block_id = 7 [(gogoproto.customname) = "BlockID"]; } +// Applies the block's randomness and returns the app hash the Precommit signs. +// +// #### Usage +// +// - Used from consensus version 2 (`VersionParams.consensus_version`). Before that, Tenderdash never calls it. +// - `RequestApplyBlockRandomness.beacon` is the random beacon of the block and round: the 96-byte BLS threshold +// signature recovered from the Prevotes of round `round` for the block `hash`. Tenderdash has verified it against +// the quorum's threshold public key before the call. +// - The Application applies the randomness to the state that `ProcessProposal` (or `PrepareProposal`) left for +// that block and round, and returns the resulting Merkle root hash in `ResponseApplyBlockRandomness.app_hash`. +// When nothing in the block uses randomness, `app_hash` equals the app hash of the block header. +// - The header keeps the app hash from `ProcessProposal`, which Prevotes sign. Precommits and the commit sign +// `ResponseApplyBlockRandomness.app_hash`, and the commit carries it in `Commit.app_hash`. +// - The implementation MUST be deterministic: every process that applies the same beacon to the same block +// and round MUST return the same `app_hash`. +// - Tenderdash may call it more than once for the same block, round and beacon; the Application MUST return +// the same `app_hash` each time. +// - An ABCI error is fatal, as for `ExtendVote`. +// +// #### When does Tenderdash call it? +// +// - On a validator, once the Prevotes of round _r_ for block _v_ reach the threshold and their signature is +// recovered, before `ExtendVote` and before signing its Precommit for _v_. +// - On every path that finalizes a block from a commit it did not assemble itself (block sync, replay, a +// node that did not vote): after `ProcessProposal` of the committed block for the commit round, with the +// commit's beacon, and before `FinalizeBlock`. Tenderdash compares the returned `app_hash` with +// `Commit.app_hash` and stops on a mismatch. +message RequestApplyBlockRandomness { + bytes hash = 1; // The header hash of the block the Prevotes are for. + int64 height = 2; // Height of the block. + int32 round = 3; // Round whose Prevotes produced the beacon. + bytes beacon = 4; // 96-byte BLS threshold signature recovered from those Prevotes. +} + //---------------------------------------- // Response types message Response { oneof value { - ResponseException exception = 1; - ResponseEcho echo = 2; - ResponseFlush flush = 3; - ResponseInfo info = 4; - ResponseInitChain init_chain = 5; - ResponseQuery query = 6; - ResponseCheckTx check_tx = 7; - ResponseListSnapshots list_snapshots = 8; - ResponseOfferSnapshot offer_snapshot = 9; - ResponseLoadSnapshotChunk load_snapshot_chunk = 10; - ResponseApplySnapshotChunk apply_snapshot_chunk = 11; - ResponsePrepareProposal prepare_proposal = 12; - ResponseProcessProposal process_proposal = 13; - ResponseExtendVote extend_vote = 14; - ResponseVerifyVoteExtension verify_vote_extension = 15; - ResponseFinalizeBlock finalize_block = 16; + ResponseException exception = 1; + ResponseEcho echo = 2; + ResponseFlush flush = 3; + ResponseInfo info = 4; + ResponseInitChain init_chain = 5; + ResponseQuery query = 6; + ResponseCheckTx check_tx = 7; + ResponseListSnapshots list_snapshots = 8; + ResponseOfferSnapshot offer_snapshot = 9; + ResponseLoadSnapshotChunk load_snapshot_chunk = 10; + ResponseApplySnapshotChunk apply_snapshot_chunk = 11; + ResponsePrepareProposal prepare_proposal = 12; + ResponseProcessProposal process_proposal = 13; + ResponseExtendVote extend_vote = 14; + ResponseVerifyVoteExtension verify_vote_extension = 15; + ResponseFinalizeBlock finalize_block = 16; + ResponseApplyBlockRandomness apply_block_randomness = 17; } } @@ -783,6 +819,12 @@ message ResponseFinalizeBlock { bool propose_next_block_immediately = 3; } +message ResponseApplyBlockRandomness { + // The Merkle root hash of the application state after the randomness is applied. 32 bytes. + // Equals the header app hash when nothing in the block uses randomness. + bytes app_hash = 1; +} + //---------------------------------------- // Misc. @@ -791,6 +833,12 @@ message CommitInfo { bytes quorum_hash = 2; bytes block_signature = 3; repeated tendermint.types.VoteExtension threshold_vote_extensions = 4; + // Random beacon of the committed block: the threshold signature recovered from the prevotes of + // the commit round. Set from consensus version 2; empty before. + bytes beacon = 5; + // App hash the commit signs: the result of `ApplyBlockRandomness` for the committed block and + // round. Set from consensus version 2; empty before. + bytes app_hash = 6; } // Event allows application developers to attach additional information to @@ -963,4 +1011,5 @@ service ABCIApplication { rpc ExtendVote(RequestExtendVote) returns (ResponseExtendVote); rpc VerifyVoteExtension(RequestVerifyVoteExtension) returns (ResponseVerifyVoteExtension); rpc FinalizeBlock(RequestFinalizeBlock) returns (ResponseFinalizeBlock); + rpc ApplyBlockRandomness(RequestApplyBlockRandomness) returns (ResponseApplyBlockRandomness); } diff --git a/proto/tendermint/types/types.pb.go b/proto/tendermint/types/types.pb.go index 6c695234d0..cbe25466a6 100644 --- a/proto/tendermint/types/types.pb.go +++ b/proto/tendermint/types/types.pb.go @@ -692,6 +692,12 @@ type Commit struct { QuorumHash []byte `protobuf:"bytes,4,opt,name=quorum_hash,json=quorumHash,proto3" json:"quorum_hash,omitempty"` ThresholdBlockSignature []byte `protobuf:"bytes,5,opt,name=threshold_block_signature,json=thresholdBlockSignature,proto3" json:"threshold_block_signature,omitempty"` ThresholdVoteExtensions []*VoteExtension `protobuf:"bytes,6,rep,name=threshold_vote_extensions,json=thresholdVoteExtensions,proto3" json:"threshold_vote_extensions,omitempty"` + // Random beacon: the threshold signature recovered from the prevotes of the commit round. + // Set from consensus version 2; empty before. + Beacon []byte `protobuf:"bytes,7,opt,name=beacon,proto3" json:"beacon,omitempty"` + // App hash the precommits sign, returned by ApplyBlockRandomness for this block and round. + // Set from consensus version 2; empty before. + AppHash []byte `protobuf:"bytes,8,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` } func (m *Commit) Reset() { *m = Commit{} } @@ -769,6 +775,20 @@ func (m *Commit) GetThresholdVoteExtensions() []*VoteExtension { return nil } +func (m *Commit) GetBeacon() []byte { + if m != nil { + return m.Beacon + } + return nil +} + +func (m *Commit) GetAppHash() []byte { + if m != nil { + return m.AppHash + } + return nil +} + type Proposal struct { Type SignedMsgType `protobuf:"varint,1,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` @@ -1150,106 +1170,107 @@ func init() { func init() { proto.RegisterFile("tendermint/types/types.proto", fileDescriptor_d3a6e55e2345de56) } var fileDescriptor_d3a6e55e2345de56 = []byte{ - // 1569 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4b, 0x73, 0x1b, 0xc5, - 0x16, 0xd6, 0x58, 0xef, 0xd6, 0xc3, 0xf2, 0xc4, 0x4e, 0x64, 0x25, 0x91, 0xe6, 0xea, 0xd6, 0xbd, - 0x18, 0x0a, 0xa4, 0x90, 0xa4, 0x78, 0xa4, 0x8a, 0x85, 0x25, 0x3b, 0xb1, 0x2a, 0xb6, 0xac, 0x1a, - 0x29, 0xa6, 0x80, 0xc5, 0xd4, 0x58, 0xd3, 0x91, 0x44, 0xa4, 0xe9, 0x61, 0xa6, 0x65, 0xe4, 0xac, - 0xd8, 0x91, 0xf2, 0x2a, 0x0b, 0x8a, 0xca, 0xc6, 0x55, 0xa4, 0x60, 0xc1, 0x3f, 0x60, 0xcf, 0x2a, - 0xcb, 0xec, 0x60, 0x41, 0x19, 0xca, 0xf9, 0x0b, 0xac, 0x81, 0xea, 0xd3, 0x3d, 0xa3, 0xd1, 0xc3, - 0x26, 0x64, 0xc1, 0x46, 0x35, 0x7d, 0xce, 0x77, 0xba, 0xcf, 0xf9, 0xfa, 0x3b, 0xdd, 0x2d, 0x74, - 0x85, 0x62, 0xd3, 0xc0, 0xf6, 0xa0, 0x67, 0xd2, 0x32, 0x3d, 0xb4, 0xb0, 0xc3, 0x7f, 0x4b, 0x96, - 0x4d, 0x28, 0x91, 0x33, 0x63, 0x6f, 0x09, 0xec, 0xb9, 0xe5, 0x0e, 0xe9, 0x10, 0x70, 0x96, 0xd9, - 0x17, 0xc7, 0xe5, 0x0a, 0x1d, 0x42, 0x3a, 0x7d, 0x5c, 0x86, 0xd1, 0xfe, 0xf0, 0x7e, 0x99, 0xf6, - 0x06, 0xd8, 0xa1, 0xfa, 0xc0, 0x12, 0x80, 0xab, 0xbe, 0x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 0xc4, 0x79, 0xad, 0x90, 0x18, 0x23, 0x1a, - 0x9c, 0x35, 0xc3, 0xc7, 0x15, 0x63, 0x24, 0xe8, 0x71, 0xf5, 0x9e, 0xc8, 0x37, 0x04, 0x6b, 0xe7, - 0x4a, 0xbc, 0xd5, 0x4a, 0x6e, 0xab, 0x95, 0x5a, 0x6e, 0xab, 0x55, 0x62, 0x6c, 0xe1, 0xc7, 0xbf, - 0x16, 0x24, 0x5e, 0x95, 0x5c, 0x45, 0xa9, 0xbe, 0xee, 0x50, 0x6d, 0x9f, 0x11, 0xc7, 0x96, 0x0f, - 0xc3, 0x14, 0xab, 0xb3, 0x7a, 0x11, 0xba, 0x13, 0xa9, 0x27, 0x58, 0x14, 0x37, 0x19, 0xf2, 0x1a, - 0xca, 0xc0, 0x24, 0x6d, 0x32, 0x18, 0xf4, 0x28, 0xdf, 0xb2, 0x08, 0xc8, 0x32, 0xcd, 0xec, 0x55, - 0x30, 0xc3, 0x66, 0x5d, 0x46, 0x71, 0x43, 0xa7, 0x3a, 0x87, 0x44, 0x01, 0x12, 0x63, 0x06, 0x70, - 0xbe, 0x86, 0x16, 0xbd, 0xae, 0x74, 0x38, 0x24, 0xc6, 0x67, 0x19, 0x9b, 0x01, 0x78, 0x0d, 0x2d, - 0x9b, 0x78, 0x44, 0xb5, 0x69, 0x74, 0x1c, 0xd0, 0x32, 0xf3, 0xed, 0x4d, 0x46, 0xfc, 0x0f, 0xa5, - 0xdb, 0x2e, 0xf9, 0x1c, 0x8b, 0x00, 0x9b, 0xf2, 0xac, 0x00, 0x2b, 0xa1, 0x0b, 0x30, 0xf1, 0x14, - 0x36, 0x01, 0xd8, 0x25, 0xe6, 0xaa, 0x4e, 0xe0, 0x57, 0x7d, 0x1a, 0x4d, 0x02, 0xc8, 0x93, 0xe5, - 0x7f, 0x50, 0xd2, 0xc6, 0xce, 0xb0, 0x4f, 0xc5, 0x1c, 0x29, 0x70, 0x27, 0x84, 0x0d, 0x20, 0xff, - 0x45, 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 0x6b, 0x33, 0x23, 0x71, 0x74, 0xc3, - 0xc6, 0xec, 0x58, 0x07, 0xf4, 0x35, 0xb4, 0x3a, 0x07, 0xed, 0x15, 0xb6, 0x74, 0x74, 0xac, 0xa4, - 0x1a, 0x36, 0xe6, 0x4d, 0x08, 0x11, 0x25, 0x94, 0x9d, 0x8d, 0xd8, 0x6d, 0xec, 0x36, 0xd7, 0xb7, - 0x33, 0x4a, 0x2e, 0x73, 0x74, 0xac, 0x24, 0xdd, 0x03, 0x9e, 0xe1, 0xc7, 0x95, 0x55, 0xea, 0xcf, - 0x4e, 0xf3, 0xd2, 0xf3, 0xd3, 0xbc, 0xf4, 0xdb, 0x69, 0x5e, 0x7a, 0xfc, 0x22, 0x1f, 0x78, 0xfe, - 0x22, 0x1f, 0xf8, 0xf9, 0x45, 0x3e, 0xf0, 0xf1, 0xcd, 0x4e, 0x8f, 0x76, 0x87, 0xfb, 0xa5, 0x36, - 0x19, 0xc0, 0x1f, 0x4b, 0x4b, 0x3f, 0x2c, 0x73, 0x01, 0xb0, 0x11, 0xff, 0x57, 0x5b, 0x9e, 0xfe, - 0x97, 0xb9, 0x1f, 0x01, 0xfb, 0x8d, 0xbf, 0x06, 0x00, 0xa8, 0xd9, 0x50, 0xe6, 0x43, 0x0f, 0x00, - 0x00, + // 1587 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xbd, 0x6f, 0x1b, 0xc9, + 0x15, 0xe7, 0x8a, 0xdf, 0xc3, 0x0f, 0x51, 0x6b, 0xc9, 0xa6, 0x68, 0x9b, 0xdc, 0x30, 0x48, 0xa2, + 0x04, 0x09, 0xe9, 0xd8, 0x46, 0x3e, 0x0c, 0xa4, 0x10, 0x29, 0xd9, 0x22, 0x2c, 0x51, 0xc4, 0x92, + 0x56, 0x90, 0xa4, 0x58, 0x2c, 0xb9, 0x63, 0x92, 0x31, 0xb9, 0xb3,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3, 0xcf, 0x2a, 0xab, + 0x35, 0xdf, 0x5c, 0x14, 0xa5, 0xb7, 0x17, 0x45, 0xe9, 0xcb, 0x8b, 0xa2, 0xf4, 0xf2, 0x5d, 0x31, + 0xf4, 0xf6, 0x5d, 0x31, 0xf4, 0xd9, 0xbb, 0x62, 0xe8, 0xaf, 0xf7, 0xfb, 0x43, 0x3a, 0x98, 0x74, + 0x2b, 0x3d, 0x32, 0x86, 0xff, 0xa2, 0x96, 0x7e, 0x52, 0xe5, 0x02, 0x60, 0x23, 0xfe, 0x47, 0xb8, + 0x3a, 0xff, 0xc7, 0xb4, 0x1b, 0x03, 0xfb, 0xbd, 0xef, 0x06, 0x00, 0xe4, 0x67, 0x15, 0x21, 0x76, + 0x0f, 0x00, 0x00, } func (m *PartSetHeader) Marshal() (dAtA []byte, err error) { @@ -1737,6 +1758,20 @@ func (m *Commit) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.AppHash) > 0 { + i -= len(m.AppHash) + copy(dAtA[i:], m.AppHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.AppHash))) + i-- + dAtA[i] = 0x42 + } + if len(m.Beacon) > 0 { + i -= len(m.Beacon) + copy(dAtA[i:], m.Beacon) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Beacon))) + i-- + dAtA[i] = 0x3a + } if len(m.ThresholdVoteExtensions) > 0 { for iNdEx := len(m.ThresholdVoteExtensions) - 1; iNdEx >= 0; iNdEx-- { { @@ -2336,6 +2371,14 @@ func (m *Commit) Size() (n int) { n += 1 + l + sovTypes(uint64(l)) } } + l = len(m.Beacon) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.AppHash) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } return n } @@ -4098,6 +4141,74 @@ func (m *Commit) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Beacon", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Beacon = append(m.Beacon[:0], dAtA[iNdEx:postIndex]...) + if m.Beacon == nil { + m.Beacon = []byte{} + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AppHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AppHash = append(m.AppHash[:0], dAtA[iNdEx:postIndex]...) + if m.AppHash == nil { + m.AppHash = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) diff --git a/proto/tendermint/types/types.proto b/proto/tendermint/types/types.proto index ea64fa29dc..bc27a6505e 100644 --- a/proto/tendermint/types/types.proto +++ b/proto/tendermint/types/types.proto @@ -156,6 +156,12 @@ message Commit { bytes quorum_hash = 4; bytes threshold_block_signature = 5; repeated VoteExtension threshold_vote_extensions = 6; + // Random beacon: the threshold signature recovered from the prevotes of the commit round. + // Set from consensus version 2; empty before. + bytes beacon = 7; + // App hash the precommits sign, returned by ApplyBlockRandomness for this block and round. + // Set from consensus version 2; empty before. + bytes app_hash = 8; } message Proposal { diff --git a/spec/abci++/abci++_methods.md b/spec/abci++/abci++_methods.md index acd7343f5e..570dc4888a 100644 --- a/spec/abci++/abci++_methods.md +++ b/spec/abci++/abci++_methods.md @@ -582,6 +582,48 @@ Whenever a process is about to save a block and its commit, in consensus, block first calls `RequestVerifyVoteExtension` for the commit, once `ProcessProposal` has processed the block. This includes commits the process assembled from its own +2/3 precommits. +### ApplyBlockRandomness + +#### Parameters and Types + +* **Request**: + + | Name | Type | Description | Field Number | + |--------|-------|--------------------------------------------------------------------------|--------------| + | hash | bytes | The header hash of the block the Prevotes are for. | 1 | + | height | int64 | Height of the block. | 2 | + | round | int32 | Round whose Prevotes produced the beacon. | 3 | + | beacon | bytes | 96-byte BLS threshold signature recovered from the Prevotes of `round`. | 4 | + +* **Response**: + + | Name | Type | Description | Field Number | + |----------|-------|----------------------------------------------------------------------------|--------------| + | app_hash | bytes | App hash after the randomness is applied; the hash the Precommits sign. | 1 | + +* **Usage**: + * Used from consensus version 2 (`VersionParams.consensus_version`). Before that, Tenderdash never calls it. + * The beacon is the BLS threshold signature recovered from the Prevotes of round `round` for block `hash`. + Every set of threshold shares recovers the same bytes, and nobody can compute them before the Prevotes exist. + Tenderdash verifies the beacon against the quorum's threshold public key before the call. + * The Application applies the randomness to the state that `ProcessProposal` (or `PrepareProposal`) left for + that block and round, and returns the resulting app hash. When nothing in the block uses randomness, it + returns the header app hash. + * The header keeps the app hash from `ProcessProposal`, which Prevotes sign. Precommits and the commit sign the + returned app hash, and the commit carries it with the beacon (`Commit.app_hash`, `Commit.beacon`, and + `CommitInfo.app_hash`, `CommitInfo.beacon` in `RequestFinalizeBlock`). + * The implementation MUST be deterministic, and MUST return the same `app_hash` when called again for the same + block, round and beacon. + * An ABCI error is fatal, as for `ExtendVote`. + +#### When does Tenderdash call it? + +* On a validator, once the Prevotes of round _r_ for block _v_ reach the threshold and their signature is + recovered, before `ExtendVote` and before signing its Precommit for _v_. +* On every path that finalizes a block from a commit (block sync, replay, a node that did not vote): after + `ProcessProposal` of the committed block for the commit round, with the commit's beacon, and before + `FinalizeBlock`. Tenderdash compares the returned `app_hash` with the commit's and stops on a mismatch. + ### FinalizeBlock #### Parameters and Types @@ -806,12 +848,14 @@ enum VoteExtensionType { * **Fields**: - | Name | Type | Description | Field Number | - |----------------|-------|----------------------------------------------------------------------------------------------|--------------| - | round | int32 | Commit round. Reflects the round at which the block proposer decided in the previous height. | 1 | - | QuorumHash | bytes | Quorum hash of a current height. | 3 | - | BlockSignature | bytes | Block signature. | 4 | - | StateSignature | bytes | State signature. | 5 | + | Name | Type | Description | Field Number | + |---------------------------|------------------------------------------|----------------------------------------------------------------------------------------------|--------------| + | round | int32 | Commit round. Reflects the round at which the block proposer decided in the previous height. | 1 | + | quorum_hash | bytes | Quorum hash of a current height. | 2 | + | block_signature | bytes | Block signature. | 3 | + | threshold_vote_extensions | repeated [VoteExtension](#voteextension) | Threshold-recovered vote extensions of the commit. | 4 | + | beacon | bytes | Random beacon of the commit round. Set from consensus version 2; empty before. | 5 | + | app_hash | bytes | App hash the commit signs, returned by `ApplyBlockRandomness`. From consensus version 2. | 6 | ### ExtendedCommitInfo diff --git a/spec/abci++/api.md b/spec/abci++/api.md index 93099a33a3..1c7c30eed0 100644 --- a/spec/abci++/api.md +++ b/spec/abci++/api.md @@ -13,6 +13,7 @@ - [Misbehavior](#tendermint-abci-Misbehavior) - [QuorumHashUpdate](#tendermint-abci-QuorumHashUpdate) - [Request](#tendermint-abci-Request) + - [RequestApplyBlockRandomness](#tendermint-abci-RequestApplyBlockRandomness) - [RequestApplySnapshotChunk](#tendermint-abci-RequestApplySnapshotChunk) - [RequestCheckTx](#tendermint-abci-RequestCheckTx) - [RequestEcho](#tendermint-abci-RequestEcho) @@ -29,6 +30,7 @@ - [RequestQuery](#tendermint-abci-RequestQuery) - [RequestVerifyVoteExtension](#tendermint-abci-RequestVerifyVoteExtension) - [Response](#tendermint-abci-Response) + - [ResponseApplyBlockRandomness](#tendermint-abci-ResponseApplyBlockRandomness) - [ResponseApplySnapshotChunk](#tendermint-abci-ResponseApplySnapshotChunk) - [ResponseCheckTx](#tendermint-abci-ResponseCheckTx) - [ResponseEcho](#tendermint-abci-ResponseEcho) @@ -87,6 +89,8 @@ | quorum_hash | [bytes](#bytes) | | | | block_signature | [bytes](#bytes) | | | | threshold_vote_extensions | [tendermint.types.VoteExtension](#tendermint-types-VoteExtension) | repeated | | +| beacon | [bytes](#bytes) | | Random beacon of the committed block: the threshold signature recovered from the prevotes of the commit round. Set from consensus version 2; empty before. | +| app_hash | [bytes](#bytes) | | App hash the commit signs: the result of `ApplyBlockRandomness` for the committed block and round. Set from consensus version 2; empty before. | @@ -252,6 +256,51 @@ Request types | extend_vote | [RequestExtendVote](#tendermint-abci-RequestExtendVote) | | | | verify_vote_extension | [RequestVerifyVoteExtension](#tendermint-abci-RequestVerifyVoteExtension) | | | | finalize_block | [RequestFinalizeBlock](#tendermint-abci-RequestFinalizeBlock) | | | +| apply_block_randomness | [RequestApplyBlockRandomness](#tendermint-abci-RequestApplyBlockRandomness) | | | + + + + + + + + +### RequestApplyBlockRandomness +Applies the block's randomness and returns the app hash the Precommit signs. + +#### Usage + +- Used from consensus version 2 (`VersionParams.consensus_version`). Before that, Tenderdash never calls it. +- `RequestApplyBlockRandomness.beacon` is the random beacon of the block and round: the 96-byte BLS threshold + signature recovered from the Prevotes of round `round` for the block `hash`. Tenderdash has verified it against + the quorum's threshold public key before the call. +- The Application applies the randomness to the state that `ProcessProposal` (or `PrepareProposal`) left for + that block and round, and returns the resulting Merkle root hash in `ResponseApplyBlockRandomness.app_hash`. + When nothing in the block uses randomness, `app_hash` equals the app hash of the block header. +- The header keeps the app hash from `ProcessProposal`, which Prevotes sign. Precommits and the commit sign + `ResponseApplyBlockRandomness.app_hash`, and the commit carries it in `Commit.app_hash`. +- The implementation MUST be deterministic: every process that applies the same beacon to the same block + and round MUST return the same `app_hash`. +- Tenderdash may call it more than once for the same block, round and beacon; the Application MUST return + the same `app_hash` each time. +- An ABCI error is fatal, as for `ExtendVote`. + +#### When does Tenderdash call it? + +- On a validator, once the Prevotes of round _r_ for block _v_ reach the threshold and their signature is + recovered, before `ExtendVote` and before signing its Precommit for _v_. +- On every path that finalizes a block from a commit it did not assemble itself (block sync, replay, a + node that did not vote): after `ProcessProposal` of the committed block for the commit round, with the + commit's beacon, and before `FinalizeBlock`. Tenderdash compares the returned `app_hash` with + `Commit.app_hash` and stops on a mismatch. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| hash | [bytes](#bytes) | | The header hash of the block the Prevotes are for. | +| height | [int64](#int64) | | Height of the block. | +| round | [int32](#int32) | | Round whose Prevotes produced the beacon. | +| beacon | [bytes](#bytes) | | 96-byte BLS threshold signature recovered from those Prevotes. | @@ -874,6 +923,22 @@ block. This includes commits the process assembled from its own +2/3 precomm | extend_vote | [ResponseExtendVote](#tendermint-abci-ResponseExtendVote) | | | | verify_vote_extension | [ResponseVerifyVoteExtension](#tendermint-abci-ResponseVerifyVoteExtension) | | | | finalize_block | [ResponseFinalizeBlock](#tendermint-abci-ResponseFinalizeBlock) | | | +| apply_block_randomness | [ResponseApplyBlockRandomness](#tendermint-abci-ResponseApplyBlockRandomness) | | | + + + + + + + + +### ResponseApplyBlockRandomness + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| app_hash | [bytes](#bytes) | | The Merkle root hash of the application state after the randomness is applied. 32 bytes. Equals the header app hash when nothing in the block uses randomness. | @@ -1430,6 +1495,7 @@ TxAction contains App-provided information on what to do with a transaction that | ExtendVote | [RequestExtendVote](#tendermint-abci-RequestExtendVote) | [ResponseExtendVote](#tendermint-abci-ResponseExtendVote) | | | VerifyVoteExtension | [RequestVerifyVoteExtension](#tendermint-abci-RequestVerifyVoteExtension) | [ResponseVerifyVoteExtension](#tendermint-abci-ResponseVerifyVoteExtension) | | | FinalizeBlock | [RequestFinalizeBlock](#tendermint-abci-RequestFinalizeBlock) | [ResponseFinalizeBlock](#tendermint-abci-ResponseFinalizeBlock) | | +| ApplyBlockRandomness | [RequestApplyBlockRandomness](#tendermint-abci-RequestApplyBlockRandomness) | [ResponseApplyBlockRandomness](#tendermint-abci-ResponseApplyBlockRandomness) | | diff --git a/types/block.go b/types/block.go index 7d281e4cb5..f1f60cc895 100644 --- a/types/block.go +++ b/types/block.go @@ -745,8 +745,9 @@ const ( const ( // MaxCommitOverheadBytes is the max size of commit, with overhead but without vote extensions: // (110+2) for BlockID, (8+2) for Height, (4+2) for Round, - // (32+2) for QuorumHash, (96+2) for Block signature. - MaxCommitOverheadBytes int64 = (110 + 2) + (8 + 2) + (4 + 2) + (32 + 2) + (96 + 2) + 0 + // (32+2) for QuorumHash, (96+2) for Block signature, + // (96+2) for Beacon, (32+2) for AppHash. + MaxCommitOverheadBytes int64 = (110 + 2) + (8 + 2) + (4 + 2) + (32 + 2) + (96 + 2) + (96 + 2) + (32 + 2) + 0 ) //------------------------------------- @@ -765,6 +766,12 @@ type Commit struct { ThresholdBlockSignature []byte `json:"threshold_block_signature"` // ThresholdVoteExtensions keeps the list of recovered threshold signatures for vote-extensions ThresholdVoteExtensions tmproto.VoteExtensions `json:"threshold_vote_extensions"` + // Beacon is the threshold signature recovered from the prevotes of the commit round. + // Set from consensus version 2; empty before. + Beacon []byte `json:"beacon,omitempty"` + // AppHash is the app hash the precommits sign: the result of ApplyBlockRandomness for this + // block and round. Set from consensus version 2; empty before. + AppHash tmbytes.HexBytes `json:"app_hash,omitempty"` // Memoized in first call to corresponding method. // NOTE: can't memoize in constructor because constructor isn't used for @@ -797,6 +804,8 @@ func (commit *Commit) ToCommitInfo() types.CommitInfo { QuorumHash: commit.QuorumHash, BlockSignature: commit.ThresholdBlockSignature, ThresholdVoteExtensions: commit.ThresholdVoteExtensions, + Beacon: commit.Beacon, + AppHash: commit.AppHash, } } @@ -1005,6 +1014,8 @@ func (commit *Commit) ToProto() *tmproto.Commit { c.ThresholdBlockSignature = commit.ThresholdBlockSignature c.ThresholdVoteExtensions = commit.ThresholdVoteExtensions c.QuorumHash = commit.QuorumHash + c.Beacon = commit.Beacon + c.AppHash = commit.AppHash return c } @@ -1031,6 +1042,8 @@ func CommitFromProto(cp *tmproto.Commit) (*Commit, error) { commit.QuorumHash = cp.QuorumHash commit.ThresholdBlockSignature = cp.ThresholdBlockSignature commit.ThresholdVoteExtensions = cp.ThresholdVoteExtensions + commit.Beacon = cp.Beacon + commit.AppHash = cp.AppHash commit.Height = cp.Height commit.Round = cp.Round diff --git a/types/block_test.go b/types/block_test.go index a65a2f20a0..bcc384c082 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -314,6 +314,33 @@ func TestCommit(t *testing.T) { assert.True(t, commit.IsCommit()) } +// TestCommitBeaconFields checks that the beacon and the app hash of a commit survive the protobuf +// round trip and reach the CommitInfo passed to the application. +func TestCommitBeaconFields(t *testing.T) { + commit := &Commit{ + Height: 3, + Round: 1, + BlockID: BlockID{ + Hash: crypto.Checksum([]byte("block")), + PartSetHeader: PartSetHeader{Total: 1, Hash: crypto.Checksum([]byte("parts"))}, + StateID: RandStateID().Hash(), + }, + QuorumHash: crypto.RandQuorumHash(), + ThresholdBlockSignature: crypto.CRandBytes(SignatureSize), + Beacon: crypto.CRandBytes(SignatureSize), + AppHash: crypto.Checksum([]byte("final app hash")), + } + + decoded, err := CommitFromProto(commit.ToProto()) + require.NoError(t, err) + assert.Equal(t, commit.Beacon, decoded.Beacon) + assert.Equal(t, commit.AppHash, decoded.AppHash) + + info := commit.ToCommitInfo() + assert.Equal(t, commit.Beacon, info.Beacon) + assert.EqualValues(t, commit.AppHash, info.AppHash) +} + func TestCommitValidateBasic(t *testing.T) { const height int64 = 5 testCases := []struct { @@ -357,6 +384,8 @@ func TestMaxCommitBytes(t *testing.T) { }, QuorumHash: crypto.Checksum([]byte("QuorumHash")), ThresholdBlockSignature: crypto.CRandBytes(SignatureSize), + Beacon: crypto.CRandBytes(SignatureSize), + AppHash: crypto.Checksum([]byte("AppHash")), } bIDProto := commit.BlockID.ToProto() @@ -595,7 +624,7 @@ func TestBlockMaxDataBytes(t *testing.T) { func TestBlockMaxDataBytesNoEvidence(t *testing.T) { // minBlockSize is minimum correct size of a block - const minBlockSize = 1129 + const minBlockSize = 1261 testCases := []struct { maxBytes int64 From fec2860eae770a84e6cdefd241a32336f475e5c1 Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Wed, 4 Nov 2026 04:05:10 +0700 Subject: [PATCH 02/18] fix(types): refuse commits whose beacon or app hash has the wrong size Commit.beacon and Commit.app_hash are covered neither by the commit hash nor by its threshold signature, so a peer relaying a validly signed commit could fill them with any bytes. Before this fix a block sync peer could pad the beacon of an honest commit: the node verified the signature, stored the padded commit as its seen commit and passed it to FinalizeBlock. Over gRPC ABCI a beacon above 4 MB made FinalizeBlock fail and the node crash on every restart, and a beacon larger than Block.MaxBytes left it unable to propose. Commit.ValidateBasic now refuses a commit unless both fields are empty or exactly 96 and 32 bytes, whatever the consensus version. Every path that accepts a commit on its own decodes it through CommitFromProto or validates it with ValidateBasic (block sync responses, consensus Commit messages, light blocks, stored commits), so such a commit is refused before it is stored or passed on. A block's LastCommit is not refused for these fields: releases before them skip them as unknown, so refusing such a block would split an upgraded node from them. BlockFromProto decodes it without the malformed fields instead, so they are never read, kept or passed on. Refs dashpay/platform#4682 Co-Authored-By: Claude Opus 5.5 --- internal/blocksync/commit_randomness_test.go | 58 +++++++++++++++ internal/consensus/msgs_test.go | 22 ++++++ proto/tendermint/types/types.pb.go | 4 +- proto/tendermint/types/types.proto | 4 +- types/block.go | 38 +++++++++- types/block_test.go | 78 ++++++++++++++++++++ 6 files changed, 201 insertions(+), 3 deletions(-) create mode 100644 internal/blocksync/commit_randomness_test.go diff --git a/internal/blocksync/commit_randomness_test.go b/internal/blocksync/commit_randomness_test.go new file mode 100644 index 0000000000..d440361b11 --- /dev/null +++ b/internal/blocksync/commit_randomness_test.go @@ -0,0 +1,58 @@ +package blocksync + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + sm "github.com/dashpay/tenderdash/internal/state" + "github.com/dashpay/tenderdash/internal/test/factory" + bcproto "github.com/dashpay/tenderdash/proto/tendermint/blocksync" + "github.com/dashpay/tenderdash/types" +) + +// TestBlockResponseRefusesPaddedCommitBeacon is the regression test for a block sync peer relaying an +// honest block and its validly signed commit with the commit's beacon padded: neither the commit hash +// nor its threshold signature covers the beacon, so before the size bound the padded commit passed +// verification, was stored as the seen commit and reached the application. The response is now +// refused while it is decoded, before anything is verified, stored or passed on. +func TestBlockResponseRefusesPaddedCommitBeacon(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + genDoc, privVals := factory.RandGenesisDoc(1, factory.ConsensusParams()) + state, err := sm.MakeGenesisState(genDoc) + require.NoError(t, err) + block, _, _, seen := makeNextBlock(ctx, t, state, privVals[0], 1, types.NewCommit(0, 0, types.BlockID{}, nil, nil)) + + response := func(beacon, appHash []byte) (*BlockResponse, error) { + t.Helper() + pbBlock, err := block.ToProto() + require.NoError(t, err) + pbCommit := seen.ToProto() + pbCommit.Beacon = beacon + pbCommit.AppHash = appHash + bz, err := (&bcproto.BlockResponse{Block: pbBlock, Commit: pbCommit}).Marshal() + require.NoError(t, err) + var decoded bcproto.BlockResponse + require.NoError(t, decoded.Unmarshal(bz)) + return BlockResponseFromProto(&decoded, "peer") + } + + honest, err := response(nil, nil) + require.NoError(t, err) + require.Equal(t, seen.Hash(), honest.Commit.Hash()) + + for name, fields := range map[string][2][]byte{ + "25 MiB beacon": {make([]byte, 25<<20), []byte("junk")}, + "5 MiB beacon": {make([]byte, 5<<20), make([]byte, 32)}, + "app hash without beacon": {nil, make([]byte, 32)}, + } { + t.Run(name, func(t *testing.T) { + resp, err := response(fields[0], fields[1]) + require.ErrorIs(t, err, types.ErrInvalidCommitRandomness) + require.Nil(t, resp) + }) + } +} diff --git a/internal/consensus/msgs_test.go b/internal/consensus/msgs_test.go index 726d616a4a..1bc066b436 100644 --- a/internal/consensus/msgs_test.go +++ b/internal/consensus/msgs_test.go @@ -761,3 +761,25 @@ func TestHasVoteMessageValidateBasic(t *testing.T) { }) } } + +// TestCommitMessageRefusesMalformedRandomness checks that a commit gossiped with a beacon or app hash +// of the wrong size is refused when the message is decoded: the commit's signature covers neither, so +// a relaying peer could otherwise attach any bytes to a valid commit. +func TestCommitMessageRefusesMalformedRandomness(t *testing.T) { + commit := &types.Commit{ + Height: 2, + BlockID: types.BlockID{Hash: crypto.CRandBytes(crypto.HashSize), PartSetHeader: types.PartSetHeader{Total: 1, Hash: crypto.CRandBytes(crypto.HashSize)}, StateID: crypto.CRandBytes(crypto.HashSize)}, + QuorumHash: crypto.RandQuorumHash(), + ThresholdBlockSignature: crypto.CRandBytes(types.SignatureSize), + } + decode := func(beacon, appHash []byte) error { + pb := commit.ToProto() + pb.Beacon = beacon + pb.AppHash = appHash + _, err := MsgFromProto(&tmcons.Commit{Commit: pb}) + return err + } + require.NoError(t, decode(nil, nil)) + require.NoError(t, decode(crypto.CRandBytes(types.SignatureSize), crypto.CRandBytes(crypto.DefaultAppHashSize))) + require.ErrorIs(t, decode(make([]byte, 900<<10), []byte("junk")), types.ErrInvalidCommitRandomness) +} diff --git a/proto/tendermint/types/types.pb.go b/proto/tendermint/types/types.pb.go index cbe25466a6..cc51e0dbf0 100644 --- a/proto/tendermint/types/types.pb.go +++ b/proto/tendermint/types/types.pb.go @@ -693,7 +693,9 @@ type Commit struct { ThresholdBlockSignature []byte `protobuf:"bytes,5,opt,name=threshold_block_signature,json=thresholdBlockSignature,proto3" json:"threshold_block_signature,omitempty"` ThresholdVoteExtensions []*VoteExtension `protobuf:"bytes,6,rep,name=threshold_vote_extensions,json=thresholdVoteExtensions,proto3" json:"threshold_vote_extensions,omitempty"` // Random beacon: the threshold signature recovered from the prevotes of the commit round. - // Set from consensus version 2; empty before. + // Set from consensus version 2; empty before. Neither this field nor app_hash is covered by the + // commit's signature: a commit is refused unless both are empty or they are exactly 96 and 32 + // bytes, and a block's last commit is read without them when they are not. Beacon []byte `protobuf:"bytes,7,opt,name=beacon,proto3" json:"beacon,omitempty"` // App hash the precommits sign, returned by ApplyBlockRandomness for this block and round. // Set from consensus version 2; empty before. diff --git a/proto/tendermint/types/types.proto b/proto/tendermint/types/types.proto index bc27a6505e..513e865884 100644 --- a/proto/tendermint/types/types.proto +++ b/proto/tendermint/types/types.proto @@ -157,7 +157,9 @@ message Commit { bytes threshold_block_signature = 5; repeated VoteExtension threshold_vote_extensions = 6; // Random beacon: the threshold signature recovered from the prevotes of the commit round. - // Set from consensus version 2; empty before. + // Set from consensus version 2; empty before. Neither this field nor app_hash is covered by the + // commit's signature: a commit is refused unless both are empty or they are exactly 96 and 32 + // bytes, and a block's last commit is read without them when they are not. bytes beacon = 7; // App hash the precommits sign, returned by ApplyBlockRandomness for this block and round. // Set from consensus version 2; empty before. diff --git a/types/block.go b/types/block.go index f1f60cc895..46af9e1588 100644 --- a/types/block.go +++ b/types/block.go @@ -337,7 +337,7 @@ func BlockFromProto(bp *tmproto.Block) (*Block, error) { b.CoreChainLock = coreChainLock if bp.LastCommit != nil { - lc, err := CommitFromProto(bp.LastCommit) + lc, err := CommitFromProto(lastCommitWithoutMalformedRandomness(bp.LastCommit)) if err != nil { return nil, err } @@ -347,6 +347,23 @@ func BlockFromProto(bp *tmproto.Block) (*Block, error) { return b, b.ValidateBasic() } +// lastCommitWithoutMalformedRandomness returns the block's LastCommit without its beacon and app hash +// when they do not have the sizes ValidateBasic requires, and cp itself otherwise. +// +// A block's LastCommit is not refused for them, unlike a commit received on its own: releases before +// these fields skip them as unknown, so they accept such a block, and an upgraded node refusing it +// would split from them. Neither field is covered by the block hash, and dropping them here keeps +// them from being read, stored in the decoded block, or passed on. +func lastCommitWithoutMalformedRandomness(cp *tmproto.Commit) *tmproto.Commit { + if validRandomBeaconSizes(cp.Beacon, cp.AppHash) { + return cp + } + stripped := *cp + stripped.Beacon = nil + stripped.AppHash = nil + return &stripped +} + //----------------------------------------------------------------------------- // MaxDataBytes returns the maximum size of block's data. @@ -752,6 +769,17 @@ const ( //------------------------------------- +// ErrInvalidCommitRandomness is returned for a commit whose beacon and app hash are neither both empty +// nor exactly a threshold signature and an app hash. +var ErrInvalidCommitRandomness = errors.New("invalid commit beacon or app hash size") + +// validRandomBeaconSizes reports whether a commit's beacon and app hash are both empty, or a threshold +// signature and an app hash: the only forms a commit can carry them in. +func validRandomBeaconSizes(beacon, appHash []byte) bool { + return (len(beacon) == 0 && len(appHash) == 0) || + (len(beacon) == SignatureSize && len(appHash) == crypto.DefaultAppHashSize) +} + // Commit contains the evidence that a block was committed by a set of validators. // NOTE: Commit is empty for height 1, but never nil. type Commit struct { @@ -902,6 +930,14 @@ func (commit *Commit) ValidateBasic() error { } } + // Neither field is covered by the commit hash or its threshold signature, so a peer can fill them + // in a commit it relays. Bounding them here refuses such a commit before it is stored or passed + // to the application, whatever the consensus version. + if !validRandomBeaconSizes(commit.Beacon, commit.AppHash) { + return fmt.Errorf("%w: beacon of %d bytes and app hash of %d bytes, expected both empty or %d and %d bytes", + ErrInvalidCommitRandomness, len(commit.Beacon), len(commit.AppHash), SignatureSize, crypto.DefaultAppHashSize) + } + // Reject extension types nothing can dispatch on: proto3's open enums let an // undefined varint decode untouched, and no other check rejects it. Type only — // each extension's contents are covered by its own threshold signature. diff --git a/types/block_test.go b/types/block_test.go index bcc384c082..a7a586cafb 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -1523,3 +1523,81 @@ func TestCommit_ValidateBasic_RejectsUnknownExtensionType(t *testing.T) { "a nil extension must not reach a consumer that will dereference it") require.EqualError(t, nilErr, "nil vote extension at index 0") } + +// TestCommitValidateBasicRandomnessSizes checks that a commit's beacon and app hash must be both empty +// or exactly a threshold signature and an app hash. Neither is covered by the commit hash or its +// signature, so a peer relaying a commit can fill them with anything. +func TestCommitValidateBasicRandomnessSizes(t *testing.T) { + testCases := map[string]struct { + beacon []byte + appHash []byte + valid bool + }{ + "both empty": {valid: true}, + "both set": {beacon: crypto.CRandBytes(SignatureSize), appHash: crypto.CRandBytes(crypto.DefaultAppHashSize), valid: true}, + "beacon only": {beacon: crypto.CRandBytes(SignatureSize)}, + "app hash only": {appHash: crypto.CRandBytes(crypto.DefaultAppHashSize)}, + "long beacon": {beacon: crypto.CRandBytes(SignatureSize + 1), appHash: crypto.CRandBytes(crypto.DefaultAppHashSize)}, + "short app hash": {beacon: crypto.CRandBytes(SignatureSize), appHash: crypto.CRandBytes(crypto.DefaultAppHashSize - 1)}, + "one MiB of beacon": {beacon: make([]byte, 1<<20), appHash: crypto.CRandBytes(crypto.DefaultAppHashSize)}, + } + for name, tc := range testCases { + t.Run(name, func(t *testing.T) { + commit := &Commit{ + Height: 3, + BlockID: makeBlockIDRandom(), + QuorumHash: crypto.RandQuorumHash(), + ThresholdBlockSignature: crypto.CRandBytes(SignatureSize), + Beacon: tc.beacon, + AppHash: tc.appHash, + } + _, err := CommitFromProto(commit.ToProto()) + if tc.valid { + require.NoError(t, err) + } else { + require.ErrorIs(t, err, ErrInvalidCommitRandomness) + } + }) + } +} + +// TestBlockFromProtoMalformedLastCommitRandomness checks that a block whose LastCommit carries a beacon +// or app hash of the wrong size is decoded without them rather than refused: releases before these +// fields skip them, and refusing such a block would split an upgraded node from them. +func TestBlockFromProtoMalformedLastCommitRandomness(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + lastID := makeBlockIDRandom() + voteSet, _, vals := randVoteSet(ctx, t, 2, 1, tmproto.PrecommitType, 4) + lastCommit, err := makeCommit(ctx, lastID, 2, 1, voteSet, vals) + require.NoError(t, err) + block := MakeBlock(3, []Tx{Tx("tx")}, lastCommit, nil) + block.ProposerProTxHash = crypto.RandProTxHash() + block.ValidatorsHash = crypto.CRandBytes(crypto.HashSize) + + decode := func(beacon, appHash []byte) *Block { + t.Helper() + pb, err := block.ToProto() + require.NoError(t, err) + pb.LastCommit.Beacon = beacon + pb.LastCommit.AppHash = appHash + bz, err := pb.Marshal() + require.NoError(t, err) + var decoded tmproto.Block + require.NoError(t, decoded.Unmarshal(bz)) + got, err := BlockFromProto(&decoded) + require.NoError(t, err) + return got + } + + got := decode(make([]byte, 10), []byte("junk")) + require.Empty(t, got.LastCommit.Beacon, "a malformed beacon is dropped, not stored") + require.Empty(t, got.LastCommit.AppHash) + require.Equal(t, block.LastCommit.Hash(), got.LastCommit.Hash(), "the commit hash covers neither field") + + beacon, appHash := crypto.CRandBytes(SignatureSize), crypto.CRandBytes(crypto.DefaultAppHashSize) + got = decode(beacon, appHash) + require.Equal(t, beacon, got.LastCommit.Beacon, "well-formed fields are kept") + require.EqualValues(t, appHash, got.LastCommit.AppHash) +} From b1a88aece7a5b7f873d571172d974ccc76e3150e Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Wed, 4 Nov 2026 04:05:10 +0700 Subject: [PATCH 03/18] fix(types): decode blocks whose LastCommit carries mistyped beacon fields Releases before Commit.beacon and Commit.app_hash (fields 7 and 8) skip those fields whatever their wire type. The generated decoder of this release instead refuses the whole block when its LastCommit carries one with a wire type other than bytes. In a network still running older releases, a byzantine proposer could therefore get such a block committed by the older validators while upgraded nodes could not decode it, and an older node that stored it would panic loading it after upgrading. types.UnmarshalBlockProto decodes block bytes as before and, only when that fails, drops the mistyped occurrences of those two fields from the block's LastCommit and decodes again, so an upgraded node reads every block an older one does. Consensus block part assembly and BlockStore.LoadBlock use it. google.golang.org/protobuf becomes a direct dependency for its wire format parser. Refs dashpay/platform#4682 Co-Authored-By: Claude Opus 5.5 --- go.mod | 2 +- internal/consensus/state_add_prop_block.go | 6 +- internal/store/store.go | 3 +- internal/store/store_test.go | 23 ++++++ types/block_decode.go | 95 ++++++++++++++++++++++ types/block_decode_test.go | 56 +++++++++++++ 6 files changed, 177 insertions(+), 8 deletions(-) create mode 100644 types/block_decode.go create mode 100644 types/block_decode_test.go diff --git a/go.mod b/go.mod index 41918fab1b..319c81c4b2 100644 --- a/go.mod +++ b/go.mod @@ -275,7 +275,6 @@ require ( golang.org/x/tools v0.52.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20261005182115-fad411399dd8 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20261005182115-fad411399dd8 // indirect - google.golang.org/protobuf v1.36.12 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/tools v0.8.2 // indirect mvdan.cc/gofumpt v0.12.0 // indirect @@ -336,6 +335,7 @@ require ( golang.org/x/term v0.47.0 golang.org/x/time v0.16.0 google.golang.org/grpc v1.83.2 + google.golang.org/protobuf v1.36.12 pgregory.net/rapid v1.3.0 ) diff --git a/internal/consensus/state_add_prop_block.go b/internal/consensus/state_add_prop_block.go index 9ab668c4a0..a5596a5006 100644 --- a/internal/consensus/state_add_prop_block.go +++ b/internal/consensus/state_add_prop_block.go @@ -10,12 +10,9 @@ import ( "slices" "time" - "github.com/cosmos/gogoproto/proto" - cstypes "github.com/dashpay/tenderdash/internal/consensus/types" tmstrings "github.com/dashpay/tenderdash/internal/libs/strings" "github.com/dashpay/tenderdash/libs/log" - tmproto "github.com/dashpay/tenderdash/proto/tendermint/types" "github.com/dashpay/tenderdash/types" ) @@ -170,8 +167,7 @@ func (c *AddProposalBlockPartAction) addProposalBlockPart( return added, err } - var pbb = new(tmproto.Block) - err = proto.Unmarshal(bz, pbb) + pbb, err := types.UnmarshalBlockProto(bz) if err != nil { return added, err } diff --git a/internal/store/store.go b/internal/store/store.go index ef88c6ce8c..29d6799d82 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -183,7 +183,6 @@ func (bs *BlockStore) LoadBlock(height int64) *types.Block { return nil } - pbb := new(tmproto.Block) buf := []byte{} for i := 0; i < int(blockMeta.BlockID.PartSetHeader.Total); i++ { part := bs.LoadBlockPart(height, i) @@ -194,7 +193,7 @@ func (bs *BlockStore) LoadBlock(height int64) *types.Block { } buf = append(buf, part.Bytes...) } - err := proto.Unmarshal(buf, pbb) + pbb, err := types.UnmarshalBlockProto(buf) if err != nil { // NOTE: The existence of meta should imply the existence of the // block. So, make sure meta is only saved after blocks are saved. diff --git a/internal/store/store_test.go b/internal/store/store_test.go index 447ba59cfe..f5d4add5ba 100644 --- a/internal/store/store_test.go +++ b/internal/store/store_test.go @@ -597,3 +597,26 @@ func newBlock(hdr types.Header, lastCommit *types.Commit) *types.Block { LastCommit: lastCommit, } } + +// TestLoadBlockMistypedLastCommitRandomness is the regression test for a block an older release +// stored while its LastCommit carried the beacon field with the varint wire type: that release skips +// the field, so it commits and stores such a block from a byzantine proposer, and an upgraded node +// panicked when loading it. It now loads the block without the field. +func TestLoadBlockMistypedLastCommitRandomness(t *testing.T) { + state, bs := makeStateAndBlockStore(t, t.TempDir()) + block, err := factory.MakeBlock(state, 1, new(types.Commit), 0) + require.NoError(t, err) + pb, err := block.ToProto() + require.NoError(t, err) + bz, err := pb.Marshal() + require.NoError(t, err) + // another occurrence of last_commit (field 4) holding field 7 with wire type 0 + raw := append(append([]byte{}, bz...), 0x22, 0x02, 0x38, 0x01) + parts := types.NewPartSetFromData(raw, types.BlockPartSizeBytes) + bs.SaveBlock(block, parts, makeTestCommit(t, state, block.Height)) + + var loaded *types.Block + require.NotPanics(t, func() { loaded = bs.LoadBlock(1) }) + require.NotNil(t, loaded) + require.Equal(t, block.Hash(), loaded.Hash()) +} diff --git a/types/block_decode.go b/types/block_decode.go new file mode 100644 index 0000000000..fc5df68593 --- /dev/null +++ b/types/block_decode.go @@ -0,0 +1,95 @@ +package types + +import ( + "github.com/cosmos/gogoproto/proto" + "google.golang.org/protobuf/encoding/protowire" + + tmproto "github.com/dashpay/tenderdash/proto/tendermint/types" +) + +// Field numbers of tendermint.types.Block.last_commit and of tendermint.types.Commit.beacon and +// app_hash. +const ( + blockLastCommitField protowire.Number = 4 + commitBeaconField protowire.Number = 7 + commitAppHashField protowire.Number = 8 + commitRandomnessWType = protowire.BytesType +) + +// UnmarshalBlockProto decodes the bytes of a block, as joined from its parts. +// +// The beacon and app hash fields of a commit (fields 7 and 8) are unknown to releases before them, +// which skip them whatever their wire type. A block whose LastCommit carries one of them with another +// wire type is therefore valid to those releases, which can commit and store it, while strict +// decoding refuses it. Such occurrences are dropped here, so an upgraded node decodes every block an +// older one does. Blocks without them decode exactly as with proto.Unmarshal. +func UnmarshalBlockProto(bz []byte) (*tmproto.Block, error) { + pb := new(tmproto.Block) + err := proto.Unmarshal(bz, pb) + if err == nil { + return pb, nil + } + cleaned, dropped := dropMistypedLastCommitRandomness(bz) + if !dropped { + return nil, err + } + pb = new(tmproto.Block) + if err := proto.Unmarshal(cleaned, pb); err != nil { + return nil, err + } + return pb, nil +} + +// dropMistypedLastCommitRandomness returns the block bytes bz without the occurrences of the +// LastCommit beacon and app hash fields that do not have the bytes wire type, and whether there were +// any. It returns false for bytes it cannot parse. +func dropMistypedLastCommitRandomness(bz []byte) ([]byte, bool) { + out := make([]byte, 0, len(bz)) + dropped := false + for len(bz) > 0 { + num, typ, n := protowire.ConsumeTag(bz) + if n < 0 { + return nil, false + } + m := protowire.ConsumeFieldValue(num, typ, bz[n:]) + if m < 0 { + return nil, false + } + field := bz[:n+m] + if num == blockLastCommitField && typ == protowire.BytesType { + commit, _ := protowire.ConsumeBytes(bz[n:]) + cleaned, ok := dropMistypedCommitRandomness(commit) + if ok { + dropped = true + field = protowire.AppendBytes(protowire.AppendTag(nil, num, typ), cleaned) + } + } + out = append(out, field...) + bz = bz[n+m:] + } + return out, dropped +} + +// dropMistypedCommitRandomness returns the commit bytes bz without the beacon and app hash fields that +// do not have the bytes wire type, and whether there were any. +func dropMistypedCommitRandomness(bz []byte) ([]byte, bool) { + out := make([]byte, 0, len(bz)) + dropped := false + for len(bz) > 0 { + num, typ, n := protowire.ConsumeTag(bz) + if n < 0 { + return nil, false + } + m := protowire.ConsumeFieldValue(num, typ, bz[n:]) + if m < 0 { + return nil, false + } + if (num == commitBeaconField || num == commitAppHashField) && typ != commitRandomnessWType { + dropped = true + } else { + out = append(out, bz[:n+m]...) + } + bz = bz[n+m:] + } + return out, dropped +} diff --git a/types/block_decode_test.go b/types/block_decode_test.go new file mode 100644 index 0000000000..0192cf9d05 --- /dev/null +++ b/types/block_decode_test.go @@ -0,0 +1,56 @@ +package types + +import ( + "testing" + + "github.com/cosmos/gogoproto/proto" + "github.com/stretchr/testify/require" + + "github.com/dashpay/tenderdash/crypto" + tmproto "github.com/dashpay/tenderdash/proto/tendermint/types" +) + +// TestUnmarshalBlockProtoMistypedLastCommitRandomness checks that a block whose LastCommit carries the +// beacon or app hash field with a wire type other than bytes decodes as releases before those fields +// decode it, without them, instead of failing: such a block is valid to those releases, which can +// commit it while upgraded nodes could not read it. +func TestUnmarshalBlockProtoMistypedLastCommitRandomness(t *testing.T) { + block := MakeBlock(3, []Tx{Tx("tx")}, &Commit{ + Height: 2, + BlockID: makeBlockIDRandom(), + ThresholdBlockSignature: make([]byte, SignatureSize), + }, nil) + block.ProposerProTxHash = crypto.RandProTxHash() + block.ValidatorsHash = crypto.CRandBytes(crypto.HashSize) + pb, err := block.ToProto() + require.NoError(t, err) + bz, err := pb.Marshal() + require.NoError(t, err) + + plain, err := UnmarshalBlockProto(bz) + require.NoError(t, err) + require.True(t, proto.Equal(pb, plain), "a block without such fields decodes as with proto.Unmarshal") + + // Each suffix is another occurrence of last_commit (field 4), which protobuf merges into the first. + for name, suffix := range map[string][]byte{ + "beacon as varint": {0x22, 0x02, 0x38, 0x01}, // field 7, wire type 0 + "app hash as fixed32": {0x22, 0x05, 0x45, 0x01, 0x02, 0x03, 0x04}, // field 8, wire type 5 + "beacon as fixed64": {0x22, 0x09, 0x39, 1, 2, 3, 4, 5, 6, 7, 8}, // field 7, wire type 1 + } { + t.Run(name, func(t *testing.T) { + raw := append(append([]byte{}, bz...), suffix...) + var strict tmproto.Block + require.Error(t, proto.Unmarshal(raw, &strict), "strict decoding refuses it") + + decoded, err := UnmarshalBlockProto(raw) + require.NoError(t, err) + require.True(t, proto.Equal(pb, decoded), "decodes to the block without the mistyped field") + got, err := BlockFromProto(decoded) + require.NoError(t, err) + require.Equal(t, block.Hash(), got.Hash()) + }) + } + + _, err = UnmarshalBlockProto(append(append([]byte{}, bz...), 0x22, 0x05, 0x38)) + require.Error(t, err, "truncated bytes still fail") +} From db6670047bf6b1afebb8f29e5bb68437bdc5b2b6 Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Wed, 4 Nov 2026 04:05:10 +0700 Subject: [PATCH 04/18] fix(kvstore): pick the ApplyBlockRandomness state by block hash The example application looked up the state for ApplyBlockRandomness by height and round only. A node that executed two blocks of one round, as with an equivocating proposer whose second block the network commits after a later round was processed, failed with "more than one proposal executed", which the spec makes fatal, and a block that was not processed silently got another block's app hash. ProcessProposal now records which state each block hash left at each round, and ApplyBlockRandomness answers for the block the request names, refusing one that was not processed. Without a hash it still uses the only state of that height and round. Refs dashpay/platform#4682 Co-Authored-By: Claude Opus 5.5 --- abci/example/kvstore/kvstore.go | 36 ++++++++++++++--- abci/example/kvstore/kvstore_test.go | 59 ++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 5 deletions(-) diff --git a/abci/example/kvstore/kvstore.go b/abci/example/kvstore/kvstore.go index 82016f0eda..3a46484bb3 100644 --- a/abci/example/kvstore/kvstore.go +++ b/abci/example/kvstore/kvstore.go @@ -47,8 +47,12 @@ type Application struct { // LastCommittedState is last state that was committed by Tenderdash and finalized with abci.FinalizeBlock() LastCommittedState State // roundStates contains state for each round, indexed by roundKey() - roundStates map[string]State - RetainBlocks int64 // blocks to retain after commit (via ResponseCommit.RetainHeight) + roundStates map[string]State + // processedBlocks maps each block ProcessProposal executed at this height, by round and block hash, + // to its key in roundStates. Two blocks of one round, from an equivocating proposer, have + // different keys. + processedBlocks map[processedBlock]string + RetainBlocks int64 // blocks to retain after commit (via ResponseCommit.RetainHeight) // preparedProposals stores info about all rounds that got PrepareProposal executed, used to detect // duplicate PrepareProposal calls. @@ -218,6 +222,7 @@ func newApplication(stateStore StoreFactory, opts ...OptFunc) (*Application, err logger: log.NewNopLogger(), LastCommittedState: NewKvState(dbm.NewMemDB(), initialHeight), // initial state to avoid InitChain() in unit tests roundStates: map[string]State{}, + processedBlocks: map[processedBlock]string{}, preparedProposals: map[int32]bool{}, processedProposals: map[int32][]byte{}, validatorSetUpdates: map[int64]abci.ValidatorSetUpdate{}, @@ -392,6 +397,10 @@ func (app *Application) ProcessProposal(_ context.Context, req *abci.RequestProc Status: abci.ResponseProcessProposal_REJECT, }, err } + if len(req.Hash) > 0 { + block := processedBlock{round: req.Round, hash: string(req.Hash)} + app.processedBlocks[block] = roundKey(roundState.GetAppHash(), roundState.GetHeight(), roundState.GetRound()) + } if req.Version.App != app.appVersionForHeight(req.Height) { app.logger.Error("app version mismatch in process proposal request", @@ -496,7 +505,7 @@ func (app *Application) ApplyBlockRandomness(_ context.Context, req *abci.Reques app.mu.Lock() defer app.mu.Unlock() - roundState, err := app.processedRoundState(req.Height, req.Round) + roundState, err := app.processedRoundState(req.Hash, req.Height, req.Round) if err != nil { return nil, fmt.Errorf("apply block randomness (hash: %X): %w", req.Hash, err) } @@ -506,9 +515,25 @@ func (app *Application) ApplyBlockRandomness(_ context.Context, req *abci.Reques return resp, nil } -// processedRoundState returns the state of the proposal executed at the given height and round. +// processedBlock identifies a block ProcessProposal executed at the current height. +type processedBlock struct { + round int32 + hash string +} + +// processedRoundState returns the state ProcessProposal left for the block with the given hash at +// the given height and round. Without a hash, it returns the only state executed at that height and +// round, by PrepareProposal or ProcessProposal. // Caller should lock the Application. -func (app *Application) processedRoundState(height int64, round int32) (State, error) { +func (app *Application) processedRoundState(hash []byte, height int64, round int32) (State, error) { + if len(hash) > 0 { + key, ok := app.processedBlocks[processedBlock{round: round, hash: string(hash)}] + state := app.roundStates[key] + if !ok || state == nil || state.GetHeight() != height { + return nil, fmt.Errorf("block not processed at height %d round %d", height, round) + } + return state, nil + } var found State for _, state := range app.roundStates { if state.GetHeight() != height || state.GetRound() != round { @@ -827,6 +852,7 @@ func (app *Application) resetRoundStates() { state.Close() } app.roundStates = map[string]State{} + app.processedBlocks = map[processedBlock]string{} } // executeProposal executes transactions and creates new candidate state diff --git a/abci/example/kvstore/kvstore_test.go b/abci/example/kvstore/kvstore_test.go index d541b83b5f..02f4a49075 100644 --- a/abci/example/kvstore/kvstore_test.go +++ b/abci/example/kvstore/kvstore_test.go @@ -686,3 +686,62 @@ func TestApplyBlockRandomness(t *testing.T) { _, err = app.ApplyBlockRandomness(ctx, &types.RequestApplyBlockRandomness{Height: height, Round: 0}) require.ErrorContains(t, err, "no proposal executed") } + +// TestApplyBlockRandomnessEquivocation is the regression test for a node that executed two blocks of +// one round, as with an equivocating proposer: it processed block A at round 0, then a block at round 1, +// which lets round 0 be processed again, then the other round 0 block B, which the network committed. +// ApplyBlockRandomness used to pick the state by height and round only and failed with "more than one +// proposal executed", which is fatal; it now picks the state of the block the request names, and +// refuses a block that was not processed. +func TestApplyBlockRandomnessEquivocation(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + app := newKvApp(ctx, t, 1) + process := func(height int64, round int32, hash string, txs ...string) *types.ResponseProcessProposal { + t.Helper() + resp, err := app.ProcessProposal(ctx, &types.RequestProcessProposal{ + Txs: bytes2TxsBytes(txs), + Hash: []byte(hash), + Height: height, + Round: round, + Version: &pbversion.Consensus{App: uint64(height)}, + }) + require.NoError(t, err) + return resp + } + // The app hash changes with the txs only after the initial height. + h1 := process(1, 0, "h1", "k=v") + reqFin := &types.RequestFinalizeBlock{Height: 1} + reqFin.Block, reqFin.BlockID = makeBlock(t, 1, [][]byte{[]byte("k=v")}, h1.AppHash) + _, err := app.FinalizeBlock(ctx, reqFin) + require.NoError(t, err) + + const height = 2 + a := process(height, 0, "block-A", "a=1") + process(height, 1, "block-X", "x=3") + b := process(height, 0, "block-B", "b=2", "c=4") + require.NotEqual(t, a.AppHash, b.AppHash, "two states for round 0") + + apply := func(hash string) (*types.ResponseApplyBlockRandomness, error) { + return app.ApplyBlockRandomness(ctx, &types.RequestApplyBlockRandomness{ + Hash: []byte(hash), Height: height, Round: 0, Beacon: tmcrypto.CRandBytes(tmtypes.SignatureSize), + }) + } + respB, err := apply("block-B") + require.NoError(t, err) + require.EqualValues(t, b.AppHash, respB.AppHash) + respA, err := apply("block-A") + require.NoError(t, err) + require.EqualValues(t, a.AppHash, respA.AppHash) + _, err = apply("block-never-processed") + require.ErrorContains(t, err, "block not processed") +} + +func bytes2TxsBytes(txs []string) [][]byte { + out := make([][]byte, 0, len(txs)) + for _, tx := range txs { + out = append(out, []byte(tx)) + } + return out +} From 846b8e10ad41817bd2cc2b5ef00ccca7de1429f4 Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Wed, 4 Nov 2026 04:41:51 +0700 Subject: [PATCH 05/18] docs(abci): state what the randomness may change and what FinalizeBlock commits The ApplyBlockRandomness contract left four things open: - Vote extensions: Tenderdash calls ApplyBlockRandomness before ExtendVote, but other processes verify a Precommit's extensions against the state ProcessProposal left, possibly before they recover the beacon. Extensions and their verification must not depend on the beacon. - What the randomness may change: only the state behind the returned app hash. Transaction results, events and validator set or consensus parameter updates come from ProcessProposal and are fixed by the header the Prevotes signed. - FinalizeBlock: from consensus version 2 the committed state is the candidate with the commit's beacon applied, and its root must equal commit.app_hash, so an application in same-block execution mode reads the randomness fields as well as the hash. - When it is called: on every path that finalizes a block from a commit, the node's own included; the proto said only commits the node did not assemble itself. The ABCI call grammar gains the method, and the CommitInfo table links VoteExtension to its proto instead of a missing anchor. Regenerated types.pb.go and api.md (comments only). Refs dashpay/platform#4682 Co-Authored-By: Claude Opus 5.5 --- abci/types/application.go | 2 +- abci/types/types.pb.go | 28 ++++++++++--- proto/tendermint/abci/types.proto | 28 ++++++++++--- spec/abci++/abci++_methods.md | 40 +++++++++++++------ spec/abci++/abci++_tmint_expected_behavior.md | 22 ++++++---- spec/abci++/api.md | 27 ++++++++++--- 6 files changed, 109 insertions(+), 38 deletions(-) diff --git a/abci/types/application.go b/abci/types/application.go index a77149b554..157fa5c802 100644 --- a/abci/types/application.go +++ b/abci/types/application.go @@ -46,7 +46,7 @@ type Application interface { VerifyVoteExtension(context.Context, *RequestVerifyVoteExtension) (*ResponseVerifyVoteExtension, error) // Deliver the decided block with its txs to the Application FinalizeBlock(context.Context, *RequestFinalizeBlock) (*ResponseFinalizeBlock, error) - // Apply the block's random beacon and return the app hash the precommit signs (consensus version 2) + // Apply the block's random beacon and return the app hash the precommit signs (consensus version 2). ApplyBlockRandomness(context.Context, *RequestApplyBlockRandomness) (*ResponseApplyBlockRandomness, error) } diff --git a/abci/types/types.pb.go b/abci/types/types.pb.go index 972df8ed8f..af6ef23aaa 100644 --- a/abci/types/types.pb.go +++ b/abci/types/types.pb.go @@ -1646,6 +1646,10 @@ func (m *RequestProcessProposal) GetQuorumHash() []byte { // `VerifyVoteExtension` rejection that follows `ProcessProposal` of that block and round, to learn the // vector a commit of that block and round must carry; see `VerifyVoteExtension`. An ABCI error or an // invalid response from this call is fatal, as on the Precommit path. +// - From consensus version 2, Tenderdash calls `ApplyBlockRandomness` before `ExtendVote`, but the extensions +// MUST NOT depend on the beacon or on the state `ApplyBlockRandomness` produced: other processes verify them +// against the state `ProcessProposal` left, possibly before they recover the round's beacon, or without ever +// recovering it. // // #### When does Tenderdash call it? // @@ -1911,7 +1915,12 @@ func (m *RequestVerifyVoteExtension) GetVoteExtensions() []*ExtendVoteExtension // already passed on to the Application via `RequestPrepareProposal` or `RequestProcessProposal`. // If the Application is in same-block execution mode, it applies the right candidate state here // (rather than executing the whole block). In this case the Application disregards all parameters in -// `RequestFinalizeBlock` except `RequestFinalizeBlock.hash`. +// `RequestFinalizeBlock` except `RequestFinalizeBlock.hash` and, from consensus version 2, the +// randomness fields below. +// - From consensus version 2, the state to commit is the candidate state of the block for +// `RequestFinalizeBlock.round` with `RequestFinalizeBlock.commit.beacon` applied, as `ApplyBlockRandomness` +// applies it, and its Merkle root hash MUST equal `RequestFinalizeBlock.commit.app_hash`. Committing the +// candidate state without the randomness diverges from the rest of the network. type RequestFinalizeBlock struct { // Info about the current commit Commit CommitInfo `protobuf:"bytes,1,opt,name=commit,proto3" json:"commit"` @@ -2024,6 +2033,12 @@ func (m *RequestFinalizeBlock) GetBlockID() *types1.BlockID { // When nothing in the block uses randomness, `app_hash` equals the app hash of the block header. // - The header keeps the app hash from `ProcessProposal`, which Prevotes sign. Precommits and the commit sign // `ResponseApplyBlockRandomness.app_hash`, and the commit carries it in `Commit.app_hash`. +// - The randomness may change only the application state behind `app_hash`. Transaction results, events, +// validator set updates, consensus parameter updates and the other outputs of `ProcessProposal` are fixed +// by the header the Prevotes signed: they MUST NOT depend on the beacon, and Tenderdash keeps the ones +// `ProcessProposal` returned. +// - Vote extensions and their verification MUST NOT depend on the beacon or on the state this call produces; +// see `ExtendVote`. // - The implementation MUST be deterministic: every process that applies the same beacon to the same block // and round MUST return the same `app_hash`. // - Tenderdash may call it more than once for the same block, round and beacon; the Application MUST return @@ -2034,10 +2049,10 @@ func (m *RequestFinalizeBlock) GetBlockID() *types1.BlockID { // // - On a validator, once the Prevotes of round _r_ for block _v_ reach the threshold and their signature is // recovered, before `ExtendVote` and before signing its Precommit for _v_. -// - On every path that finalizes a block from a commit it did not assemble itself (block sync, replay, a -// node that did not vote): after `ProcessProposal` of the committed block for the commit round, with the -// commit's beacon, and before `FinalizeBlock`. Tenderdash compares the returned `app_hash` with -// `Commit.app_hash` and stops on a mismatch. +// - On every path that finalizes a block from a commit (consensus, block sync, replay, a node that did not +// vote): after `ProcessProposal` of the committed block for the commit round, with the commit's beacon, and +// before `FinalizeBlock`. Tenderdash compares the returned `app_hash` with `Commit.app_hash` and stops on a +// mismatch. type RequestApplyBlockRandomness struct { Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` @@ -3547,7 +3562,8 @@ func (m *ResponseFinalizeBlock) GetProposeNextBlockImmediately() bool { type ResponseApplyBlockRandomness struct { // The Merkle root hash of the application state after the randomness is applied. 32 bytes. - // Equals the header app hash when nothing in the block uses randomness. + // Equals the header app hash when nothing in the block uses randomness. The randomness changes + // nothing but this state: the other results of the block are the ones ProcessProposal returned. AppHash []byte `protobuf:"bytes,1,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` } diff --git a/proto/tendermint/abci/types.proto b/proto/tendermint/abci/types.proto index 780dfabb47..43acabfc2d 100644 --- a/proto/tendermint/abci/types.proto +++ b/proto/tendermint/abci/types.proto @@ -399,6 +399,10 @@ message RequestProcessProposal { // `VerifyVoteExtension` rejection that follows `ProcessProposal` of that block and round, to learn the // vector a commit of that block and round must carry; see `VerifyVoteExtension`. An ABCI error or an // invalid response from this call is fatal, as on the Precommit path. +// - From consensus version 2, Tenderdash calls `ApplyBlockRandomness` before `ExtendVote`, but the extensions +// MUST NOT depend on the beacon or on the state `ApplyBlockRandomness` produced: other processes verify them +// against the state `ProcessProposal` left, possibly before they recover the round's beacon, or without ever +// recovering it. // // #### When does Tenderdash call it? // @@ -542,7 +546,12 @@ message RequestVerifyVoteExtension { // already passed on to the Application via `RequestPrepareProposal` or `RequestProcessProposal`. // If the Application is in same-block execution mode, it applies the right candidate state here // (rather than executing the whole block). In this case the Application disregards all parameters in -// `RequestFinalizeBlock` except `RequestFinalizeBlock.hash`. +// `RequestFinalizeBlock` except `RequestFinalizeBlock.hash` and, from consensus version 2, the +// randomness fields below. +// - From consensus version 2, the state to commit is the candidate state of the block for +// `RequestFinalizeBlock.round` with `RequestFinalizeBlock.commit.beacon` applied, as `ApplyBlockRandomness` +// applies it, and its Merkle root hash MUST equal `RequestFinalizeBlock.commit.app_hash`. Committing the +// candidate state without the randomness diverges from the rest of the network. message RequestFinalizeBlock { // Info about the current commit CommitInfo commit = 1 [(gogoproto.nullable) = false]; @@ -573,6 +582,12 @@ message RequestFinalizeBlock { // When nothing in the block uses randomness, `app_hash` equals the app hash of the block header. // - The header keeps the app hash from `ProcessProposal`, which Prevotes sign. Precommits and the commit sign // `ResponseApplyBlockRandomness.app_hash`, and the commit carries it in `Commit.app_hash`. +// - The randomness may change only the application state behind `app_hash`. Transaction results, events, +// validator set updates, consensus parameter updates and the other outputs of `ProcessProposal` are fixed +// by the header the Prevotes signed: they MUST NOT depend on the beacon, and Tenderdash keeps the ones +// `ProcessProposal` returned. +// - Vote extensions and their verification MUST NOT depend on the beacon or on the state this call produces; +// see `ExtendVote`. // - The implementation MUST be deterministic: every process that applies the same beacon to the same block // and round MUST return the same `app_hash`. // - Tenderdash may call it more than once for the same block, round and beacon; the Application MUST return @@ -583,10 +598,10 @@ message RequestFinalizeBlock { // // - On a validator, once the Prevotes of round _r_ for block _v_ reach the threshold and their signature is // recovered, before `ExtendVote` and before signing its Precommit for _v_. -// - On every path that finalizes a block from a commit it did not assemble itself (block sync, replay, a -// node that did not vote): after `ProcessProposal` of the committed block for the commit round, with the -// commit's beacon, and before `FinalizeBlock`. Tenderdash compares the returned `app_hash` with -// `Commit.app_hash` and stops on a mismatch. +// - On every path that finalizes a block from a commit (consensus, block sync, replay, a node that did not +// vote): after `ProcessProposal` of the committed block for the commit round, with the commit's beacon, and +// before `FinalizeBlock`. Tenderdash compares the returned `app_hash` with `Commit.app_hash` and stops on a +// mismatch. message RequestApplyBlockRandomness { bytes hash = 1; // The header hash of the block the Prevotes are for. int64 height = 2; // Height of the block. @@ -821,7 +836,8 @@ message ResponseFinalizeBlock { message ResponseApplyBlockRandomness { // The Merkle root hash of the application state after the randomness is applied. 32 bytes. - // Equals the header app hash when nothing in the block uses randomness. + // Equals the header app hash when nothing in the block uses randomness. The randomness changes + // nothing but this state: the other results of the block are the ones ProcessProposal returned. bytes app_hash = 1; } diff --git a/spec/abci++/abci++_methods.md b/spec/abci++/abci++_methods.md index 570dc4888a..82cf2affc6 100644 --- a/spec/abci++/abci++_methods.md +++ b/spec/abci++/abci++_methods.md @@ -459,6 +459,10 @@ When a validator _p_ enters Tendermint consensus round _r_, height _h_, in which round, to learn the vector a commit of that block and round must carry; see [VerifyVoteExtension](#verifyvoteextension). An ABCI error or an invalid response from this call is fatal, as on the Precommit path. + * From consensus version 2, Tenderdash calls [ApplyBlockRandomness](#applyblockrandomness) before + `ExtendVote`, but the extensions MUST NOT depend on the beacon or on the state `ApplyBlockRandomness` + produced: other processes verify them against the state `ProcessProposal` left, possibly before they + recover the round's beacon, or without ever recovering it. #### When does Tendermint call it? @@ -612,6 +616,12 @@ block. This includes commits the process assembled from its own +2/3 precommits. * The header keeps the app hash from `ProcessProposal`, which Prevotes sign. Precommits and the commit sign the returned app hash, and the commit carries it with the beacon (`Commit.app_hash`, `Commit.beacon`, and `CommitInfo.app_hash`, `CommitInfo.beacon` in `RequestFinalizeBlock`). + * The randomness may change only the application state behind `app_hash`. Transaction results, events, + validator set updates, consensus parameter updates and the other outputs of `ProcessProposal` are fixed by + the header the Prevotes signed: they MUST NOT depend on the beacon, and Tenderdash keeps the ones + `ProcessProposal` returned. + * Vote extensions and their verification MUST NOT depend on the beacon or on the state this call produces; + see [ExtendVote](#extendvote). * The implementation MUST be deterministic, and MUST return the same `app_hash` when called again for the same block, round and beacon. * An ABCI error is fatal, as for `ExtendVote`. @@ -620,9 +630,9 @@ block. This includes commits the process assembled from its own +2/3 precommits. * On a validator, once the Prevotes of round _r_ for block _v_ reach the threshold and their signature is recovered, before `ExtendVote` and before signing its Precommit for _v_. -* On every path that finalizes a block from a commit (block sync, replay, a node that did not vote): after - `ProcessProposal` of the committed block for the commit round, with the commit's beacon, and before - `FinalizeBlock`. Tenderdash compares the returned `app_hash` with the commit's and stops on a mismatch. +* On every path that finalizes a block from a commit (consensus, block sync, replay, a node that did not + vote): after `ProcessProposal` of the committed block for the commit round, with the commit's beacon, and + before `FinalizeBlock`. Tenderdash compares the returned `app_hash` with the commit's and stops on a mismatch. ### FinalizeBlock @@ -662,7 +672,13 @@ block. This includes commits the process assembled from its own +2/3 precommits. already passed on to the Application via `RequestPrepareProposal` or `RequestProcessProposal`. If the Application is in same-block execution mode, it applies the right candidate state here (rather than executing the whole block). In this case the Application disregards all parameters in - `RequestFinalizeBlock` except `RequestFinalizeBlock.hash`. + `RequestFinalizeBlock` except `RequestFinalizeBlock.hash` and, from consensus version 2, the + randomness fields below. + * From consensus version 2, the state to commit is the candidate state of the block for + `RequestFinalizeBlock.round` with `RequestFinalizeBlock.commit.beacon` applied, as + [ApplyBlockRandomness](#applyblockrandomness) applies it, and its Merkle root hash MUST equal + `RequestFinalizeBlock.commit.app_hash`. Committing the candidate state without the randomness diverges + from the rest of the network. #### When does Tendermint call it? @@ -848,14 +864,14 @@ enum VoteExtensionType { * **Fields**: - | Name | Type | Description | Field Number | - |---------------------------|------------------------------------------|----------------------------------------------------------------------------------------------|--------------| - | round | int32 | Commit round. Reflects the round at which the block proposer decided in the previous height. | 1 | - | quorum_hash | bytes | Quorum hash of a current height. | 2 | - | block_signature | bytes | Block signature. | 3 | - | threshold_vote_extensions | repeated [VoteExtension](#voteextension) | Threshold-recovered vote extensions of the commit. | 4 | - | beacon | bytes | Random beacon of the commit round. Set from consensus version 2; empty before. | 5 | - | app_hash | bytes | App hash the commit signs, returned by `ApplyBlockRandomness`. From consensus version 2. | 6 | + | Name | Type | Description | Field Number | + |---------------------------|-------------------------------------------------------------------|----------------------------------------------------------------------------------------------|--------------| + | round | int32 | Commit round. Reflects the round at which the block proposer decided in the previous height. | 1 | + | quorum_hash | bytes | Quorum hash of a current height. | 2 | + | block_signature | bytes | Block signature. | 3 | + | threshold_vote_extensions | repeated [VoteExtension](../../proto/tendermint/types/dash.proto) | Threshold-recovered vote extensions of the commit. | 4 | + | beacon | bytes | Random beacon of the commit round. Set from consensus version 2; empty before. | 5 | + | app_hash | bytes | App hash the commit signs, returned by `ApplyBlockRandomness`. From consensus version 2. | 6 | ### ExtendedCommitInfo diff --git a/spec/abci++/abci++_tmint_expected_behavior.md b/spec/abci++/abci++_tmint_expected_behavior.md index 0b4ddcc4c6..035eff9320 100644 --- a/spec/abci++/abci++_tmint_expected_behavior.md +++ b/spec/abci++/abci++_tmint_expected_behavior.md @@ -55,11 +55,12 @@ success-sync = offer-snapshot 1*apply-chunk recovery = info consensus-exec consensus-exec = (inf)consensus-height -consensus-height = *consensus-round 1*verify-commit decide commit +consensus-height = *consensus-round 1*check-commit [apply-randomness] decide commit +check-commit = [apply-randomness] verify-commit consensus-round = proposer / non-proposer proposer = *got-vote prepare-proposal *got-vote process-proposal [extend] -extend = *got-vote extend-vote *got-vote +extend = *got-vote [apply-randomness] extend-vote *got-vote non-proposer = *got-vote [process-proposal] [extend] init-chain = %s"" @@ -69,6 +70,7 @@ info = %s"" prepare-proposal = %s"" process-proposal = %s"" extend-vote = %s"" +apply-randomness = %s"" got-vote = %s"" verify-commit = %s"" decide = %s"" @@ -158,21 +160,26 @@ Let us now examine the grammar line by line, providing further details. completes successfully. During startup replay/catch-up, rejection of a stored commit instead terminates the run before `FinalizeBlock` and `Commit`, without retry; see the [VerifyVoteExtension REJECT paths](abci++_methods.md#verifyvoteextension). + From consensus version 2, Tenderdash applies the commit's beacon with `ApplyBlockRandomness` + (`apply-randomness`) before verifying a commit and again before `FinalizeBlock`, and the Application + commits the candidate state with that randomness applied. Before version 2 it never calls it. >```abnf ->consensus-height = *consensus-round 1*verify-commit decide commit +>consensus-height = *consensus-round 1*check-commit [apply-randomness] decide commit +>check-commit = [apply-randomness] verify-commit >consensus-round = proposer / non-proposer >``` * For every round, if the local process is the proposer of the current round, Tendermint starts by calling `PrepareProposal`, followed by `ProcessProposal`. Then, optionally, the Application is - asked to extend its vote for that round. Calls to `VerifyVoteExtension` can come at any time: the - local process may be slightly late in the current round, or votes may come from a future round - of this height. + asked to extend its vote for that round; from consensus version 2, `ApplyBlockRandomness` comes + first, with the beacon recovered from the round's Prevotes. Calls to `VerifyVoteExtension` can + come at any time: the local process may be slightly late in the current round, or votes may come + from a future round of this height. >```abnf >proposer = *got-vote prepare-proposal *got-vote process-proposal [extend] ->extend = *got-vote extend-vote *got-vote +>extend = *got-vote [apply-randomness] extend-vote *got-vote >``` * Also for every round, if the local process is _not_ the proposer of the current round, Tendermint @@ -197,6 +204,7 @@ Let us now examine the grammar line by line, providing further details. >prepare-proposal = %s"" >process-proposal = %s"" >extend-vote = %s"" +>apply-randomness = %s"" >got-vote = %s"" >verify-commit = %s"" >decide = %s"" diff --git a/spec/abci++/api.md b/spec/abci++/api.md index 1c7c30eed0..6dcba074a2 100644 --- a/spec/abci++/api.md +++ b/spec/abci++/api.md @@ -279,6 +279,12 @@ Applies the block's randomness and returns the app hash the Precommit signs. When nothing in the block uses randomness, `app_hash` equals the app hash of the block header. - The header keeps the app hash from `ProcessProposal`, which Prevotes sign. Precommits and the commit sign `ResponseApplyBlockRandomness.app_hash`, and the commit carries it in `Commit.app_hash`. +- The randomness may change only the application state behind `app_hash`. Transaction results, events, + validator set updates, consensus parameter updates and the other outputs of `ProcessProposal` are fixed + by the header the Prevotes signed: they MUST NOT depend on the beacon, and Tenderdash keeps the ones + `ProcessProposal` returned. +- Vote extensions and their verification MUST NOT depend on the beacon or on the state this call produces; + see `ExtendVote`. - The implementation MUST be deterministic: every process that applies the same beacon to the same block and round MUST return the same `app_hash`. - Tenderdash may call it more than once for the same block, round and beacon; the Application MUST return @@ -289,10 +295,10 @@ Applies the block's randomness and returns the app hash the Precommit signs. - On a validator, once the Prevotes of round _r_ for block _v_ reach the threshold and their signature is recovered, before `ExtendVote` and before signing its Precommit for _v_. -- On every path that finalizes a block from a commit it did not assemble itself (block sync, replay, a - node that did not vote): after `ProcessProposal` of the committed block for the commit round, with the - commit's beacon, and before `FinalizeBlock`. Tenderdash compares the returned `app_hash` with - `Commit.app_hash` and stops on a mismatch. +- On every path that finalizes a block from a commit (consensus, block sync, replay, a node that did not + vote): after `ProcessProposal` of the committed block for the commit round, with the commit's beacon, and + before `FinalizeBlock`. Tenderdash compares the returned `app_hash` with `Commit.app_hash` and stops on a + mismatch. | Field | Type | Label | Description | @@ -398,6 +404,10 @@ Extends a vote with application-side injection `VerifyVoteExtension` rejection that follows `ProcessProposal` of that block and round, to learn the vector a commit of that block and round must carry; see `VerifyVoteExtension`. An ABCI error or an invalid response from this call is fatal, as on the Precommit path. +- From consensus version 2, Tenderdash calls `ApplyBlockRandomness` before `ExtendVote`, but the extensions + MUST NOT depend on the beacon or on the state `ApplyBlockRandomness` produced: other processes verify them + against the state `ProcessProposal` left, possibly before they recover the round's beacon, or without ever + recovering it. #### When does Tenderdash call it? @@ -471,7 +481,12 @@ Finalize newly decided block. already passed on to the Application via `RequestPrepareProposal` or `RequestProcessProposal`. If the Application is in same-block execution mode, it applies the right candidate state here (rather than executing the whole block). In this case the Application disregards all parameters in - `RequestFinalizeBlock` except `RequestFinalizeBlock.hash`. + `RequestFinalizeBlock` except `RequestFinalizeBlock.hash` and, from consensus version 2, the + randomness fields below. +- From consensus version 2, the state to commit is the candidate state of the block for + `RequestFinalizeBlock.round` with `RequestFinalizeBlock.commit.beacon` applied, as `ApplyBlockRandomness` + applies it, and its Merkle root hash MUST equal `RequestFinalizeBlock.commit.app_hash`. Committing the + candidate state without the randomness diverges from the rest of the network. | Field | Type | Label | Description | @@ -938,7 +953,7 @@ block. This includes commits the process assembled from its own +2/3 precomm | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| app_hash | [bytes](#bytes) | | The Merkle root hash of the application state after the randomness is applied. 32 bytes. Equals the header app hash when nothing in the block uses randomness. | +| app_hash | [bytes](#bytes) | | The Merkle root hash of the application state after the randomness is applied. 32 bytes. Equals the header app hash when nothing in the block uses randomness. The randomness changes nothing but this state: the other results of the block are the ones ProcessProposal returned. | From 952361e161674321d81fceb0293daa83bdf512ee Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Wed, 4 Nov 2026 04:42:12 +0700 Subject: [PATCH 06/18] chore(abci): bump ABCISemVer to 1.5.0 The ABCI interface gained the ApplyBlockRandomness method and the CommitInfo beacon and app_hash fields. RELEASES.md makes interface changes a minor bump, and v1.8.0 to v1.8.2 already report 1.4.0, so an application built against these protos could not tell from RequestInfo.abci_version that a Tenderdash without them is too old. Refs dashpay/platform#4682 Co-Authored-By: Claude Opus 5.5 --- version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/version.go b/version/version.go index c5c9dd67a9..fe2023260a 100644 --- a/version/version.go +++ b/version/version.go @@ -11,7 +11,7 @@ const ( // when not using git describe. It is formatted with semantic versioning. TMVersionDefault = "1.8.2" // ABCISemVer is the semantic version of the ABCI library - ABCISemVer = "1.4.0" + ABCISemVer = "1.5.0" ABCIVersion = ABCISemVer ) From 720a335fbdb1cf610ce302b8569e4c294fa1d8be Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Wed, 4 Nov 2026 04:42:12 +0700 Subject: [PATCH 07/18] fix(types): keep the commit's randomness bytes out of the base commit reserve MaxCommitOverheadBytes had grown by the 132 bytes of a commit's beacon and app hash, but its only runtime use is the mempool's per-transaction size pre-check, and commits carry those fields only from consensus version 2. Before that, every chain lost 132 bytes of transaction size at CheckTx, and one with Block.MaxBytes between 1129 and 1260 refused every transaction while its proposals still had room. MaxCommitOverheadBytes is back to the commit without the fields, and the new MaxCommitRandomnessBytes holds them, for the consensus version 2 check to add. Commit.String, StringIndented and its log fields now show the beacon and the app hash, so two commits that differ only there can be told apart. TestCommitBeaconFields encodes and decodes Commit and CommitInfo on the wire and compares whole structs. Refs dashpay/platform#4682 Co-Authored-By: Claude Opus 5.5 --- internal/state/tx_filter_test.go | 2 +- node/node_test.go | 2 +- types/block.go | 18 ++++++++++++++---- types/block_test.go | 30 +++++++++++++++++++++++------- 4 files changed, 39 insertions(+), 13 deletions(-) diff --git a/internal/state/tx_filter_test.go b/internal/state/tx_filter_test.go index ef1e833f09..3456fed3b1 100644 --- a/internal/state/tx_filter_test.go +++ b/internal/state/tx_filter_test.go @@ -15,7 +15,7 @@ import ( func TestTxFilter(t *testing.T) { const maxBlockBytes = 3241 - maxTxSize := maxBlockBytes - 1264 + maxTxSize := maxBlockBytes - 1132 genDoc := factory.MinimalGenesisDoc() genDoc.ConsensusParams.Block.MaxBytes = maxBlockBytes genDoc.ConsensusParams.Evidence.MaxBytes = 1500 diff --git a/node/node_test.go b/node/node_test.go index ce33a25126..96ac662944 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -875,7 +875,7 @@ func TestMaxProposalBlockSize(t *testing.T) { // require that the header and commit be the max possible size require.Equal(t, types.MaxHeaderBytes, int64(pb.Header.Size())) - require.Equal(t, types.MaxCommitOverheadBytes, int64(pb.LastCommit.Size())) + require.Equal(t, types.MaxCommitOverheadBytes+types.MaxCommitRandomnessBytes, int64(pb.LastCommit.Size())) // make sure that the block is less than the max possible size assert.Equal(t, int64(1248+cfg.Mempool.MaxTxBytes), int64(pb.Size())) // because of the proto overhead we expect the part set bytes to be equal or diff --git a/types/block.go b/types/block.go index 46af9e1588..3e163cabec 100644 --- a/types/block.go +++ b/types/block.go @@ -762,9 +762,11 @@ const ( const ( // MaxCommitOverheadBytes is the max size of commit, with overhead but without vote extensions: // (110+2) for BlockID, (8+2) for Height, (4+2) for Round, - // (32+2) for QuorumHash, (96+2) for Block signature, - // (96+2) for Beacon, (32+2) for AppHash. - MaxCommitOverheadBytes int64 = (110 + 2) + (8 + 2) + (4 + 2) + (32 + 2) + (96 + 2) + (96 + 2) + (32 + 2) + 0 + // (32+2) for QuorumHash, (96+2) for Block signature. + MaxCommitOverheadBytes int64 = (110 + 2) + (8 + 2) + (4 + 2) + (32 + 2) + (96 + 2) + 0 + // MaxCommitRandomnessBytes is what a commit grows by when it carries a random beacon (consensus + // version 2): (96+2) for Beacon, (32+2) for AppHash. + MaxCommitRandomnessBytes int64 = (96 + 2) + (32 + 2) ) //------------------------------------- @@ -998,12 +1000,14 @@ func (commit *Commit) String() string { return "nil-Commit" } return fmt.Sprintf( - `Commit{H: %d, R: %d, BlockID: %v, QuorumHash %v, BlockSignature: %v}#%v`, + `Commit{H: %d, R: %d, BlockID: %v, QuorumHash %v, BlockSignature: %v, Beacon: %v, AppHash: %v}#%v`, commit.Height, commit.Round, commit.BlockID, commit.QuorumHash, base64.StdEncoding.EncodeToString(commit.ThresholdBlockSignature), + base64.StdEncoding.EncodeToString(commit.Beacon), + commit.AppHash, commit.hash) } @@ -1017,11 +1021,15 @@ func (commit *Commit) StringIndented(indent string) string { %s Round: %d %s BlockID: %v %s BlockSignature: %v +%s Beacon: %v +%s AppHash: %v %s}#%v`, indent, commit.Height, indent, commit.Round, indent, commit.BlockID, indent, base64.StdEncoding.EncodeToString(commit.ThresholdBlockSignature), + indent, base64.StdEncoding.EncodeToString(commit.Beacon), + indent, commit.AppHash, indent, commit.hash) } @@ -1032,6 +1040,8 @@ func (commit *Commit) MarshalZerologObject(e *zerolog.Event) { e.Int32("round", commit.Round) e.Str("BlockID.Hash", commit.BlockID.Hash.String()) e.Str("BlockSignature", hex.EncodeToString(commit.ThresholdBlockSignature)) + e.Str("Beacon", hex.EncodeToString(commit.Beacon)) + e.Str("AppHash", commit.AppHash.String()) } } diff --git a/types/block_test.go b/types/block_test.go index a7a586cafb..b736aced6f 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -18,6 +18,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + abci "github.com/dashpay/tenderdash/abci/types" "github.com/dashpay/tenderdash/crypto" "github.com/dashpay/tenderdash/crypto/bls12381" "github.com/dashpay/tenderdash/crypto/merkle" @@ -314,8 +315,9 @@ func TestCommit(t *testing.T) { assert.True(t, commit.IsCommit()) } -// TestCommitBeaconFields checks that the beacon and the app hash of a commit survive the protobuf -// round trip and reach the CommitInfo passed to the application. +// TestCommitBeaconFields checks that the beacon and the app hash of a commit survive protobuf +// encoding and decoding, reach the CommitInfo passed to the application, and show in the commit's +// string form. func TestCommitBeaconFields(t *testing.T) { commit := &Commit{ Height: 3, @@ -331,14 +333,25 @@ func TestCommitBeaconFields(t *testing.T) { AppHash: crypto.Checksum([]byte("final app hash")), } - decoded, err := CommitFromProto(commit.ToProto()) + bz, err := commit.ToProto().Marshal() require.NoError(t, err) - assert.Equal(t, commit.Beacon, decoded.Beacon) - assert.Equal(t, commit.AppHash, decoded.AppHash) + var pb tmproto.Commit + require.NoError(t, pb.Unmarshal(bz)) + decoded, err := CommitFromProto(&pb) + require.NoError(t, err) + require.Equal(t, commit, decoded) info := commit.ToCommitInfo() assert.Equal(t, commit.Beacon, info.Beacon) assert.EqualValues(t, commit.AppHash, info.AppHash) + bz, err = info.Marshal() + require.NoError(t, err) + var decodedInfo abci.CommitInfo + require.NoError(t, decodedInfo.Unmarshal(bz)) + require.Equal(t, info, decodedInfo) + + assert.Contains(t, commit.String(), commit.AppHash.String()) + assert.Contains(t, commit.StringIndented(""), commit.AppHash.String()) } func TestCommitValidateBasic(t *testing.T) { @@ -393,7 +406,10 @@ func TestMaxCommitBytes(t *testing.T) { pb := commit.ToProto() pbSize := int64(pb.Size()) - assert.EqualValues(t, MaxCommitOverheadBytes, pbSize) + assert.EqualValues(t, MaxCommitOverheadBytes+MaxCommitRandomnessBytes, pbSize) + + commit.Beacon, commit.AppHash = nil, nil + assert.EqualValues(t, MaxCommitOverheadBytes, commit.ToProto().Size()) } func TestHeaderHash(t *testing.T) { @@ -624,7 +640,7 @@ func TestBlockMaxDataBytes(t *testing.T) { func TestBlockMaxDataBytesNoEvidence(t *testing.T) { // minBlockSize is minimum correct size of a block - const minBlockSize = 1261 + const minBlockSize = 1129 testCases := []struct { maxBytes int64 From c0e8c7f451414e8ec6c319ead45a9c76e3f56c9a Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Wed, 4 Nov 2026 04:42:12 +0700 Subject: [PATCH 08/18] test(abci): cover ApplyBlockRandomness in the routed and proxy clients TestRouting routes ApplyBlockRandomness to its configured client and checks the response type, and TestApplyBlockRandomnessMetrics checks that the proxy client records the call under apply_block_randomness, for success and failure. Refs dashpay/platform#4682 Co-Authored-By: Claude Opus 5.5 --- abci/client/routed_client_test.go | 10 ++++++++++ internal/proxy/client_test.go | 30 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/abci/client/routed_client_test.go b/abci/client/routed_client_test.go index 99883da542..b2fa440f86 100644 --- a/abci/client/routed_client_test.go +++ b/abci/client/routed_client_test.go @@ -25,6 +25,7 @@ import ( // * when a request of type FinalizeBlock is made, it should be first routed to queryApp, then to consensusApp // * when a request of type CheckTx is made, it should be routed to queryApp // * when a request of type PrepareProposal is made, it should be routed to to consensusApp +// * when a request of type ApplyBlockRandomness is made, it should be routed to consensusApp func TestRouting(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -64,10 +65,14 @@ func TestRouting(t *testing.T) { consensusApp.On("FinalizeBlock", mock.Anything, mock.Anything).Return(&types.ResponseFinalizeBlock{ RetainHeight: 1, }, nil).Once() + consensusApp.On("ApplyBlockRandomness", mock.Anything, mock.Anything).Return(&types.ResponseApplyBlockRandomness{ + AppHash: []byte("final apphash"), + }, nil).Once() addr := fmt.Sprintf("CheckTx:socket:%s", querySocket) + fmt.Sprintf(",FinalizeBlock:socket:%s,FinalizeBlock:socket:%s", querySocket, consensusSocket) + fmt.Sprintf(",PrepareProposal:socket:%s", consensusSocket) + + fmt.Sprintf(",ApplyBlockRandomness:socket:%s", consensusSocket) + fmt.Sprintf(",*:socket:%s", defaultSocket) logger.Info("configuring routed abci client with address", "addr", addr) @@ -101,6 +106,11 @@ func TestRouting(t *testing.T) { _, err = routedClient.PrepareProposal(ctx, &types.RequestPrepareProposal{}) assert.NoError(t, err) + // ApplyBlockRandomness + randomness, err := routedClient.ApplyBlockRandomness(ctx, &types.RequestApplyBlockRandomness{}) + assert.NoError(t, err) + assert.EqualValues(t, "final apphash", randomness.AppHash) + // unlock info assert.False(t, infoExecuted) infoMtx.Unlock() diff --git a/internal/proxy/client_test.go b/internal/proxy/client_test.go index 8821ef7ea5..d14d0cd131 100644 --- a/internal/proxy/client_test.go +++ b/internal/proxy/client_test.go @@ -285,6 +285,36 @@ func TestFailureMetrics(t *testing.T) { assert.Equal(t, 2, hst.count["method=check_tx,type=sync,success=true"]) } +// TestApplyBlockRandomnessMetrics checks that the proxy client forwards ApplyBlockRandomness and records +// its timing under the apply_block_randomness method. +func TestApplyBlockRandomnessMetrics(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + logger := log.NewTestingLogger(t) + mtr := mockMetrics() + hst := mtr.MethodTiming.(*mockMetric) + + app := mocks.NewApplication(t) + app.On("ApplyBlockRandomness", mock.Anything, mock.Anything). + Return(&types.ResponseApplyBlockRandomness{AppHash: []byte("final apphash")}, nil).Once() + app.On("ApplyBlockRandomness", mock.Anything, mock.Anything). + Return(nil, errors.New("some error")).Once() + + proxy := New(abciclient.NewLocalClient(logger, app), log.NewNopLogger(), mtr) + + res, err := proxy.ApplyBlockRandomness(ctx, &types.RequestApplyBlockRandomness{}) + require.NoError(t, err) + assert.EqualValues(t, "final apphash", res.AppHash) + _, err = proxy.ApplyBlockRandomness(ctx, &types.RequestApplyBlockRandomness{}) + assert.Error(t, err) + + cancel() + proxy.Wait() + assert.Equal(t, 1, hst.count["method=apply_block_randomness,type=sync,success=true"]) + assert.Equal(t, 1, hst.count["method=apply_block_randomness,type=sync,success=false"]) +} + func mockMetrics() *Metrics { return &Metrics{ MethodTiming: &mockMetric{ From 3bd58e3d0072a9c328f542a5ee962c76014712b7 Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Wed, 4 Nov 2026 15:30:05 +0700 Subject: [PATCH 09/18] fix(types): split a block into fields as the generated decoder does when dropping mistyped commit fields The fallback in UnmarshalBlockProto drops a LastCommit's beacon and app hash fields that do not have the bytes wire type, so an upgraded node decodes every block an older one does. It split the bytes with protowire, which refuses encodings the generated decoder of older releases skips: a group closed by an end-group of another field number, and a ten-byte varint whose last byte overflows 64 bits. A proposer could then send a block that older validators accept and upgraded ones cannot decode. The scanner now reads tags, varints and skipped fields with the rules of the code gogoproto generates. The test checks each case against gogotypes.Empty, whose generated decoder skips every field as older releases skip fields 7 and 8, both for blocks it accepts and for blocks it still refuses. Co-Authored-By: Claude Opus 5.5 --- types/block_decode.go | 122 +++++++++++++++++++++++++++++++------ types/block_decode_test.go | 26 +++++++- 2 files changed, 127 insertions(+), 21 deletions(-) diff --git a/types/block_decode.go b/types/block_decode.go index fc5df68593..b245106e5c 100644 --- a/types/block_decode.go +++ b/types/block_decode.go @@ -42,30 +42,28 @@ func UnmarshalBlockProto(bz []byte) (*tmproto.Block, error) { // dropMistypedLastCommitRandomness returns the block bytes bz without the occurrences of the // LastCommit beacon and app hash fields that do not have the bytes wire type, and whether there were -// any. It returns false for bytes it cannot parse. +// any. It splits the bytes into fields as the generated decoder does, and returns false where that +// decoder fails. func dropMistypedLastCommitRandomness(bz []byte) ([]byte, bool) { out := make([]byte, 0, len(bz)) dropped := false for len(bz) > 0 { - num, typ, n := protowire.ConsumeTag(bz) - if n < 0 { + num, typ, n, ok := consumeGeneratedField(bz) + if !ok { return nil, false } - m := protowire.ConsumeFieldValue(num, typ, bz[n:]) - if m < 0 { - return nil, false - } - field := bz[:n+m] + field := bz[:n] if num == blockLastCommitField && typ == protowire.BytesType { - commit, _ := protowire.ConsumeBytes(bz[n:]) - cleaned, ok := dropMistypedCommitRandomness(commit) + _, tagLen, _ := consumeGeneratedVarint(field) + _, lenLen, _ := consumeGeneratedVarint(field[tagLen:]) + cleaned, ok := dropMistypedCommitRandomness(field[tagLen+lenLen:]) if ok { dropped = true field = protowire.AppendBytes(protowire.AppendTag(nil, num, typ), cleaned) } } out = append(out, field...) - bz = bz[n+m:] + bz = bz[n:] } return out, dropped } @@ -76,20 +74,106 @@ func dropMistypedCommitRandomness(bz []byte) ([]byte, bool) { out := make([]byte, 0, len(bz)) dropped := false for len(bz) > 0 { - num, typ, n := protowire.ConsumeTag(bz) - if n < 0 { - return nil, false - } - m := protowire.ConsumeFieldValue(num, typ, bz[n:]) - if m < 0 { + num, typ, n, ok := consumeGeneratedField(bz) + if !ok { return nil, false } if (num == commitBeaconField || num == commitAppHashField) && typ != commitRandomnessWType { dropped = true } else { - out = append(out, bz[:n+m]...) + out = append(out, bz[:n]...) } - bz = bz[n+m:] + bz = bz[n:] } return out, dropped } + +// consumeGeneratedField returns the number, the wire type and the length, tag included, of the field at +// the start of bz, as the Unmarshal methods that gogoproto generates read a field they skip: the +// field number is the tag shifted right by 3 and truncated to 32 bits. It returns false where those +// methods fail. +// +// Releases before the beacon skip fields 7 and 8 of a commit with these rules, which accept more than +// protowire does, so the bytes must be split with the same rules to drop exactly those fields. +func consumeGeneratedField(bz []byte) (protowire.Number, protowire.Type, int, bool) { + tag, _, ok := consumeGeneratedVarint(bz) + if !ok { + return 0, 0, 0, false + } + num, typ := protowire.Number(int32(tag>>3)), protowire.Type(tag&0x7) + if typ == protowire.EndGroupType || num <= 0 { + return 0, 0, 0, false + } + n, ok := skipGeneratedField(bz) + if !ok || n > len(bz) { + return 0, 0, 0, false + } + return num, typ, n, true +} + +// skipGeneratedField returns the length, tag included, of the field at the start of bz, computed as +// the skip functions that gogoproto generates compute it. The length may exceed len(bz), which the +// caller checks. A group ends at the first end-group tag that brings the nesting depth back to zero, +// whatever its field number. +func skipGeneratedField(bz []byte) (int, bool) { + i, depth := 0, 0 + for i < len(bz) { + tag, n, ok := consumeGeneratedVarint(bz[i:]) + if !ok { + return 0, false + } + i += n + switch protowire.Type(tag & 0x7) { + case protowire.VarintType: + _, n, ok := consumeGeneratedVarint(bz[i:]) + if !ok { + return 0, false + } + i += n + case protowire.Fixed64Type: + i += 8 + case protowire.BytesType: + length, n, ok := consumeGeneratedVarint(bz[i:]) + if !ok || int(length) < 0 { + return 0, false + } + i += n + int(length) + case protowire.StartGroupType: + depth++ + case protowire.EndGroupType: + if depth == 0 { + return 0, false + } + depth-- + case protowire.Fixed32Type: + i += 4 + default: + return 0, false + } + if i < 0 { + return 0, false + } + if depth == 0 { + return i, true + } + } + return 0, false +} + +// consumeGeneratedVarint reads the varint at the start of bz as the code that gogoproto generates +// does, and returns it with its length. Unlike protowire, it drops the bits of a tenth byte past the +// 64th instead of failing. +func consumeGeneratedVarint(bz []byte) (uint64, int, bool) { + var v uint64 + for i, shift := 0, uint(0); shift < 64; i, shift = i+1, shift+7 { + if i >= len(bz) { + return 0, 0, false + } + b := bz[i] + v |= uint64(b&0x7F) << shift + if b < 0x80 { + return v, i + 1, true + } + } + return 0, 0, false +} diff --git a/types/block_decode_test.go b/types/block_decode_test.go index 0192cf9d05..ab71d50617 100644 --- a/types/block_decode_test.go +++ b/types/block_decode_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/cosmos/gogoproto/proto" + gogotypes "github.com/cosmos/gogoproto/types" "github.com/stretchr/testify/require" "github.com/dashpay/tenderdash/crypto" @@ -32,12 +33,21 @@ func TestUnmarshalBlockProtoMistypedLastCommitRandomness(t *testing.T) { require.True(t, proto.Equal(pb, plain), "a block without such fields decodes as with proto.Unmarshal") // Each suffix is another occurrence of last_commit (field 4), which protobuf merges into the first. + // Releases before the beacon read its content as a message that knows none of its fields, which + // gogotypes.Empty stands for: their generated decoder skips fields 7 and 8 as Empty's does. for name, suffix := range map[string][]byte{ "beacon as varint": {0x22, 0x02, 0x38, 0x01}, // field 7, wire type 0 "app hash as fixed32": {0x22, 0x05, 0x45, 0x01, 0x02, 0x03, 0x04}, // field 8, wire type 5 "beacon as fixed64": {0x22, 0x09, 0x39, 1, 2, 3, 4, 5, 6, 7, 8}, // field 7, wire type 1 + // field 7 start-group closed by a field 8 end-group: the generated skip does not match them + "beacon as group closed by app hash": {0x22, 0x02, 0x3b, 0x44}, + // field 7, wire type 0, a ten-byte varint whose last byte overflows 64 bits + "beacon as overflowing varint": {0x22, 0x0b, 0x38, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x02}, + // field 8 group holding a varint and an empty field 7 group + "app hash as nested group": {0x22, 0x06, 0x43, 0x08, 0x01, 0x3b, 0x3c, 0x44}, } { t.Run(name, func(t *testing.T) { + require.NoError(t, new(gogotypes.Empty).Unmarshal(suffix[2:]), "releases before the beacon accept it") raw := append(append([]byte{}, bz...), suffix...) var strict tmproto.Block require.Error(t, proto.Unmarshal(raw, &strict), "strict decoding refuses it") @@ -51,6 +61,18 @@ func TestUnmarshalBlockProtoMistypedLastCommitRandomness(t *testing.T) { }) } - _, err = UnmarshalBlockProto(append(append([]byte{}, bz...), 0x22, 0x05, 0x38)) - require.Error(t, err, "truncated bytes still fail") + for name, suffix := range map[string][]byte{ + "truncated": {0x22, 0x05, 0x38}, + "end-group without start": {0x22, 0x01, 0x3c}, + "unclosed group": {0x22, 0x01, 0x3b}, + "end-group past the group": {0x22, 0x03, 0x3b, 0x3c, 0x44}, + // field 7, wire type 0, an eleven-byte varint + "varint past ten bytes": {0x22, 0x0c, 0x38, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01}, + } { + t.Run(name, func(t *testing.T) { + require.Error(t, new(gogotypes.Empty).Unmarshal(suffix[2:]), "releases before the beacon refuse it") + _, err := UnmarshalBlockProto(append(append([]byte{}, bz...), suffix...)) + require.Error(t, err, "still refused") + }) + } } From 774a2545b5554ba31e0c4f4c6655b874cea1d279 Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Wed, 4 Nov 2026 15:30:06 +0700 Subject: [PATCH 10/18] fix(state): pass the last commit's beacon and app hash in proposal requests buildLastCommitInfo built RequestPrepareProposal.LocalLastCommit and RequestProcessProposal.ProposedLastCommit field by field and left out the commit's beacon and app hash. It now keeps its initial-height guard and delegates to Commit.ToCommitInfo. Co-Authored-By: Claude Opus 5.5 --- internal/state/execution.go | 7 +--- internal/state/execution_test.go | 66 ++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 6 deletions(-) diff --git a/internal/state/execution.go b/internal/state/execution.go index c196489fe6..198b65220e 100644 --- a/internal/state/execution.go +++ b/internal/state/execution.go @@ -775,12 +775,7 @@ func buildLastCommitInfo(block *types.Block, initialHeight int64) abci.CommitInf // return an empty value. return abci.CommitInfo{} } - return abci.CommitInfo{ - Round: block.LastCommit.Round, - QuorumHash: block.LastCommit.QuorumHash, - BlockSignature: block.LastCommit.ThresholdBlockSignature, - ThresholdVoteExtensions: block.LastCommit.ThresholdVoteExtensions, - } + return block.LastCommit.ToCommitInfo() } // Update returns a copy of state with the fields set using the arguments passed in. diff --git a/internal/state/execution_test.go b/internal/state/execution_test.go index f876aabb4c..8c9faf448d 100644 --- a/internal/state/execution_test.go +++ b/internal/state/execution_test.go @@ -898,6 +898,72 @@ func TestEmptyPrepareProposal(t *testing.T) { require.NoError(t, err) } +// TestProposalRequestsCarryLastCommitRandomness checks that PrepareProposal and ProcessProposal pass +// the last commit's beacon and app hash to the application, with its other fields. +func TestProposalRequestsCarryLastCommitRandomness(t *testing.T) { + const height = 2 + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + logger := log.NewNopLogger() + + eventBus := eventbus.NewDefault(logger) + require.NoError(t, eventBus.Start(ctx)) + state, stateDB, privVals := makeState(t, 1, height) + + var prepareReq *abci.RequestPrepareProposal + var processReq *abci.RequestProcessProposal + app := abcimocks.NewApplication(t) + app.On("PrepareProposal", mock.Anything, mock.Anything).Run(func(args mock.Arguments) { + prepareReq = args.Get(1).(*abci.RequestPrepareProposal) + }).Return(&abci.ResponsePrepareProposal{ + AppHash: make([]byte, crypto.DefaultAppHashSize), AppVersion: 1, + }, nil) + app.On("ProcessProposal", mock.Anything, mock.Anything).Run(func(args mock.Arguments) { + processReq = args.Get(1).(*abci.RequestProcessProposal) + }).Return(&abci.ResponseProcessProposal{ + AppHash: make([]byte, crypto.DefaultAppHashSize), + Status: abci.ResponseProcessProposal_ACCEPT, + }, nil) + cc := abciclient.NewLocalClient(logger, app) + proxyApp := proxy.New(cc, logger, proxy.NopMetrics()) + require.NoError(t, proxyApp.Start(ctx)) + + mp := &mpmocks.Mempool{} + mp.On("ReapMaxBytesMaxGas", mock.Anything, mock.Anything).Return(types.Txs{}) + + blockExec := sm.NewBlockExecutor( + sm.NewStore(stateDB), + proxyApp, + mp, + sm.EmptyEvidencePool{}, + nil, + eventBus, + ) + proposer := state.Validators.GetByIndex(0) + commit, _ := makeValidCommit(ctx, t, height, types.BlockID{}, state.Validators, privVals) + commit.Beacon = crypto.CRandBytes(bls12381.SignatureSize) + commit.AppHash = crypto.CRandBytes(crypto.DefaultAppHashSize) + expected := abci.CommitInfo{ + Round: commit.Round, + QuorumHash: commit.QuorumHash, + BlockSignature: commit.ThresholdBlockSignature, + ThresholdVoteExtensions: commit.ThresholdVoteExtensions, + Beacon: commit.Beacon, + AppHash: commit.AppHash, + } + + block, _, err := blockExec.CreateProposalBlock(ctx, height, 0, state, commit, proposer.ProTxHash, 0) + require.NoError(t, err) + require.NotNil(t, prepareReq) + assert.Equal(t, expected, prepareReq.LocalLastCommit) + + _, err = blockExec.ProcessProposal(ctx, block, 0, state, false, types.VerifiedCommit{}) + require.NoError(t, err) + require.NotNil(t, processReq) + assert.Equal(t, expected, processReq.ProposedLastCommit) +} + // TestPrepareProposalErrorOnNonExistingRemoved tests that the block creation logic returns // an error if the ResponsePrepareProposal returned from the application marks // From 5a2eff50356a300018ed71e2e966193ccb77c645 Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Wed, 4 Nov 2026 15:33:53 +0700 Subject: [PATCH 11/18] chore(types): mark the block decoder's wrapping conversions for gosec The fallback scanner truncates the field number to 32 bits and reads a length into an int that may wrap, as the code gogoproto generates does; gosec flagged both as G115. The conversions must stay as they are, so they carry nolint comments with the reason. Co-Authored-By: Claude Opus 5.5 --- types/block_decode.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/types/block_decode.go b/types/block_decode.go index b245106e5c..9d5bc017a6 100644 --- a/types/block_decode.go +++ b/types/block_decode.go @@ -100,7 +100,7 @@ func consumeGeneratedField(bz []byte) (protowire.Number, protowire.Type, int, bo if !ok { return 0, 0, 0, false } - num, typ := protowire.Number(int32(tag>>3)), protowire.Type(tag&0x7) + num, typ := protowire.Number(int32(tag>>3)), protowire.Type(tag&0x7) //nolint:gosec // truncated as generated code does if typ == protowire.EndGroupType || num <= 0 { return 0, 0, 0, false } @@ -134,10 +134,11 @@ func skipGeneratedField(bz []byte) (int, bool) { i += 8 case protowire.BytesType: length, n, ok := consumeGeneratedVarint(bz[i:]) - if !ok || int(length) < 0 { + size := int(length) //nolint:gosec // wraps as the int length of generated code does + if !ok || size < 0 { return 0, false } - i += n + int(length) + i += n + size case protowire.StartGroupType: depth++ case protowire.EndGroupType: From 2be9a72a55383ab13665fe847188bda3a12ebf63 Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Wed, 4 Nov 2026 18:35:38 +0700 Subject: [PATCH 12/18] fix(state): drop a relayed commit's beacon and app hash from proposals A peer can add a correctly sized beacon and app hash to a validly signed commit: neither is covered by the commit's hash or threshold signature, so the commit is accepted and becomes the next proposal's LastCommit. Releases before the beacon drop both fields when they decode a block, and block sync rebuilds the block's parts from what it decoded, so they could not block sync a block an honest proposer built from that commit. CreateProposalBlock now drops both fields from the commit it is given, through the new Commit.WithoutRandomBeacon, which copies the commit rather than changing it. Co-Authored-By: Claude Opus 5.5 --- internal/state/execution.go | 5 +++ internal/state/execution_test.go | 76 ++++++++++++++++++++++++++++++-- types/block.go | 14 ++++++ 3 files changed, 92 insertions(+), 3 deletions(-) diff --git a/internal/state/execution.go b/internal/state/execution.go index 198b65220e..2b4388a3a1 100644 --- a/internal/state/execution.go +++ b/internal/state/execution.go @@ -233,6 +233,11 @@ func (blockExec *BlockExecutor) CreateProposalBlock( maxBytes := state.ConsensusParams.Block.MaxBytes maxGas := state.ConsensusParams.Block.MaxGas + // The commit may come from a peer, which can set its beacon and app hash: they are empty before + // consensus version 2, and releases before them drop them when they decode a block, so block sync + // on those releases would rebuild a block that carried them into parts the next commit does not sign. + commit = commit.WithoutRandomBeacon() + evidence, evSize := blockExec.evpool.PendingEvidence(state.ConsensusParams.Evidence.MaxBytes) // Fetch a limited amount of valid txs diff --git a/internal/state/execution_test.go b/internal/state/execution_test.go index 8c9faf448d..4f5a028203 100644 --- a/internal/state/execution_test.go +++ b/internal/state/execution_test.go @@ -898,8 +898,10 @@ func TestEmptyPrepareProposal(t *testing.T) { require.NoError(t, err) } -// TestProposalRequestsCarryLastCommitRandomness checks that PrepareProposal and ProcessProposal pass -// the last commit's beacon and app hash to the application, with its other fields. +// TestProposalRequestsCarryLastCommitRandomness checks that ProcessProposal passes the beacon and app +// hash of the proposed block's last commit to the application, with its other fields, and that +// PrepareProposal passes the other fields of the commit the proposer was given, whose beacon and app +// hash it drops (see TestProposalDropsRelayedCommitRandomness). func TestProposalRequestsCarryLastCommitRandomness(t *testing.T) { const height = 2 ctx, cancel := context.WithCancel(context.Background()) @@ -956,14 +958,82 @@ func TestProposalRequestsCarryLastCommitRandomness(t *testing.T) { block, _, err := blockExec.CreateProposalBlock(ctx, height, 0, state, commit, proposer.ProTxHash, 0) require.NoError(t, err) require.NotNil(t, prepareReq) - assert.Equal(t, expected, prepareReq.LocalLastCommit) + withoutRandomness := expected + withoutRandomness.Beacon, withoutRandomness.AppHash = nil, nil + assert.Equal(t, withoutRandomness, prepareReq.LocalLastCommit) + block.LastCommit = commit _, err = blockExec.ProcessProposal(ctx, block, 0, state, false, types.VerifiedCommit{}) require.NoError(t, err) require.NotNil(t, processReq) assert.Equal(t, expected, processReq.ProposedLastCommit) } +// TestProposalDropsRelayedCommitRandomness is the regression test for a peer relaying a validly +// signed commit with a correctly sized beacon and app hash added: neither is covered by the commit's +// hash or threshold signature, so the commit is accepted and becomes the next proposal's LastCommit. +// Releases before the beacon drop both fields when they decode a block, and block sync rebuilds the +// parts of the block from what it decoded, so a proposal that kept them could not be block synced by +// those releases. The proposer drops them instead. +func TestProposalDropsRelayedCommitRandomness(t *testing.T) { + const height = 2 + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + logger := log.NewNopLogger() + + eventBus := eventbus.NewDefault(logger) + require.NoError(t, eventBus.Start(ctx)) + state, stateDB, privVals := makeState(t, 1, height) + + var prepareReq *abci.RequestPrepareProposal + app := abcimocks.NewApplication(t) + app.On("PrepareProposal", mock.Anything, mock.Anything).Run(func(args mock.Arguments) { + prepareReq = args.Get(1).(*abci.RequestPrepareProposal) + }).Return(&abci.ResponsePrepareProposal{ + AppHash: make([]byte, crypto.DefaultAppHashSize), AppVersion: 1, + }, nil) + cc := abciclient.NewLocalClient(logger, app) + proxyApp := proxy.New(cc, logger, proxy.NopMetrics()) + require.NoError(t, proxyApp.Start(ctx)) + + mp := &mpmocks.Mempool{} + mp.On("ReapMaxBytesMaxGas", mock.Anything, mock.Anything).Return(types.Txs{}) + + blockExec := sm.NewBlockExecutor(sm.NewStore(stateDB), proxyApp, mp, sm.EmptyEvidencePool{}, nil, eventBus) + proposer := state.Validators.GetByIndex(0) + commit, _ := makeValidCommit(ctx, t, height, factory.MakeBlockID(), state.Validators, privVals) + beacon := crypto.CRandBytes(bls12381.SignatureSize) + appHash := crypto.CRandBytes(crypto.DefaultAppHashSize) + commit.Beacon, commit.AppHash = beacon, appHash + relayed, err := types.CommitFromProto(commit.ToProto()) + require.NoError(t, err) + require.Equal(t, commit.Hash(), relayed.Hash(), "the beacon and app hash are not part of the commit hash") + + block, _, err := blockExec.CreateProposalBlock(ctx, height, 0, state, relayed, proposer.ProTxHash, 0) + require.NoError(t, err) + assert.Empty(t, block.LastCommit.Beacon) + assert.Empty(t, block.LastCommit.AppHash) + require.NotNil(t, prepareReq) + assert.Empty(t, prepareReq.LocalLastCommit.Beacon) + assert.Empty(t, prepareReq.LocalLastCommit.AppHash) + assert.Equal(t, beacon, relayed.Beacon, "the relayed commit is not changed") + assert.EqualValues(t, appHash, relayed.AppHash, "the relayed commit is not changed") + + // A release before the beacon decodes the block without fields 7 and 8 of its LastCommit, and + // block sync checks the parts it rebuilds from that block against the next commit's BlockID. + parts, err := block.MakePartSet(types.BlockPartSizeBytes) + require.NoError(t, err) + pb, err := block.ToProto() + require.NoError(t, err) + pb.LastCommit.Beacon, pb.LastCommit.AppHash = nil, nil + legacy, err := types.BlockFromProto(pb) + require.NoError(t, err) + legacyParts, err := legacy.MakePartSet(types.BlockPartSizeBytes) + require.NoError(t, err) + assert.Equal(t, parts.Header(), legacyParts.Header()) +} + // TestPrepareProposalErrorOnNonExistingRemoved tests that the block creation logic returns // an error if the ResponsePrepareProposal returned from the application marks // diff --git a/types/block.go b/types/block.go index 3e163cabec..e6217b3eb9 100644 --- a/types/block.go +++ b/types/block.go @@ -839,6 +839,20 @@ func (commit *Commit) ToCommitInfo() types.CommitInfo { } } +// WithoutRandomBeacon returns commit without its random beacon and app hash. Before consensus version 2 +// both fields must be empty, but neither is covered by the commit's threshold signature, so a peer could +// fill them; nodes drop them from commits of such heights instead of storing or passing them on. It +// returns commit itself when both are already empty. +func (commit *Commit) WithoutRandomBeacon() *Commit { + if commit == nil || (len(commit.Beacon) == 0 && len(commit.AppHash) == 0) { + return commit + } + stripped := *commit + stripped.Beacon = nil + stripped.AppHash = nil + return &stripped +} + // GetCanonicalVote returns the message that is being voted on in the form of a vote without signatures. // It returns an error if the commit carries a vote extension of an unknown type. func (commit *Commit) GetCanonicalVote() (*Vote, error) { From 2c9287da81e1c963da24b06d3c63dfb3e356b39f Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Wed, 4 Nov 2026 19:21:34 +0700 Subject: [PATCH 13/18] test(node): expect proposals to drop the commit's beacon and app hash TestMaxProposalBlockSize gives CreateProposalBlock a commit with a beacon and an app hash, which the proposal now drops, so its LastCommit and the block are back to their sizes without them. Co-Authored-By: Claude Opus 5.5 --- node/node_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/node/node_test.go b/node/node_test.go index 96ac662944..3e6c4e688f 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -873,11 +873,12 @@ func TestMaxProposalBlockSize(t *testing.T) { pb, err := block.ToProto() require.NoError(t, err) - // require that the header and commit be the max possible size + // require that the header and commit be the max possible size; the proposal drops the beacon and + // app hash of the commit before consensus version 2 require.Equal(t, types.MaxHeaderBytes, int64(pb.Header.Size())) - require.Equal(t, types.MaxCommitOverheadBytes+types.MaxCommitRandomnessBytes, int64(pb.LastCommit.Size())) + require.Equal(t, types.MaxCommitOverheadBytes, int64(pb.LastCommit.Size())) // make sure that the block is less than the max possible size - assert.Equal(t, int64(1248+cfg.Mempool.MaxTxBytes), int64(pb.Size())) + assert.Equal(t, int64(1116+cfg.Mempool.MaxTxBytes), int64(pb.Size())) // because of the proto overhead we expect the part set bytes to be equal or // less than the pb block size assert.LessOrEqual(t, partSet.ByteSize(), int64(pb.Size())) From 0ef2a67b7337021c541b916c0a7eb0a84d1db084 Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Thu, 5 Nov 2026 02:44:43 +0700 Subject: [PATCH 14/18] fix: drop a commit's unsigned beacon and app hash before consensus version 2 Neither field is covered by the commit hash or its threshold signature, and both are empty before consensus version 2, which this release does not define. A peer relaying a validly signed commit could still add correctly sized ones, which nodes stored as the seen commit, passed to FinalizeBlock and served on; a proposer could put them in its block's LastCommit, which reached ProcessProposal. Drop both where a commit is adopted (consensus Commit messages, block sync, state sync and its backfill) and from the last commit passed in proposal requests. One test now covers the proposer side, with a block that keeps the fields as a negative control for older releases' block sync, replacing the two overlapping ones; another covers block sync. Co-Authored-By: Claude Opus 5.5 --- internal/blocksync/applier.go | 3 + internal/blocksync/commit_randomness_test.go | 68 +++++++++++ internal/consensus/state_try_add_commit.go | 7 ++ internal/state/execution.go | 5 +- internal/state/execution_test.go | 120 ++++++------------- internal/statesync/reactor.go | 9 +- types/block.go | 10 +- 7 files changed, 134 insertions(+), 88 deletions(-) diff --git a/internal/blocksync/applier.go b/internal/blocksync/applier.go index 66e7c61fa5..f9a7e07665 100644 --- a/internal/blocksync/applier.go +++ b/internal/blocksync/applier.go @@ -93,6 +93,9 @@ func (e *blockApplier) Apply(ctx context.Context, block *types.Block, commit *ty blockID := block.BlockID(blockParts) partSetTime := e.observeSince("partset", start) + // Before consensus version 2 a commit carries no beacon; see WithoutRandomBeacon. + commit = commit.WithoutRandomBeacon() + start = time.Now() verified, err := e.verify(ctx, blockID, block, commit) if err != nil { diff --git a/internal/blocksync/commit_randomness_test.go b/internal/blocksync/commit_randomness_test.go index d440361b11..e239c7adc1 100644 --- a/internal/blocksync/commit_randomness_test.go +++ b/internal/blocksync/commit_randomness_test.go @@ -4,10 +4,20 @@ import ( "context" "testing" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + abciclient "github.com/dashpay/tenderdash/abci/client" + abci "github.com/dashpay/tenderdash/abci/types" + "github.com/dashpay/tenderdash/crypto" + "github.com/dashpay/tenderdash/internal/eventbus" + mpmocks "github.com/dashpay/tenderdash/internal/mempool/mocks" + "github.com/dashpay/tenderdash/internal/proxy" sm "github.com/dashpay/tenderdash/internal/state" + "github.com/dashpay/tenderdash/internal/store" "github.com/dashpay/tenderdash/internal/test/factory" + dbm "github.com/dashpay/tenderdash/libs/db" + "github.com/dashpay/tenderdash/libs/log" bcproto "github.com/dashpay/tenderdash/proto/tendermint/blocksync" "github.com/dashpay/tenderdash/types" ) @@ -56,3 +66,61 @@ func TestBlockResponseRefusesPaddedCommitBeacon(t *testing.T) { }) } } + +// finalizeRecorder records the last commit FinalizeBlock received. +type finalizeRecorder struct { + abci.BaseApplication + commit abci.CommitInfo +} + +func (r *finalizeRecorder) FinalizeBlock(_ context.Context, req *abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, error) { + r.commit = req.Commit + return &abci.ResponseFinalizeBlock{}, nil +} + +// TestBlockSyncDropsRelayedCommitRandomness is the regression test for a block sync peer relaying an +// honest block and its validly signed commit with a correctly sized beacon and app hash added: neither +// is covered by the commit's hash or threshold signature, so the commit passes verification. Before +// consensus version 2 a commit carries neither, and the applier drops both, so they are neither passed +// to the application nor stored as the seen commit this node serves. +func TestBlockSyncDropsRelayedCommitRandomness(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + logger := log.NewNopLogger() + + genDoc, privVals := factory.RandGenesisDoc(1, factory.ConsensusParams()) + state, err := sm.MakeGenesisState(genDoc) + require.NoError(t, err) + stateStore := sm.NewStore(dbm.NewMemDB()) + require.NoError(t, stateStore.Save(state)) + blockStore := store.NewBlockStore(dbm.NewMemDB()) + app := &finalizeRecorder{} + proxyApp := proxy.New(abciclient.NewLocalClient(logger, app), logger, proxy.NopMetrics()) + require.NoError(t, proxyApp.Start(ctx)) + eventBus := eventbus.NewDefault(logger) + require.NoError(t, eventBus.Start(ctx)) + mp := &mpmocks.Mempool{} + mp.On("Lock").Return() + mp.On("Unlock").Return() + mp.On("FlushAppConn", mock.Anything).Return(nil) + mp.On("Update", mock.Anything, mock.Anything, mock.Anything, mock.Anything, + mock.Anything, mock.Anything, mock.Anything).Return(nil) + blockExec := sm.NewBlockExecutor(stateStore, proxyApp, mp, sm.EmptyEvidencePool{}, blockStore, eventBus) + applier := newBlockApplier(blockExec, blockStore, applierWithState(state)) + + block, _, _, seen := makeNextBlock(ctx, t, state, privVals[0], 1, types.NewCommit(0, 0, types.BlockID{}, nil, nil)) + pbBlock, err := block.ToProto() + require.NoError(t, err) + pbCommit := seen.ToProto() + pbCommit.Beacon = crypto.CRandBytes(types.SignatureSize) + pbCommit.AppHash = crypto.CRandBytes(crypto.DefaultAppHashSize) + resp, err := BlockResponseFromProto(&bcproto.BlockResponse{Block: pbBlock, Commit: pbCommit}, "peer") + require.NoError(t, err, "a correctly sized beacon and app hash pass the size bound") + + require.NoError(t, applier.Apply(ctx, resp.Block, resp.Commit)) + require.Equal(t, seen.ToCommitInfo(), app.commit) + stored := blockStore.LoadSeenCommitAt(1) + require.Empty(t, stored.Beacon) + require.Empty(t, stored.AppHash) + require.Equal(t, seen.Hash(), stored.Hash()) +} diff --git a/internal/consensus/state_try_add_commit.go b/internal/consensus/state_try_add_commit.go index b311ae6830..0a9279449e 100644 --- a/internal/consensus/state_try_add_commit.go +++ b/internal/consensus/state_try_add_commit.go @@ -45,6 +45,13 @@ func (cs *TryAddCommitAction) Execute(ctx context.Context, stateEvent StateEvent event := stateEvent.Data.(*TryAddCommitEvent) stateData := stateEvent.StateData commit := event.Commit + if stripped := commit.WithoutRandomBeacon(); stripped != commit { + // Before consensus version 2 a commit carries no beacon; see WithoutRandomBeacon. + commit = stripped + withoutBeacon := *event + withoutBeacon.Commit = commit + event = &withoutBeacon + } peerID := event.PeerID fromReplay := event.FromReplay ctx = ctxWithPeerVerificationBudget(ctx, peerID, fromReplay, cs.verificationBudget) diff --git a/internal/state/execution.go b/internal/state/execution.go index 2b4388a3a1..a4a92659c0 100644 --- a/internal/state/execution.go +++ b/internal/state/execution.go @@ -774,13 +774,16 @@ func (blockExec *BlockExecutor) flushMempool( return err } +// buildLastCommitInfo returns the CommitInfo of block.LastCommit for the application, without its +// beacon and app hash: they are empty before consensus version 2, and neither the block hash nor the +// commit's signature covers them, so the proposer could have set any. func buildLastCommitInfo(block *types.Block, initialHeight int64) abci.CommitInfo { if block.Height == initialHeight { // there is no last commit for the initial height. // return an empty value. return abci.CommitInfo{} } - return block.LastCommit.ToCommitInfo() + return block.LastCommit.WithoutRandomBeacon().ToCommitInfo() } // Update returns a copy of state with the fields set using the arguments passed in. diff --git a/internal/state/execution_test.go b/internal/state/execution_test.go index 4f5a028203..26dd14f1c1 100644 --- a/internal/state/execution_test.go +++ b/internal/state/execution_test.go @@ -898,11 +898,16 @@ func TestEmptyPrepareProposal(t *testing.T) { require.NoError(t, err) } -// TestProposalRequestsCarryLastCommitRandomness checks that ProcessProposal passes the beacon and app -// hash of the proposed block's last commit to the application, with its other fields, and that -// PrepareProposal passes the other fields of the commit the proposer was given, whose beacon and app -// hash it drops (see TestProposalDropsRelayedCommitRandomness). -func TestProposalRequestsCarryLastCommitRandomness(t *testing.T) { +// TestProposalDropsRelayedCommitRandomness is the regression test for a peer relaying a validly +// signed commit with a correctly sized beacon and app hash added, and for a proposer putting them in +// its block's LastCommit: neither is covered by the commit's hash or threshold signature, and both are +// empty before consensus version 2. +// +// The proposer drops them from the commit it builds on. Releases before the beacon drop both fields +// when they decode a block, and block sync rebuilds the parts of the block from what it decoded, so a +// proposal that kept them could not be block synced by those releases. PrepareProposal and +// ProcessProposal pass the other fields of the last commit to the application, without them. +func TestProposalDropsRelayedCommitRandomness(t *testing.T) { const height = 2 ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -934,72 +939,6 @@ func TestProposalRequestsCarryLastCommitRandomness(t *testing.T) { mp := &mpmocks.Mempool{} mp.On("ReapMaxBytesMaxGas", mock.Anything, mock.Anything).Return(types.Txs{}) - blockExec := sm.NewBlockExecutor( - sm.NewStore(stateDB), - proxyApp, - mp, - sm.EmptyEvidencePool{}, - nil, - eventBus, - ) - proposer := state.Validators.GetByIndex(0) - commit, _ := makeValidCommit(ctx, t, height, types.BlockID{}, state.Validators, privVals) - commit.Beacon = crypto.CRandBytes(bls12381.SignatureSize) - commit.AppHash = crypto.CRandBytes(crypto.DefaultAppHashSize) - expected := abci.CommitInfo{ - Round: commit.Round, - QuorumHash: commit.QuorumHash, - BlockSignature: commit.ThresholdBlockSignature, - ThresholdVoteExtensions: commit.ThresholdVoteExtensions, - Beacon: commit.Beacon, - AppHash: commit.AppHash, - } - - block, _, err := blockExec.CreateProposalBlock(ctx, height, 0, state, commit, proposer.ProTxHash, 0) - require.NoError(t, err) - require.NotNil(t, prepareReq) - withoutRandomness := expected - withoutRandomness.Beacon, withoutRandomness.AppHash = nil, nil - assert.Equal(t, withoutRandomness, prepareReq.LocalLastCommit) - - block.LastCommit = commit - _, err = blockExec.ProcessProposal(ctx, block, 0, state, false, types.VerifiedCommit{}) - require.NoError(t, err) - require.NotNil(t, processReq) - assert.Equal(t, expected, processReq.ProposedLastCommit) -} - -// TestProposalDropsRelayedCommitRandomness is the regression test for a peer relaying a validly -// signed commit with a correctly sized beacon and app hash added: neither is covered by the commit's -// hash or threshold signature, so the commit is accepted and becomes the next proposal's LastCommit. -// Releases before the beacon drop both fields when they decode a block, and block sync rebuilds the -// parts of the block from what it decoded, so a proposal that kept them could not be block synced by -// those releases. The proposer drops them instead. -func TestProposalDropsRelayedCommitRandomness(t *testing.T) { - const height = 2 - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - logger := log.NewNopLogger() - - eventBus := eventbus.NewDefault(logger) - require.NoError(t, eventBus.Start(ctx)) - state, stateDB, privVals := makeState(t, 1, height) - - var prepareReq *abci.RequestPrepareProposal - app := abcimocks.NewApplication(t) - app.On("PrepareProposal", mock.Anything, mock.Anything).Run(func(args mock.Arguments) { - prepareReq = args.Get(1).(*abci.RequestPrepareProposal) - }).Return(&abci.ResponsePrepareProposal{ - AppHash: make([]byte, crypto.DefaultAppHashSize), AppVersion: 1, - }, nil) - cc := abciclient.NewLocalClient(logger, app) - proxyApp := proxy.New(cc, logger, proxy.NopMetrics()) - require.NoError(t, proxyApp.Start(ctx)) - - mp := &mpmocks.Mempool{} - mp.On("ReapMaxBytesMaxGas", mock.Anything, mock.Anything).Return(types.Txs{}) - blockExec := sm.NewBlockExecutor(sm.NewStore(stateDB), proxyApp, mp, sm.EmptyEvidencePool{}, nil, eventBus) proposer := state.Validators.GetByIndex(0) commit, _ := makeValidCommit(ctx, t, height, factory.MakeBlockID(), state.Validators, privVals) @@ -1009,29 +948,48 @@ func TestProposalDropsRelayedCommitRandomness(t *testing.T) { relayed, err := types.CommitFromProto(commit.ToProto()) require.NoError(t, err) require.Equal(t, commit.Hash(), relayed.Hash(), "the beacon and app hash are not part of the commit hash") + expected := relayed.WithoutRandomBeacon().ToCommitInfo() block, _, err := blockExec.CreateProposalBlock(ctx, height, 0, state, relayed, proposer.ProTxHash, 0) require.NoError(t, err) assert.Empty(t, block.LastCommit.Beacon) assert.Empty(t, block.LastCommit.AppHash) require.NotNil(t, prepareReq) - assert.Empty(t, prepareReq.LocalLastCommit.Beacon) - assert.Empty(t, prepareReq.LocalLastCommit.AppHash) + assert.Equal(t, expected, prepareReq.LocalLastCommit) assert.Equal(t, beacon, relayed.Beacon, "the relayed commit is not changed") assert.EqualValues(t, appHash, relayed.AppHash, "the relayed commit is not changed") - // A release before the beacon decodes the block without fields 7 and 8 of its LastCommit, and - // block sync checks the parts it rebuilds from that block against the next commit's BlockID. - parts, err := block.MakePartSet(types.BlockPartSizeBytes) - require.NoError(t, err) + // A block whose LastCommit keeps them, as a byzantine proposer can build. pb, err := block.ToProto() require.NoError(t, err) - pb.LastCommit.Beacon, pb.LastCommit.AppHash = nil, nil - legacy, err := types.BlockFromProto(pb) + pb.LastCommit = relayed.ToProto() + byzantine, err := types.BlockFromProto(pb) require.NoError(t, err) - legacyParts, err := legacy.MakePartSet(types.BlockPartSizeBytes) + require.Equal(t, beacon, byzantine.LastCommit.Beacon) + + // A release before the beacon decodes a block without fields 7 and 8 of its LastCommit, and block + // sync checks the parts it rebuilds from that block against the next commit's BlockID: they match + // for the proposal, and not for a block that kept the relayed fields. + partSetHeader := func(b *types.Block, legacy bool) types.PartSetHeader { + t.Helper() + pb, err := b.ToProto() + require.NoError(t, err) + if legacy { + pb.LastCommit.Beacon, pb.LastCommit.AppHash = nil, nil + } + decoded, err := types.BlockFromProto(pb) + require.NoError(t, err) + parts, err := decoded.MakePartSet(types.BlockPartSizeBytes) + require.NoError(t, err) + return parts.Header() + } + assert.Equal(t, partSetHeader(block, false), partSetHeader(block, true)) + assert.NotEqual(t, partSetHeader(byzantine, false), partSetHeader(byzantine, true)) + + _, err = blockExec.ProcessProposal(ctx, byzantine, 0, state, false, types.VerifiedCommit{}) require.NoError(t, err) - assert.Equal(t, parts.Header(), legacyParts.Header()) + require.NotNil(t, processReq) + assert.Equal(t, expected, processReq.ProposedLastCommit) } // TestPrepareProposalErrorOnNonExistingRemoved tests that the block creation logic returns diff --git a/internal/statesync/reactor.go b/internal/statesync/reactor.go index 6df321458b..e6e09d0c0f 100644 --- a/internal/statesync/reactor.go +++ b/internal/statesync/reactor.go @@ -399,6 +399,8 @@ func (r *Reactor) Sync(ctx context.Context) (sm.State, error) { if err != nil { return sm.State{}, fmt.Errorf("sync any: %w", err) } + // Before consensus version 2 a commit carries no beacon; see WithoutRandomBeacon. + commit = commit.WithoutRandomBeacon() err = r.publishCommitEvent(commit) if err != nil { @@ -911,8 +913,11 @@ func (r *Reactor) backfill( return fmt.Errorf("authenticating backfill validator set at height %d: %w", resp.block.Height, err) } - // save the signed headers - if err := r.blockStore.SaveSignedHeader(resp.block.SignedHeader, trustedBlockID); err != nil { + // save the signed headers; before consensus version 2 a commit carries no beacon, see + // WithoutRandomBeacon + signedHeader := *resp.block.SignedHeader + signedHeader.Commit = signedHeader.Commit.WithoutRandomBeacon() + if err := r.blockStore.SaveSignedHeader(&signedHeader, trustedBlockID); err != nil { return err } diff --git a/types/block.go b/types/block.go index e6217b3eb9..9b308d73b2 100644 --- a/types/block.go +++ b/types/block.go @@ -799,8 +799,9 @@ type Commit struct { // Beacon is the threshold signature recovered from the prevotes of the commit round. // Set from consensus version 2; empty before. Beacon []byte `json:"beacon,omitempty"` - // AppHash is the app hash the precommits sign: the result of ApplyBlockRandomness for this - // block and round. Set from consensus version 2; empty before. + // AppHash is the result of ApplyBlockRandomness for this block and round. The precommits sign it + // only through BlockID.StateID, the hash of the header's state ID with this app hash: the field + // itself is not signed. Set from consensus version 2; empty before. AppHash tmbytes.HexBytes `json:"app_hash,omitempty"` // Memoized in first call to corresponding method. @@ -947,8 +948,9 @@ func (commit *Commit) ValidateBasic() error { } // Neither field is covered by the commit hash or its threshold signature, so a peer can fill them - // in a commit it relays. Bounding them here refuses such a commit before it is stored or passed - // to the application, whatever the consensus version. + // in a commit it relays. Bounding them here refuses a commit with wrongly sized ones before it is + // stored or passed to the application, whatever the consensus version; before consensus version 2, + // nodes also drop well-sized ones where they adopt a commit (see WithoutRandomBeacon). if !validRandomBeaconSizes(commit.Beacon, commit.AppHash) { return fmt.Errorf("%w: beacon of %d bytes and app hash of %d bytes, expected both empty or %d and %d bytes", ErrInvalidCommitRandomness, len(commit.Beacon), len(commit.AppHash), SignatureSize, crypto.DefaultAppHashSize) From 003c02201c972fb8db438424ef65bcf6923baafb Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Thu, 5 Nov 2026 02:44:43 +0700 Subject: [PATCH 15/18] perf(types): allocate once in the tolerant block decoder The fallback allocated a copy of the whole block and one buffer per LastCommit occurrence before it knew whether anything had to be dropped. It now allocates nothing until the first field it drops, then writes everything into one buffer: 1 allocation instead of about 1M on 2 MiB of mistyped occurrences, and none when nothing is dropped. Varints are read with gogoproto's proto.DecodeVarint, which matches the generated code, instead of a copy of it. Co-Authored-By: Claude Opus 5.5 --- types/block_decode.go | 112 +++++++++++++++++++++++------------------- 1 file changed, 61 insertions(+), 51 deletions(-) diff --git a/types/block_decode.go b/types/block_decode.go index 9d5bc017a6..4a00f9c458 100644 --- a/types/block_decode.go +++ b/types/block_decode.go @@ -43,61 +43,89 @@ func UnmarshalBlockProto(bz []byte) (*tmproto.Block, error) { // dropMistypedLastCommitRandomness returns the block bytes bz without the occurrences of the // LastCommit beacon and app hash fields that do not have the bytes wire type, and whether there were // any. It splits the bytes into fields as the generated decoder does, and returns false where that -// decoder fails. +// decoder fails. It allocates nothing before the first field it drops, and then only the bytes it +// returns. func dropMistypedLastCommitRandomness(bz []byte) ([]byte, bool) { - out := make([]byte, 0, len(bz)) - dropped := false - for len(bz) > 0 { - num, typ, n, ok := consumeGeneratedField(bz) + var out []byte + for i := 0; i < len(bz); { + num, typ, n, ok := consumeGeneratedField(bz[i:]) if !ok { return nil, false } - field := bz[:n] + field := bz[i : i+n] if num == blockLastCommitField && typ == protowire.BytesType { - _, tagLen, _ := consumeGeneratedVarint(field) - _, lenLen, _ := consumeGeneratedVarint(field[tagLen:]) - cleaned, ok := dropMistypedCommitRandomness(field[tagLen+lenLen:]) - if ok { - dropped = true - field = protowire.AppendBytes(protowire.AppendTag(nil, num, typ), cleaned) + _, tagLen := proto.DecodeVarint(field) + _, lenLen := proto.DecodeVarint(field[tagLen:]) + commit := field[tagLen+lenLen:] + if kept, ok := keptCommitLength(commit); ok && kept < len(commit) { + if out == nil { + out = append(make([]byte, 0, len(bz)), bz[:i]...) + } + out = protowire.AppendTag(out, num, typ) + out = protowire.AppendVarint(out, uint64(kept)) //nolint:gosec // a length, never negative + out = appendKeptCommitFields(out, commit) + i += n + continue } } - out = append(out, field...) + if out != nil { + out = append(out, field...) + } + i += n + } + return out, out != nil +} + +// keptCommitLength returns the length of the commit bytes bz without the beacon and app hash fields +// that do not have the bytes wire type, and false where the generated decoder fails. +func keptCommitLength(bz []byte) (int, bool) { + kept := 0 + for len(bz) > 0 { + num, typ, n, ok := consumeGeneratedField(bz) + if !ok { + return 0, false + } + if !mistypedCommitRandomness(num, typ) { + kept += n + } bz = bz[n:] } - return out, dropped + return kept, true } -// dropMistypedCommitRandomness returns the commit bytes bz without the beacon and app hash fields that -// do not have the bytes wire type, and whether there were any. -func dropMistypedCommitRandomness(bz []byte) ([]byte, bool) { - out := make([]byte, 0, len(bz)) - dropped := false +// appendKeptCommitFields appends to out the fields of the commit bytes bz that keptCommitLength +// counts. +func appendKeptCommitFields(out, bz []byte) []byte { for len(bz) > 0 { num, typ, n, ok := consumeGeneratedField(bz) if !ok { - return nil, false + break } - if (num == commitBeaconField || num == commitAppHashField) && typ != commitRandomnessWType { - dropped = true - } else { + if !mistypedCommitRandomness(num, typ) { out = append(out, bz[:n]...) } bz = bz[n:] } - return out, dropped + return out +} + +// mistypedCommitRandomness reports whether a commit field is a beacon or an app hash without the bytes +// wire type. +func mistypedCommitRandomness(num protowire.Number, typ protowire.Type) bool { + return (num == commitBeaconField || num == commitAppHashField) && typ != commitRandomnessWType } // consumeGeneratedField returns the number, the wire type and the length, tag included, of the field at // the start of bz, as the Unmarshal methods that gogoproto generates read a field they skip: the // field number is the tag shifted right by 3 and truncated to 32 bits. It returns false where those -// methods fail. +// methods fail. Varints are read with proto.DecodeVarint, which, like those methods and unlike +// protowire, drops the bits of a tenth byte past the 64th instead of failing. // // Releases before the beacon skip fields 7 and 8 of a commit with these rules, which accept more than // protowire does, so the bytes must be split with the same rules to drop exactly those fields. func consumeGeneratedField(bz []byte) (protowire.Number, protowire.Type, int, bool) { - tag, _, ok := consumeGeneratedVarint(bz) - if !ok { + tag, n := proto.DecodeVarint(bz) + if n == 0 { return 0, 0, 0, false } num, typ := protowire.Number(int32(tag>>3)), protowire.Type(tag&0x7) //nolint:gosec // truncated as generated code does @@ -118,24 +146,24 @@ func consumeGeneratedField(bz []byte) (protowire.Number, protowire.Type, int, bo func skipGeneratedField(bz []byte) (int, bool) { i, depth := 0, 0 for i < len(bz) { - tag, n, ok := consumeGeneratedVarint(bz[i:]) - if !ok { + tag, n := proto.DecodeVarint(bz[i:]) + if n == 0 { return 0, false } i += n switch protowire.Type(tag & 0x7) { case protowire.VarintType: - _, n, ok := consumeGeneratedVarint(bz[i:]) - if !ok { + _, n := proto.DecodeVarint(bz[i:]) + if n == 0 { return 0, false } i += n case protowire.Fixed64Type: i += 8 case protowire.BytesType: - length, n, ok := consumeGeneratedVarint(bz[i:]) + length, n := proto.DecodeVarint(bz[i:]) size := int(length) //nolint:gosec // wraps as the int length of generated code does - if !ok || size < 0 { + if n == 0 || size < 0 { return 0, false } i += n + size @@ -160,21 +188,3 @@ func skipGeneratedField(bz []byte) (int, bool) { } return 0, false } - -// consumeGeneratedVarint reads the varint at the start of bz as the code that gogoproto generates -// does, and returns it with its length. Unlike protowire, it drops the bits of a tenth byte past the -// 64th instead of failing. -func consumeGeneratedVarint(bz []byte) (uint64, int, bool) { - var v uint64 - for i, shift := 0, uint(0); shift < 64; i, shift = i+1, shift+7 { - if i >= len(bz) { - return 0, 0, false - } - b := bz[i] - v |= uint64(b&0x7F) << shift - if b < 0x80 { - return v, i + 1, true - } - } - return 0, 0, false -} From f494ed8d5b0d02357f71ceda959fb9d08a9159d3 Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Thu, 5 Nov 2026 02:44:43 +0700 Subject: [PATCH 16/18] refactor(kvstore): look up ApplyBlockRandomness by block hash only Tenderdash always sends the block hash, so the height and round fallback for requests without one served only tests. ProcessProposal now records every block under its round and hash, and the lookup has one path. Co-Authored-By: Claude Opus 5.5 --- abci/example/kvstore/kvstore.go | 36 +++++++--------------------- abci/example/kvstore/kvstore_test.go | 2 +- 2 files changed, 9 insertions(+), 29 deletions(-) diff --git a/abci/example/kvstore/kvstore.go b/abci/example/kvstore/kvstore.go index 3a46484bb3..2b8d3075ac 100644 --- a/abci/example/kvstore/kvstore.go +++ b/abci/example/kvstore/kvstore.go @@ -397,10 +397,8 @@ func (app *Application) ProcessProposal(_ context.Context, req *abci.RequestProc Status: abci.ResponseProcessProposal_REJECT, }, err } - if len(req.Hash) > 0 { - block := processedBlock{round: req.Round, hash: string(req.Hash)} - app.processedBlocks[block] = roundKey(roundState.GetAppHash(), roundState.GetHeight(), roundState.GetRound()) - } + block := processedBlock{round: req.Round, hash: string(req.Hash)} + app.processedBlocks[block] = roundKey(roundState.GetAppHash(), roundState.GetHeight(), roundState.GetRound()) if req.Version.App != app.appVersionForHeight(req.Height) { app.logger.Error("app version mismatch in process proposal request", @@ -500,7 +498,7 @@ func (app *Application) FinalizeBlock(_ context.Context, req *abci.RequestFinali } // ApplyBlockRandomness implements ABCI. The example application uses no randomness, so it returns -// the app hash of the state that PrepareProposal or ProcessProposal left for the block and round. +// the app hash of the state that ProcessProposal left for the block and round. func (app *Application) ApplyBlockRandomness(_ context.Context, req *abci.RequestApplyBlockRandomness) (*abci.ResponseApplyBlockRandomness, error) { app.mu.Lock() defer app.mu.Unlock() @@ -522,32 +520,14 @@ type processedBlock struct { } // processedRoundState returns the state ProcessProposal left for the block with the given hash at -// the given height and round. Without a hash, it returns the only state executed at that height and -// round, by PrepareProposal or ProcessProposal. +// the given height and round. // Caller should lock the Application. func (app *Application) processedRoundState(hash []byte, height int64, round int32) (State, error) { - if len(hash) > 0 { - key, ok := app.processedBlocks[processedBlock{round: round, hash: string(hash)}] - state := app.roundStates[key] - if !ok || state == nil || state.GetHeight() != height { - return nil, fmt.Errorf("block not processed at height %d round %d", height, round) - } - return state, nil - } - var found State - for _, state := range app.roundStates { - if state.GetHeight() != height || state.GetRound() != round { - continue - } - if found != nil { - return nil, fmt.Errorf("more than one proposal executed at height %d round %d", height, round) - } - found = state - } - if found == nil { - return nil, fmt.Errorf("no proposal executed at height %d round %d", height, round) + state := app.roundStates[app.processedBlocks[processedBlock{round: round, hash: string(hash)}]] + if state == nil || state.GetHeight() != height { + return nil, fmt.Errorf("block not processed at height %d round %d", height, round) } - return found, nil + return state, nil } // eventValUpdate generates an event that contains info about current validator set diff --git a/abci/example/kvstore/kvstore_test.go b/abci/example/kvstore/kvstore_test.go index 02f4a49075..43343a6c84 100644 --- a/abci/example/kvstore/kvstore_test.go +++ b/abci/example/kvstore/kvstore_test.go @@ -684,7 +684,7 @@ func TestApplyBlockRandomness(t *testing.T) { require.Equal(t, first.AppHash, again.AppHash) _, err = app.ApplyBlockRandomness(ctx, &types.RequestApplyBlockRandomness{Height: height, Round: 0}) - require.ErrorContains(t, err, "no proposal executed") + require.ErrorContains(t, err, "block not processed") } // TestApplyBlockRandomnessEquivocation is the regression test for a node that executed two blocks of From fef45324fee5b318fa17add5dd1f6c83addcac8e Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Thu, 5 Nov 2026 02:44:43 +0700 Subject: [PATCH 17/18] docs: document the commit beacon fields and ApplyBlockRandomness rules - spec/core/data_structures.md, consensus.md, consensus-commit.md: the Commit fields Beacon and AppHash, their size rule, and how a block's LastCommit with malformed ones is read. - Requirement 10 and the ABCI overviews: ApplyBlockRandomness must not modify the committed state, since it can run for rounds that never commit. - Commit.app_hash and CommitInfo.app_hash: the commit signs it only through its state ID. - ApplyBlockRandomness: this release defines consensus versions 0 and 1 only, so it never calls it. - UPGRADING.md: the new method, BaseApplication's error, ABCI 1.5.0, the commit size rule and routing with the routed transport. Co-Authored-By: Claude Opus 5.5 --- UPGRADING.md | 18 ++++++++++++++++++ abci/types/types.pb.go | 8 ++++++-- proto/tendermint/abci/types.proto | 8 ++++++-- proto/tendermint/types/types.pb.go | 12 +++++++----- proto/tendermint/types/types.proto | 12 +++++++----- spec/abci++/abci++_app_requirements.md | 6 ++++-- spec/abci++/abci++_basic_concepts.md | 10 ++++++---- spec/abci++/abci++_methods.md | 5 ++++- spec/abci++/abci++_tmint_expected_behavior.md | 2 ++ spec/abci++/api.md | 5 ++++- spec/consensus/consensus-commit.md | 3 ++- spec/consensus/consensus.md | 2 +- spec/core/data_structures.md | 4 +++- 13 files changed, 70 insertions(+), 25 deletions(-) diff --git a/UPGRADING.md b/UPGRADING.md index 100579551d..3cea871798 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -37,6 +37,24 @@ opening context or calling `Stop`/`Wait` alone does not close the head file. See [service lifecycle](docs/architecture/service-lifecycle.md) for ownership and migration boundaries. +### ABCI: ApplyBlockRandomness and commit beacon fields + +The ABCI version is 1.5.0. The `Application` interface and the gRPC `ABCIApplication` service gain +`ApplyBlockRandomness`, which hands the application a block's random beacon from consensus version 2. +This release defines consensus versions 0 and 1 only and never calls it. + +- Go applications that do not embed `abci/types.BaseApplication` must implement the method to + compile. `BaseApplication.ApplyBlockRandomness` returns `ErrApplyBlockRandomnessNotImplemented`, + not an empty response, so an application must implement it before its chain moves to consensus + version 2. +- With the routed ABCI transport, a method no routing rule names goes to the `*` client. Route + `ApplyBlockRandomness` to the client that runs `ProcessProposal`, since it answers for the state + `ProcessProposal` left. +- `Commit` and `CommitInfo` gain `beacon` and `app_hash`. At every consensus version, a commit whose + beacon and app hash are not both empty, or exactly 96 and 32 bytes, is refused, and a block's + last commit is read without malformed ones. Before consensus version 2, nodes drop well-sized ones + from the commits they adopt and from the last commit they pass to the application. + ### ABCI: commit vote-extension verification Tenderdash now calls `VerifyVoteExtension` after `ProcessProposal` and before it diff --git a/abci/types/types.pb.go b/abci/types/types.pb.go index af6ef23aaa..db4d23c6ed 100644 --- a/abci/types/types.pb.go +++ b/abci/types/types.pb.go @@ -2025,6 +2025,7 @@ func (m *RequestFinalizeBlock) GetBlockID() *types1.BlockID { // #### Usage // // - Used from consensus version 2 (`VersionParams.consensus_version`). Before that, Tenderdash never calls it. +// This release defines consensus versions 0 and 1 only, so it never calls it. // - `RequestApplyBlockRandomness.beacon` is the random beacon of the block and round: the 96-byte BLS threshold // signature recovered from the Prevotes of round `round` for the block `hash`. Tenderdash has verified it against // the quorum's threshold public key before the call. @@ -2043,6 +2044,8 @@ func (m *RequestFinalizeBlock) GetBlockID() *types1.BlockID { // and round MUST return the same `app_hash`. // - Tenderdash may call it more than once for the same block, round and beacon; the Application MUST return // the same `app_hash` each time. +// - It MUST NOT modify the committed state: Tenderdash may call it for a round that never commits, and +// `FinalizeBlock` commits the state for the commit round. // - An ABCI error is fatal, as for `ExtendVote`. // // #### When does Tenderdash call it? @@ -3615,8 +3618,9 @@ type CommitInfo struct { // Random beacon of the committed block: the threshold signature recovered from the prevotes of // the commit round. Set from consensus version 2; empty before. Beacon []byte `protobuf:"bytes,5,opt,name=beacon,proto3" json:"beacon,omitempty"` - // App hash the commit signs: the result of `ApplyBlockRandomness` for the committed block and - // round. Set from consensus version 2; empty before. + // App hash after `ApplyBlockRandomness` for the committed block and round. The commit signs it + // through the state ID of its block ID, which Tenderdash checks before passing it on. + // Set from consensus version 2; empty before. AppHash []byte `protobuf:"bytes,6,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` } diff --git a/proto/tendermint/abci/types.proto b/proto/tendermint/abci/types.proto index 43acabfc2d..2dae4d2351 100644 --- a/proto/tendermint/abci/types.proto +++ b/proto/tendermint/abci/types.proto @@ -574,6 +574,7 @@ message RequestFinalizeBlock { // #### Usage // // - Used from consensus version 2 (`VersionParams.consensus_version`). Before that, Tenderdash never calls it. +// This release defines consensus versions 0 and 1 only, so it never calls it. // - `RequestApplyBlockRandomness.beacon` is the random beacon of the block and round: the 96-byte BLS threshold // signature recovered from the Prevotes of round `round` for the block `hash`. Tenderdash has verified it against // the quorum's threshold public key before the call. @@ -592,6 +593,8 @@ message RequestFinalizeBlock { // and round MUST return the same `app_hash`. // - Tenderdash may call it more than once for the same block, round and beacon; the Application MUST return // the same `app_hash` each time. +// - It MUST NOT modify the committed state: Tenderdash may call it for a round that never commits, and +// `FinalizeBlock` commits the state for the commit round. // - An ABCI error is fatal, as for `ExtendVote`. // // #### When does Tenderdash call it? @@ -852,8 +855,9 @@ message CommitInfo { // Random beacon of the committed block: the threshold signature recovered from the prevotes of // the commit round. Set from consensus version 2; empty before. bytes beacon = 5; - // App hash the commit signs: the result of `ApplyBlockRandomness` for the committed block and - // round. Set from consensus version 2; empty before. + // App hash after `ApplyBlockRandomness` for the committed block and round. The commit signs it + // through the state ID of its block ID, which Tenderdash checks before passing it on. + // Set from consensus version 2; empty before. bytes app_hash = 6; } diff --git a/proto/tendermint/types/types.pb.go b/proto/tendermint/types/types.pb.go index cc51e0dbf0..0b1c83586e 100644 --- a/proto/tendermint/types/types.pb.go +++ b/proto/tendermint/types/types.pb.go @@ -692,13 +692,15 @@ type Commit struct { QuorumHash []byte `protobuf:"bytes,4,opt,name=quorum_hash,json=quorumHash,proto3" json:"quorum_hash,omitempty"` ThresholdBlockSignature []byte `protobuf:"bytes,5,opt,name=threshold_block_signature,json=thresholdBlockSignature,proto3" json:"threshold_block_signature,omitempty"` ThresholdVoteExtensions []*VoteExtension `protobuf:"bytes,6,rep,name=threshold_vote_extensions,json=thresholdVoteExtensions,proto3" json:"threshold_vote_extensions,omitempty"` - // Random beacon: the threshold signature recovered from the prevotes of the commit round. - // Set from consensus version 2; empty before. Neither this field nor app_hash is covered by the - // commit's signature: a commit is refused unless both are empty or they are exactly 96 and 32 + // Random beacon: the threshold signature recovered from the prevotes of the commit round, which + // verifies against their sign item and the quorum's threshold public key. + // Set from consensus version 2; empty before. The commit's signature covers neither this field + // nor app_hash as bytes: a commit is refused unless both are empty or they are exactly 96 and 32 // bytes, and a block's last commit is read without them when they are not. Beacon []byte `protobuf:"bytes,7,opt,name=beacon,proto3" json:"beacon,omitempty"` - // App hash the precommits sign, returned by ApplyBlockRandomness for this block and round. - // Set from consensus version 2; empty before. + // App hash returned by ApplyBlockRandomness for this block and round. The precommits sign it only + // through block_id.state_id, the hash of the block header's state ID with its app hash replaced by + // this one: trust this field only once that hash matches. Set from consensus version 2; empty before. AppHash []byte `protobuf:"bytes,8,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` } diff --git a/proto/tendermint/types/types.proto b/proto/tendermint/types/types.proto index 513e865884..524e4d339c 100644 --- a/proto/tendermint/types/types.proto +++ b/proto/tendermint/types/types.proto @@ -156,13 +156,15 @@ message Commit { bytes quorum_hash = 4; bytes threshold_block_signature = 5; repeated VoteExtension threshold_vote_extensions = 6; - // Random beacon: the threshold signature recovered from the prevotes of the commit round. - // Set from consensus version 2; empty before. Neither this field nor app_hash is covered by the - // commit's signature: a commit is refused unless both are empty or they are exactly 96 and 32 + // Random beacon: the threshold signature recovered from the prevotes of the commit round, which + // verifies against their sign item and the quorum's threshold public key. + // Set from consensus version 2; empty before. The commit's signature covers neither this field + // nor app_hash as bytes: a commit is refused unless both are empty or they are exactly 96 and 32 // bytes, and a block's last commit is read without them when they are not. bytes beacon = 7; - // App hash the precommits sign, returned by ApplyBlockRandomness for this block and round. - // Set from consensus version 2; empty before. + // App hash returned by ApplyBlockRandomness for this block and round. The precommits sign it only + // through block_id.state_id, the hash of the block header's state ID with its app hash replaced by + // this one: trust this field only once that hash matches. Set from consensus version 2; empty before. bytes app_hash = 8; } diff --git a/spec/abci++/abci++_app_requirements.md b/spec/abci++/abci++_app_requirements.md index e3065b5b29..922a382ee2 100644 --- a/spec/abci++/abci++_app_requirements.md +++ b/spec/abci++/abci++_app_requirements.md @@ -131,8 +131,10 @@ for the block can pass it. See [VerifyVoteExtension](./abci++_methods.md#verifyv Tenderdash does on each path when a commit is rejected. * Requirement 10 [_all_, no-side-effects]: $p$'s calls to `RequestPrepareProposal`, - `RequestProcessProposal`, `RequestExtendVote`, and `RequestVerifyVoteExtension` at height $h$ do - not modify $s_{p,h-1}$. + `RequestProcessProposal`, `RequestApplyBlockRandomness`, `RequestExtendVote`, and + `RequestVerifyVoteExtension` at height $h$ do not modify $s_{p,h-1}$. Tendermint may call + `RequestApplyBlockRandomness` for a round that never commits, so the randomized state it produces + stays a candidate until `FinalizeBlock` commits the one for the commit round. * Requirement 11 [`ExtendVote`, `FinalizeBlock`, non-dependency]: for any correct process $p$, and any vote extensions $e$ that $p$ received at height $h$, the computation of diff --git a/spec/abci++/abci++_basic_concepts.md b/spec/abci++/abci++_basic_concepts.md index c2efbabb0e..f74d9e5f79 100644 --- a/spec/abci++/abci++_basic_concepts.md +++ b/spec/abci++/abci++_basic_concepts.md @@ -42,7 +42,7 @@ The first time a new blockchain is started, Tendermint calls `InitChain`. From then on, method `FinalizeBlock` is executed at the end of each block, resulting in an updated Application state. During consensus execution of a block height, before method `FinalizeBlock` is -called, methods `PrepareProposal`, `ProcessProposal`, `ExtendVote`, and +called, methods `PrepareProposal`, `ProcessProposal`, `ApplyBlockRandomness`, `ExtendVote`, and `VerifyVoteExtension` may be called several times. See [Tendermint's expected behavior](abci++_tmint_expected_behavior.md) for details on the possible call sequences of these methods. @@ -66,6 +66,8 @@ SHOULD accept a prepared proposal passed via `ProcessProposal`, even if a part o the proposal is invalid (e.g., an invalid transaction); the Application can ignore the invalid part of the prepared proposal at block execution time. +* [**ApplyBlockRandomness:**](./abci++_methods.md#applyblockrandomness) From consensus version 2, it hands the Application the random beacon of a block and round, recovered from the Prevotes, and the Application applies it to the candidate state that `ProcessProposal` left for that block and round. Tendermint calls it before `ExtendVote` and before signing a Precommit for the block, and may call it for rounds that never commit, so it must not modify the committed state. + * [**ExtendVote:**](./abci++_methods.md#extendvote) It allows applications to force their validators to do more than just validate within consensus. `ExtendVote` allows applications to include deterministic and non-deterministic data, opaque to Tendermint, to precommit messages (the final round of voting. The data, called _vote extensions_, will also be made available to the application in the next height, along with the vote it is extending, in the rounds @@ -210,9 +212,9 @@ transactions and compute the same results. Some Applications may choose to execute the blocks that are about to be proposed (via `PrepareProposal`), or those that the Application is asked to validate -(via `ProcessProposal`). However, the state changes caused by processing those -proposed blocks must never replace the previous state until `FinalizeBlock` and `Commit` confirms -the block decided. +(via `ProcessProposal`), and apply their randomness (via `ApplyBlockRandomness`). However, the +state changes caused by processing those proposed blocks must never replace the previous state +until `FinalizeBlock` and `Commit` confirms the block decided. Additionally, vote extensions or the validation thereof (via `ExtendVote` or `VerifyVoteExtension`) must _never_ have side effects on the current state. diff --git a/spec/abci++/abci++_methods.md b/spec/abci++/abci++_methods.md index 82cf2affc6..e1c941931d 100644 --- a/spec/abci++/abci++_methods.md +++ b/spec/abci++/abci++_methods.md @@ -607,6 +607,7 @@ block. This includes commits the process assembled from its own +2/3 precommits. * **Usage**: * Used from consensus version 2 (`VersionParams.consensus_version`). Before that, Tenderdash never calls it. + This release defines consensus versions 0 and 1 only, so it never calls it. * The beacon is the BLS threshold signature recovered from the Prevotes of round `round` for block `hash`. Every set of threshold shares recovers the same bytes, and nobody can compute them before the Prevotes exist. Tenderdash verifies the beacon against the quorum's threshold public key before the call. @@ -624,6 +625,8 @@ block. This includes commits the process assembled from its own +2/3 precommits. see [ExtendVote](#extendvote). * The implementation MUST be deterministic, and MUST return the same `app_hash` when called again for the same block, round and beacon. + * It MUST NOT modify the committed state: Tenderdash may call it for a round that never commits, and + `FinalizeBlock` commits the state for the commit round. * An ABCI error is fatal, as for `ExtendVote`. #### When does Tenderdash call it? @@ -871,7 +874,7 @@ enum VoteExtensionType { | block_signature | bytes | Block signature. | 3 | | threshold_vote_extensions | repeated [VoteExtension](../../proto/tendermint/types/dash.proto) | Threshold-recovered vote extensions of the commit. | 4 | | beacon | bytes | Random beacon of the commit round. Set from consensus version 2; empty before. | 5 | - | app_hash | bytes | App hash the commit signs, returned by `ApplyBlockRandomness`. From consensus version 2. | 6 | + | app_hash | bytes | App hash returned by `ApplyBlockRandomness`, which the commit signs through the state ID of its block ID. Set from consensus version 2; empty before. | 6 | ### ExtendedCommitInfo diff --git a/spec/abci++/abci++_tmint_expected_behavior.md b/spec/abci++/abci++_tmint_expected_behavior.md index c4fb398ddb..3d55af54ae 100644 --- a/spec/abci++/abci++_tmint_expected_behavior.md +++ b/spec/abci++/abci++_tmint_expected_behavior.md @@ -235,6 +235,8 @@ As for the new methods: (`RequestPrepareProposal.max_tx_bytes`). If so, the Application must remove transactions at the end of the list until the total byte size is at or below the limit. * `ProcessProposal` must set `ResponseProcessProposal.accept` to _true_ and return. +* `ApplyBlockRandomness`, which uses no randomness in a legacy application, is to return the app hash + that `ProcessProposal` returned for the block and round, without changing any state. * `ExtendVote` is to set `ResponseExtendVote.extension` to an empty byte array and return. * `VerifyVoteExtension` must set `ResponseVerifyVoteExtension.status` to `ACCEPT` if the extension list is empty and to `REJECT` otherwise, then return. This holds for commit verification too diff --git a/spec/abci++/api.md b/spec/abci++/api.md index 6dcba074a2..9bc06eda83 100644 --- a/spec/abci++/api.md +++ b/spec/abci++/api.md @@ -90,7 +90,7 @@ | block_signature | [bytes](#bytes) | | | | threshold_vote_extensions | [tendermint.types.VoteExtension](#tendermint-types-VoteExtension) | repeated | | | beacon | [bytes](#bytes) | | Random beacon of the committed block: the threshold signature recovered from the prevotes of the commit round. Set from consensus version 2; empty before. | -| app_hash | [bytes](#bytes) | | App hash the commit signs: the result of `ApplyBlockRandomness` for the committed block and round. Set from consensus version 2; empty before. | +| app_hash | [bytes](#bytes) | | App hash after `ApplyBlockRandomness` for the committed block and round. The commit signs it through the state ID of its block ID, which Tenderdash checks before passing it on. Set from consensus version 2; empty before. | @@ -271,6 +271,7 @@ Applies the block's randomness and returns the app hash the Precommit signs. #### Usage - Used from consensus version 2 (`VersionParams.consensus_version`). Before that, Tenderdash never calls it. + This release defines consensus versions 0 and 1 only, so it never calls it. - `RequestApplyBlockRandomness.beacon` is the random beacon of the block and round: the 96-byte BLS threshold signature recovered from the Prevotes of round `round` for the block `hash`. Tenderdash has verified it against the quorum's threshold public key before the call. @@ -289,6 +290,8 @@ Applies the block's randomness and returns the app hash the Precommit signs. and round MUST return the same `app_hash`. - Tenderdash may call it more than once for the same block, round and beacon; the Application MUST return the same `app_hash` each time. +- It MUST NOT modify the committed state: Tenderdash may call it for a round that never commits, and + `FinalizeBlock` commits the state for the commit round. - An ABCI error is fatal, as for `ExtendVote`. #### When does Tenderdash call it? diff --git a/spec/consensus/consensus-commit.md b/spec/consensus/consensus-commit.md index 6fa6708e15..23d266fa14 100644 --- a/spec/consensus/consensus-commit.md +++ b/spec/consensus/consensus-commit.md @@ -5,7 +5,8 @@ order: 6 # Commit handling A *commit* for height `h` is `(Height, Round, BlockID, QuorumHash, -ThresholdBlockSignature, ThresholdVoteExtensions)` (`types.Commit`). A node +ThresholdBlockSignature, ThresholdVoteExtensions, Beacon, AppHash)` (`types.Commit`); Beacon and +AppHash are set from consensus version 2 and are not covered by the signature. A node obtains one in two ways: 1. **locally**, from its own precommit vote set once the threshold signature diff --git a/spec/consensus/consensus.md b/spec/consensus/consensus.md index 02ea72e485..f242273423 100644 --- a/spec/consensus/consensus.md +++ b/spec/consensus/consensus.md @@ -67,7 +67,7 @@ numbers are omitted because they drift. | **POLRound** | The round whose polka a proposal claims as justification; `-1` when the proposal claims none. | `types.Proposal.POLRound` | | **BlockID** | `(Hash, PartSetHeader, StateID)`. Nil block id = all three empty. | `types/block.go`, `types/block_meta.go` | | **StateID** | Hash of `{AppVersion, Height, AppHash, CoreChainLockedHeight, Time}` of the block header; the app hash is the state **after** executing that block (same-block execution). | `Header.StateID` in `types/block.go` | -| **Commit** | `(Height, Round, BlockID, QuorumHash, ThresholdBlockSignature, ThresholdVoteExtensions)`: a single aggregate BLS threshold signature plus one threshold signature per threshold-recoverable vote extension. There are no per-validator signatures in a commit. | `types.Commit` in `types/block.go` | +| **Commit** | `(Height, Round, BlockID, QuorumHash, ThresholdBlockSignature, ThresholdVoteExtensions, Beacon, AppHash)`: a single aggregate BLS threshold signature plus one threshold signature per threshold-recoverable vote extension. There are no per-validator signatures in a commit. Beacon and AppHash, set from consensus version 2, are not covered by the signature; before it, nodes drop them where they adopt a commit. | `types.Commit` in `types/block.go` | | **Locked block / round** | The block the node precommitted most recently and the round it did so; `-1`/nil when none. | `RoundState.LockedRound/LockedBlock` | | **Valid block / round** | The most recent block (and round) for which the node saw a polka in a round `≥` any previous one. | `RoundState.ValidRound/ValidBlock` | | **CurrentRoundState** | The application's answer to the latest `PrepareProposal`/`ProcessProposal` for the block held in `ProposalBlock`, tagged with the round it was processed for. | `RoundState.CurrentRoundState`, `RoundState.ProcessedBlockID`; `processedFor` in `internal/consensus/block_executor.go` | diff --git a/spec/core/data_structures.md b/spec/core/data_structures.md index 8befeb340f..4e1cdd03df 100644 --- a/spec/core/data_structures.md +++ b/spec/core/data_structures.md @@ -55,7 +55,7 @@ and a list of evidence of malfeasance (ie. signing conflicting votes). | Header | [Header](#header) | Header corresponding to the block. This field contains information used throughout consensus and other areas of the protocol. To find out what it contains, visit [header] (#header) | Must adhere to the validation rules of [header](#header) | | Data | [Data](#data) | Data contains a list of transactions. The contents of the transaction is unknown to Tendermint. | This field can be empty or populated, but no validation is performed. Applications can perform validation on individual transactions prior to block creation using [checkTx](../abci/abci.md#checktx). | | Evidence | [EvidenceList](#evidencelist) | Evidence contains a list of infractions committed by validators. | Can be empty, but when populated the validations rules from [evidenceList](#evidencelist) apply | -| LastCommit | [Commit](#commit) | The threshold-signed commit of the previous block. | Must not be nil, must carry no threshold block signature at the initial height, and must adhere to the validation rules of [commit](#commit). | +| LastCommit | [Commit](#commit) | The threshold-signed commit of the previous block. | Must not be nil, must carry no threshold block signature at the initial height, and must adhere to the validation rules of [commit](#commit), except for Beacon and AppHash: a LastCommit whose Beacon or AppHash breaks their rule, or does not have the bytes wire type, is read without both instead of refused, as releases that do not know the fields skip them. | | CoreChainLock | `CoreChainLock` (optional) | Core chain lock carried by the block. | When present, must pass `CoreChainLock.ValidateBasic`. | ## Execution @@ -207,6 +207,8 @@ Commit proves that a quorum decided a block: it carries the threshold-recovered | QuorumHash | slice of bytes (`[]byte`) | Hash of the quorum that signed the commit. | | | ThresholdBlockSignature | [Signature](#signature) | Threshold-recovered block signature. | At height >= 1, must be of length 96 | | ThresholdVoteExtensions | Array of [VoteExtension](#voteextension) | Threshold-recovered vote extensions. | No nil entries; every type must be a defined enum value | +| Beacon | slice of bytes (`[]byte`) | Random beacon: the threshold signature recovered from the prevotes of the commit round. Set from consensus version 2; empty before. Not covered by the commit's signature. | Must be empty with an empty AppHash, or 96 bytes with a 32-byte AppHash | +| AppHash | slice of bytes (`[]byte`) | App hash returned by `ApplyBlockRandomness` for the block and round, which the precommits sign through `BlockID.StateID`. Set from consensus version 2; empty before. Not covered by the commit's signature. | Must be empty with an empty Beacon, or 32 bytes with a 96-byte Beacon | ## BlockIDFlag From cd6b4ec820ee29fd5ca39f36f5ce5c2981f40d83 Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Sat, 7 Nov 2026 00:28:23 +0700 Subject: [PATCH 18/18] fix(store): keep unsigned randomness out of the canonical commit Nothing signs the beacon and app hash of a block's LastCommit, so a proposer can fill them with well-sized values. SaveBlock stored them as the canonical commit of the previous height, and LoadBlockCommit then served them through /commit and state sync. Drop them from that record. The block's parts keep them, as the encoding the next commit signs. Co-Authored-By: Claude Opus 5.5 --- UPGRADING.md | 3 ++- internal/store/store.go | 4 +++- internal/store/store_test.go | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/UPGRADING.md b/UPGRADING.md index b845d5504d..7d78eb5b9d 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -86,7 +86,8 @@ This release defines consensus versions 0 and 1 only and never calls it. - `Commit` and `CommitInfo` gain `beacon` and `app_hash`. At every consensus version, a commit whose beacon and app hash are not both empty, or exactly 96 and 32 bytes, is refused, and a block's last commit is read without malformed ones. Before consensus version 2, nodes drop well-sized ones - from the commits they adopt and from the last commit they pass to the application. + from the commits they adopt, from the previous height's commit they store from a block, and from the + last commit they pass to the application. ### ABCI: commit vote-extension verification diff --git a/internal/store/store.go b/internal/store/store.go index 29d6799d82..7eb8cad09c 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -602,7 +602,9 @@ func (bs *BlockStore) saveBlockToBatch(batch dbm.Batch, block *types.Block, bloc return err } - pbc := block.LastCommit.ToProto() + // Nothing signs the beacon and app hash of block.LastCommit, so a proposer can fill them. The block's + // parts keep them, as the encoding the next commit signs, but they are not the previous height's commit. + pbc := block.LastCommit.WithoutRandomBeacon().ToProto() blockCommitBytes := mustEncode(pbc) if err := batch.Set(blockCommitKey(height-1), blockCommitBytes); err != nil { return err diff --git a/internal/store/store_test.go b/internal/store/store_test.go index f5d4add5ba..d61dcd2329 100644 --- a/internal/store/store_test.go +++ b/internal/store/store_test.go @@ -1,6 +1,7 @@ package store import ( + "bytes" "context" "fmt" "os" @@ -620,3 +621,38 @@ func TestLoadBlockMistypedLastCommitRandomness(t *testing.T) { require.NotNil(t, loaded) require.Equal(t, block.Hash(), loaded.Hash()) } + +// TestSaveBlockDropsLastCommitRandomness is the regression test for a proposer that fills the beacon +// and app hash of its block's LastCommit, which nothing signs: they were stored as the canonical +// commit of the previous height, and served from there. The block's parts keep them, as the encoding +// the next commit signs. +func TestSaveBlockDropsLastCommitRandomness(t *testing.T) { + state, bs := makeStateAndBlockStore(t, t.TempDir()) + const height = int64(2) + state.LastBlockHeight = height - 1 + + lastCommit := makeTestCommit(t, state, height-1) + lastCommit.Beacon = bytes.Repeat([]byte{0x01}, types.SignatureSize) + lastCommit.AppHash = bytes.Repeat([]byte{0x02}, crypto.DefaultAppHashSize) + block, err := factory.MakeBlock(state, height, lastCommit, 0) + require.NoError(t, err) + parts, err := block.MakePartSet(types.BlockPartSizeBytes) + require.NoError(t, err) + + bs.SaveBlock(block, parts, makeTestCommit(t, state, height)) + + canonical := bs.LoadBlockCommit(height - 1) + require.NotNil(t, canonical) + require.Empty(t, canonical.Beacon) + require.Empty(t, canonical.AppHash) + require.Equal(t, lastCommit.Hash(), canonical.Hash()) + + for i := 0; i < int(parts.Total()); i++ { + require.Equal(t, parts.GetPart(i).Bytes, bs.LoadBlockPart(height, i).Bytes) + } + loaded := bs.LoadBlock(height) + require.NotNil(t, loaded) + require.Equal(t, lastCommit.Beacon, loaded.LastCommit.Beacon) + require.Equal(t, lastCommit.AppHash, loaded.LastCommit.AppHash) + require.NotEmpty(t, block.LastCommit.Beacon, "saving must not change the block") +}