diff --git a/abci/example/kvstore/kvstore.go b/abci/example/kvstore/kvstore.go index f295243bd..3642bd95f 100644 --- a/abci/example/kvstore/kvstore.go +++ b/abci/example/kvstore/kvstore.go @@ -117,7 +117,7 @@ func (app *Application) Info(req types.RequestInfo) types.ResponseInfo { } // tx is either "val:pubkey!power" or "key=value" or just arbitrary bytes -func (app *Application) handleTx(tx []byte) *types.ResponseDeliverTx { +func (app *Application) handleTx(tx []byte) *types.ExecTxResult { // if it starts with "val:", update the validator set // format is "val:pubkey!power" if isValidatorTx(tx) { @@ -156,7 +156,7 @@ func (app *Application) handleTx(tx []byte) *types.ResponseDeliverTx { }, } - return &types.ResponseDeliverTx{Code: code.CodeTypeOK, Events: events} + return &types.ExecTxResult{Code: code.CodeTypeOK, TxEvents: events} } func (app *Application) Close() error { @@ -190,12 +190,11 @@ func (app *Application) FinalizeBlock(req types.RequestFinalizeBlock) types.Resp } } - respTxs := make([]*types.ResponseDeliverTx, len(req.Txs)) + respTxs := make([]*types.ExecTxResult, len(req.Txs)) for i, tx := range req.Txs { respTxs[i] = app.handleTx(tx) } - - return types.ResponseFinalizeBlock{Txs: respTxs, ValidatorUpdates: app.ValUpdates} + return types.ResponseFinalizeBlock{TxResults: respTxs, ValidatorUpdates: app.ValUpdates} } func (*Application) CheckTx(req types.RequestCheckTx) types.ResponseCheckTx { @@ -338,13 +337,13 @@ func isValidatorTx(tx []byte) bool { // format is "val:pubkey!power" // pubkey is a base64-encoded 32-byte ed25519 key -func (app *Application) execValidatorTx(tx []byte) *types.ResponseDeliverTx { +func (app *Application) execValidatorTx(tx []byte) *types.ExecTxResult { tx = tx[len(ValidatorSetChangePrefix):] // get the pubkey and power pubKeyAndPower := strings.Split(string(tx), "!") if len(pubKeyAndPower) != 2 { - return &types.ResponseDeliverTx{ + return &types.ExecTxResult{ Code: code.CodeTypeEncodingError, Log: fmt.Sprintf("Expected 'pubkey!power'. Got %v", pubKeyAndPower)} } @@ -353,7 +352,7 @@ func (app *Application) execValidatorTx(tx []byte) *types.ResponseDeliverTx { // decode the pubkey pubkey, err := base64.StdEncoding.DecodeString(pubkeyS) if err != nil { - return &types.ResponseDeliverTx{ + return &types.ExecTxResult{ Code: code.CodeTypeEncodingError, Log: fmt.Sprintf("Pubkey (%s) is invalid base64", pubkeyS)} } @@ -361,7 +360,7 @@ func (app *Application) execValidatorTx(tx []byte) *types.ResponseDeliverTx { // decode the power power, err := strconv.ParseInt(powerS, 10, 64) if err != nil { - return &types.ResponseDeliverTx{ + return &types.ExecTxResult{ Code: code.CodeTypeEncodingError, Log: fmt.Sprintf("Power (%s) is not an int", powerS)} } @@ -371,7 +370,7 @@ func (app *Application) execValidatorTx(tx []byte) *types.ResponseDeliverTx { } // add, update, or remove a validator -func (app *Application) updateValidator(v types.ValidatorUpdate) *types.ResponseDeliverTx { +func (app *Application) updateValidator(v types.ValidatorUpdate) *types.ExecTxResult { pubkey, err := encoding.PubKeyFromProto(v.PubKey) if err != nil { panic(fmt.Errorf("can't decode public key: %w", err)) @@ -386,7 +385,7 @@ func (app *Application) updateValidator(v types.ValidatorUpdate) *types.Response } if !hasKey { pubStr := base64.StdEncoding.EncodeToString(pubkey.Bytes()) - return &types.ResponseDeliverTx{ + return &types.ExecTxResult{ Code: code.CodeTypeUnauthorized, Log: fmt.Sprintf("Cannot remove non-existent validator %s", pubStr)} } @@ -398,7 +397,7 @@ func (app *Application) updateValidator(v types.ValidatorUpdate) *types.Response // add or update validator value := bytes.NewBuffer(make([]byte, 0)) if err := types.WriteMessage(&v, value); err != nil { - return &types.ResponseDeliverTx{ + return &types.ExecTxResult{ Code: code.CodeTypeEncodingError, Log: fmt.Sprintf("error encoding validator: %v", err)} } @@ -411,7 +410,7 @@ func (app *Application) updateValidator(v types.ValidatorUpdate) *types.Response // we only update the changes array if we successfully updated the tree app.ValUpdates = append(app.ValUpdates, v) - return &types.ResponseDeliverTx{Code: code.CodeTypeOK} + return &types.ExecTxResult{Code: code.CodeTypeOK} } // ----------------------------- @@ -425,9 +424,9 @@ func isPrepareTx(tx []byte) bool { // execPrepareTx is noop. tx data is considered as placeholder // and is substitute at the PrepareProposal. -func (app *Application) execPrepareTx(tx []byte) *types.ResponseDeliverTx { +func (app *Application) execPrepareTx(tx []byte) *types.ExecTxResult { // noop - return &types.ResponseDeliverTx{} + return &types.ExecTxResult{} } // substPrepareTx subst all the preparetx in the blockdata diff --git a/abci/types/application.go b/abci/types/application.go index 389de354e..cf4a1de82 100644 --- a/abci/types/application.go +++ b/abci/types/application.go @@ -108,7 +108,7 @@ func (BaseApplication) FinalizeBlock(req RequestFinalizeBlock) ResponseFinalizeB txs[i] = &ResponseDeliverTx{Code: CodeTypeOK} } return ResponseFinalizeBlock{ - Txs: txs, + TxResults: txs, } } diff --git a/cmd/tendermint/commands/reindex_event_test.go b/cmd/tendermint/commands/reindex_event_test.go index c525d4baa..4222cdd5b 100644 --- a/cmd/tendermint/commands/reindex_event_test.go +++ b/cmd/tendermint/commands/reindex_event_test.go @@ -156,7 +156,7 @@ func TestReIndexEvent(t *testing.T) { dtx := abcitypes.ResponseDeliverTx{} abciResp := &prototmstate.ABCIResponses{ FinalizeBlock: &abcitypes.ResponseFinalizeBlock{ - Txs: []*abcitypes.ResponseDeliverTx{&dtx}, + TxResults: []*abcitypes.ResponseDeliverTx{&dtx}, }, } diff --git a/internal/consensus/mempool_test.go b/internal/consensus/mempool_test.go index f0bd18958..5cb977c7a 100644 --- a/internal/consensus/mempool_test.go +++ b/internal/consensus/mempool_test.go @@ -278,7 +278,7 @@ func (app *CounterApplication) FinalizeBlock(req abci.RequestFinalizeBlock) abci app.txCount++ respTxs[i] = &abci.ResponseDeliverTx{Code: code.CodeTypeOK} } - return abci.ResponseFinalizeBlock{Txs: respTxs} + return abci.ResponseFinalizeBlock{TxResults: respTxs} } func (app *CounterApplication) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx { diff --git a/internal/inspect/inspect_test.go b/internal/inspect/inspect_test.go index 810706607..7d4dfc2c4 100644 --- a/internal/inspect/inspect_test.go +++ b/internal/inspect/inspect_test.go @@ -265,7 +265,7 @@ func TestBlockResults(t *testing.T) { // tmstate "github.com/tendermint/tendermint/proto/tendermint/state" stateStoreMock.On("LoadABCIResponses", testHeight).Return(&state.ABCIResponses{ FinalizeBlock: &abcitypes.ResponseFinalizeBlock{ - Txs: []*abcitypes.ResponseDeliverTx{ + TxResults: []*abcitypes.ResponseDeliverTx{ { GasUsed: testGasUsed, }, diff --git a/internal/rpc/core/blocks_test.go b/internal/rpc/core/blocks_test.go index 4baff9d38..6fa539c2d 100644 --- a/internal/rpc/core/blocks_test.go +++ b/internal/rpc/core/blocks_test.go @@ -72,7 +72,7 @@ func TestBlockchainInfo(t *testing.T) { func TestBlockResults(t *testing.T) { results := &tmstate.ABCIResponses{ FinalizeBlock: &abci.ResponseFinalizeBlock{ - Txs: []*abci.ResponseDeliverTx{ + TxResults: []*abci.ResponseDeliverTx{ {Code: 0, Data: []byte{0x01}, Log: "ok", GasUsed: 10}, {Code: 0, Data: []byte{0x02}, Log: "ok", GasUsed: 5}, {Code: 1, Log: "not ok", GasUsed: 0}, diff --git a/internal/state/helpers_test.go b/internal/state/helpers_test.go index a5720f183..f45167255 100644 --- a/internal/state/helpers_test.go +++ b/internal/state/helpers_test.go @@ -315,8 +315,8 @@ func (app *testApp) FinalizeBlock(req abci.RequestFinalizeBlock) abci.ResponseFi AppVersion: 1, }, }, - Events: []abci.Event{}, - Txs: resTxs, + Events: []abci.Event{}, + TxResults: resTxs, } } diff --git a/internal/state/state_test.go b/internal/state/state_test.go index e66cde77a..978487ea4 100644 --- a/internal/state/state_test.go +++ b/internal/state/state_test.go @@ -192,7 +192,7 @@ func TestABCIResponsesSaveLoad2(t *testing.T) { h := int64(i + 1) // last block height, one below what we save responses := &tmstate.ABCIResponses{ FinalizeBlock: &abci.ResponseFinalizeBlock{ - Txs: tc.added, + TxResults: tc.added, }, } err := stateStore.SaveABCIResponses(h, responses) @@ -207,7 +207,7 @@ func TestABCIResponsesSaveLoad2(t *testing.T) { t.Log(res) responses := &tmstate.ABCIResponses{ FinalizeBlock: &abci.ResponseFinalizeBlock{ - Txs: tc.expected, + TxResults: tc.expected, }, } sm.ABCIResponsesResultsHash(res) diff --git a/internal/state/store_test.go b/internal/state/store_test.go index fd9c4bf5a..27abb5a91 100644 --- a/internal/state/store_test.go +++ b/internal/state/store_test.go @@ -239,7 +239,7 @@ func TestPruneStates(t *testing.T) { err = stateStore.SaveABCIResponses(h, &tmstate.ABCIResponses{ FinalizeBlock: &abci.ResponseFinalizeBlock{ - Txs: []*abci.ResponseDeliverTx{ + TxResults: []*abci.ResponseDeliverTx{ {Data: []byte{1}}, {Data: []byte{2}}, {Data: []byte{3}}, @@ -303,7 +303,7 @@ func TestPruneStates(t *testing.T) { func TestABCIResponsesResultsHash(t *testing.T) { responses := &tmstate.ABCIResponses{ FinalizeBlock: &abci.ResponseFinalizeBlock{ - Txs: []*abci.ResponseDeliverTx{ + TxResults: []*abci.ResponseDeliverTx{ {Code: 32, Data: []byte("Hello"), Log: "Huh?"}, }, }, diff --git a/test/e2e/app/app.go b/test/e2e/app/app.go index c5e328053..b8df3bb3a 100644 --- a/test/e2e/app/app.go +++ b/test/e2e/app/app.go @@ -176,7 +176,7 @@ func (app *Application) FinalizeBlock(req abci.RequestFinalizeBlock) abci.Respon } return abci.ResponseFinalizeBlock{ - Txs: txs, + TxResults: txs, ValidatorUpdates: valUpdates, Events: []abci.Event{ {