Skip to content

Commit

Permalink
refactor: address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ninabarbakadze committed Aug 15, 2024
1 parent 88e363c commit 35b7617
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
37 changes: 18 additions & 19 deletions proto/tendermint/store/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
dbm "github.com/cometbft/cometbft-db"
"github.com/gogo/protobuf/proto"

abci "github.com/tendermint/tendermint/abci/types"
cmtsync "github.com/tendermint/tendermint/libs/sync"
cmtstore "github.com/tendermint/tendermint/proto/tendermint/store"
cmtproto "github.com/tendermint/tendermint/proto/tendermint/types"
Expand Down Expand Up @@ -470,9 +471,9 @@ func (bs *BlockStore) SaveTxInfo(block *types.Block, txResponseCodes []uint32, l
Index: uint32(i),
Code: txResponseCodes[i],
}
// Only add rawLog for failed transactions
if txResponseCodes[i] != 0 {
txInfo.RawLog = logs[i]
// Only save Logs for failed transactions
if txResponseCodes[i] != abci.CodeTypeOK {
txInfo.Log = logs[i]
}
txInfoBytes, err := proto.Marshal(&txInfo)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions store/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,9 @@ func TestSaveTxInfo(t *testing.T) {
require.Equal(t, txResponseCodes[i], txInfo.Code)
// We don't save the logs for successful transactions
if txResponseCodes[i] == 0 {
require.Equal(t, "", txInfo.RawLog)
require.Equal(t, "", txInfo.Log)
} else {
require.Equal(t, logs[i], txInfo.RawLog)
require.Equal(t, logs[i], txInfo.Log)
}
}
}
Expand All @@ -435,7 +435,7 @@ func TestSaveTxInfo(t *testing.T) {
require.Equal(t, txInfo.Height, int64(777))
require.Equal(t, uint32(1), txInfo.Code)
require.Equal(t, uint32(5), txInfo.Index)
require.Equal(t, "failure", txInfo.RawLog)
require.Equal(t, "failure", txInfo.Log)
}

func TestLoadBaseMeta(t *testing.T) {
Expand Down

0 comments on commit 35b7617

Please sign in to comment.