Skip to content

Commit

Permalink
fix test issue
Browse files Browse the repository at this point in the history
  • Loading branch information
forcodedancing committed Aug 11, 2023
1 parent edd9cc0 commit f1b1f69
Show file tree
Hide file tree
Showing 5 changed files with 268 additions and 121 deletions.
141 changes: 109 additions & 32 deletions api/cosmos/base/abci/v1beta1/abci.pulsar.go

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

11 changes: 10 additions & 1 deletion baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,20 @@ func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliv
app.deliverState.ctx.Logger().Debug("Gas info rw used", "RwUsed", gInfo.RwUsed, "height", app.deliverState.ctx.BlockHeight())
rwUsedBz := sdk.Uint64ToBigEndian(gInfo.RwUsed)

msgData := &sdk.TxMsgData{}
proto.Unmarshal(result.Data, msgData)
msgData.ExtraData = rwUsedBz
bz, err := proto.Marshal(msgData)
if err != nil {
resultStr = "failed"
return sdkerrors.ResponseDeliverTxWithEvents(err, gInfo.GasWanted, gInfo.GasUsed, sdk.MarkEventsToIndex(anteEvents, app.indexEvents), app.trace)
}

return abci.ResponseDeliverTx{
GasWanted: int64(gInfo.GasWanted), // TODO: Should type accept unsigned ints?
GasUsed: int64(gInfo.GasUsed), // TODO: Should type accept unsigned ints?
Log: result.Log,
Data: append(result.Data, rwUsedBz...),
Data: bz,
Events: sdk.MarkEventsToIndex(result.Events, app.indexEvents),
}
}
Expand Down
17 changes: 10 additions & 7 deletions proto/cosmos/base/abci/v1beta1/abci.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "gogoproto/gogo.proto";
import "tendermint/abci/types.proto";
import "google/protobuf/any.proto";

option go_package = "github.com/cosmos/cosmos-sdk/types";
option go_package = "github.com/cosmos/cosmos-sdk/types";
option (gogoproto.goproto_stringer_all) = false;

// TxResponse defines a structure containing relevant tx data and metadata. The
Expand Down Expand Up @@ -53,7 +53,7 @@ message ABCIMessageLog {
option (gogoproto.stringer) = true;

uint32 msg_index = 1 [(gogoproto.jsontag) = "msg_index"];
string log = 2;
string log = 2;

// Events contains a slice of Event objects that were emitted during some
// execution.
Expand All @@ -65,14 +65,14 @@ message ABCIMessageLog {
message StringEvent {
option (gogoproto.stringer) = true;

string type = 1;
string type = 1;
repeated Attribute attributes = 2 [(gogoproto.nullable) = false];
}

// Attribute defines an attribute wrapper where the key and value are
// strings instead of raw bytes.
message Attribute {
string key = 1;
string key = 1;
string value = 2;
}

Expand Down Expand Up @@ -118,17 +118,17 @@ message Result {
// successfully simulated.
message SimulationResponse {
GasInfo gas_info = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
Result result = 2;
Result result = 2;
}

// MsgData defines the data returned in a Result object during message
// execution.
message MsgData {
option deprecated = true;
option deprecated = true;
option (gogoproto.stringer) = true;

string msg_type = 1;
bytes data = 2;
bytes data = 2;
}

// TxMsgData defines a list of MsgData. A transaction will have a MsgData object
Expand All @@ -143,6 +143,9 @@ message TxMsgData {
//
// Since: cosmos-sdk 0.46
repeated google.protobuf.Any msg_responses = 2;

// extra data - the r/w info
bytes extra_data = 3;
}

// SearchTxsResult defines a structure for querying txs pageable
Expand Down
Loading

0 comments on commit f1b1f69

Please sign in to comment.