Skip to content

Commit a8b0992

Browse files
feat: add signers field to TxStatus (#2593)
Fixes #2595
1 parent cdaab33 commit a8b0992

File tree

10 files changed

+378
-255
lines changed

10 files changed

+378
-255
lines changed

abci/example/kvstore/kvstore.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ func (app *Application) FinalizeBlock(_ context.Context, req *types.RequestFinal
273273
},
274274
},
275275
},
276+
Signers: []string{"kvstore-app"}, // set signers for the tx
276277
}
277278
app.state.Size++
278279
}

abci/types/types.pb.go

Lines changed: 283 additions & 227 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/tendermint/abci/types.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ message ExecTxResult {
452452
repeated Event events = 7
453453
[(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; // nondeterministic
454454
string codespace = 8;
455+
repeated string signers = 9;
455456
}
456457

457458
// TxResult contains results of executing the transaction.

proto/tendermint/store/types.pb.go

Lines changed: 76 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/tendermint/store/types.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ message TxInfo {
2424
int64 gas_wanted = 6;
2525
// Actual gas consumed
2626
int64 gas_used = 7;
27+
repeated string signers = 8; // tx signers
2728
}

rpc/client/rpc_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@ func TestTxStatus(t *testing.T) {
893893
require.Equal("COMMITTED", result.Status)
894894
require.Equal(abci.CodeTypeOK, result.ExecutionCode)
895895
require.Equal("", result.Error)
896+
require.Equal(bres.TxResult.Signers, result.Signers)
896897
}
897898

898899
func TestDataCommitment(t *testing.T) {

rpc/core/tx.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ func (env *Environment) TxStatus(ctx *rpctypes.Context, hash []byte) (*ctypes.Re
237237
Codespace: txInfo.Codespace,
238238
GasWanted: txInfo.GasWanted,
239239
GasUsed: txInfo.GasUsed,
240+
Signers: txInfo.Signers,
240241
}, nil
241242
}
242243

rpc/core/types/responses.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,15 @@ type ResultSignedBlock struct {
267267
// ResultTxStatus represents the status of a transaction during its life cycle.
268268
// It contains info to locate a tx in a committed block as well as its execution code, log if it fails and status.
269269
type ResultTxStatus struct {
270-
Height int64 `json:"height"`
271-
Index uint32 `json:"index"`
272-
ExecutionCode uint32 `json:"execution_code"`
273-
Error string `json:"error"`
274-
Status string `json:"status"`
275-
Codespace string `json:"codespace,omitempty"`
276-
GasWanted int64 `json:"gas_wanted,omitempty"`
277-
GasUsed int64 `json:"gas_used,omitempty"`
270+
Height int64 `json:"height"`
271+
Index uint32 `json:"index"`
272+
ExecutionCode uint32 `json:"execution_code"`
273+
Error string `json:"error"`
274+
Status string `json:"status"`
275+
Codespace string `json:"codespace,omitempty"`
276+
GasWanted int64 `json:"gas_wanted,omitempty"`
277+
GasUsed int64 `json:"gas_used,omitempty"`
278+
Signers []string `json:"signers,omitempty"`
278279
}
279280

280281
type ResultDataCommitment struct {

store/store.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ func (bs *BlockStore) SaveTxInfo(block *types.Block, execTxRes []*abci.ExecTxRes
812812
Codespace: result.Codespace,
813813
GasWanted: result.GasWanted,
814814
GasUsed: result.GasUsed,
815+
Signers: result.Signers,
815816
}
816817
// Set error log for failed txs
817818
if result.Code != abci.CodeTypeOK {

store/store_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,7 @@ func TestSaveTxInfo(t *testing.T) {
795795
Data: []byte("success_data"),
796796
Info: "successful execution",
797797
Codespace: "",
798+
Signers: []string{"signer1"},
798799
}
799800
} else {
800801
txResult = &abci.ExecTxResult{
@@ -805,6 +806,7 @@ func TestSaveTxInfo(t *testing.T) {
805806
Data: []byte(""),
806807
Info: "failed execution",
807808
Codespace: "app",
809+
Signers: []string{"signer2"},
808810
}
809811
}
810812

@@ -831,11 +833,13 @@ func TestSaveTxInfo(t *testing.T) {
831833
require.Equal(t, "", txInfo.Codespace)
832834
require.Equal(t, int64(75000), txInfo.GasUsed)
833835
require.Equal(t, int64(100000), txInfo.GasWanted)
836+
require.Equal(t, []string{"signer1"}, txInfo.Signers)
834837
} else {
835838
require.Equal(t, "app", txInfo.Codespace)
836839
require.Equal(t, int64(25000), txInfo.GasUsed)
837840
require.Equal(t, int64(50000), txInfo.GasWanted)
838841
require.Equal(t, allTxLogs[txIndex], txInfo.Error)
842+
require.Equal(t, []string{"signer2"}, txInfo.Signers)
839843
}
840844
txIndex++
841845
}

0 commit comments

Comments
 (0)