refactor: remove bytes/HexBytes (#15211)
Co-authored-by: chixiaowen <chixiaowen@zhigui.com>
This commit is contained in:
co-authored by
chixiaowen
parent
23ef32a35c
commit
a49151d693
+2
-3
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
"cosmossdk.io/log"
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
cmtbytes "github.com/cometbft/cometbft/libs/bytes"
|
||||
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
|
||||
@@ -26,7 +25,7 @@ type Context struct {
|
||||
baseCtx context.Context
|
||||
ms storetypes.MultiStore
|
||||
header cmtproto.Header
|
||||
headerHash cmtbytes.HexBytes
|
||||
headerHash []byte
|
||||
chainID string
|
||||
txBytes []byte
|
||||
logger log.Logger
|
||||
@@ -72,7 +71,7 @@ func (c Context) BlockHeader() cmtproto.Header {
|
||||
}
|
||||
|
||||
// HeaderHash returns a copy of the header hash obtained during abci.RequestBeginBlock
|
||||
func (c Context) HeaderHash() cmtbytes.HexBytes {
|
||||
func (c Context) HeaderHash() []byte {
|
||||
hash := make([]byte, len(c.headerHash))
|
||||
copy(hash, c.headerHash)
|
||||
return hash
|
||||
|
||||
@@ -121,7 +121,7 @@ func (s *contextTestSuite) TestContextWithCustom() {
|
||||
s.Require().Equal(meter, ctx.GasMeter())
|
||||
s.Require().Equal(minGasPrices, ctx.MinGasPrices())
|
||||
s.Require().Equal(blockGasMeter, ctx.BlockGasMeter())
|
||||
s.Require().Equal(headerHash, ctx.HeaderHash().Bytes())
|
||||
s.Require().Equal(headerHash, ctx.HeaderHash())
|
||||
s.Require().False(ctx.WithIsCheckTx(false).IsCheckTx())
|
||||
s.Require().Equal(zeroGasCfg, ctx.KVGasConfig())
|
||||
s.Require().Equal(zeroGasCfg, ctx.TransientKVGasConfig())
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"time"
|
||||
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
"github.com/cometbft/cometbft/libs/bytes"
|
||||
coretypes "github.com/cometbft/cometbft/rpc/core/types"
|
||||
"github.com/golang/protobuf/proto" //nolint:staticcheck // grpc-gateway uses deprecated golang/protobuf
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -81,7 +80,7 @@ func (s *resultTestSuite) TestResponseResultTx() {
|
||||
GasUsed: 90,
|
||||
}
|
||||
resultTx := &coretypes.ResultTx{
|
||||
Hash: bytes.HexBytes([]byte("test")),
|
||||
Hash: []byte("test"),
|
||||
Height: 10,
|
||||
TxResult: deliverTxResult,
|
||||
}
|
||||
@@ -128,7 +127,7 @@ txhash: "74657374"
|
||||
Codespace: "codespace",
|
||||
Data: []byte("data"),
|
||||
Log: `[]`,
|
||||
Hash: bytes.HexBytes([]byte("test")),
|
||||
Hash: []byte("test"),
|
||||
}
|
||||
|
||||
s.Require().Equal(&sdk.TxResponse{
|
||||
|
||||
Reference in New Issue
Block a user