forked from cerc-io/laconicd-deprecated
evm, rpc: fix tx log attribute value is not parsable by some client (#615)
* Problem: tx log attribute value not parsable by some client Closes: #614 Solution: - encode the value to json string rather than bytes Apply suggestions from code review * rm cdc and changelog Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> Co-authored-by: Federico Kunze <federico.kunze94@gmail.com>
This commit is contained in:
co-authored by
Federico Kunze Küllmer
Federico Kunze
parent
d6423f0c3f
commit
cda968bddd
@@ -2,6 +2,7 @@ package keeper
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/palantir/stacktrace"
|
||||
@@ -54,8 +55,11 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
|
||||
|
||||
txLogAttrs := make([]sdk.Attribute, 0)
|
||||
for _, log := range response.Logs {
|
||||
bz := k.cdc.MustMarshal(log)
|
||||
txLogAttrs = append(txLogAttrs, sdk.NewAttribute(types.AttributeKeyTxLog, string(bz)))
|
||||
value, err := json.Marshal(log)
|
||||
if err != nil {
|
||||
return nil, stacktrace.Propagate(err, "failed to encode log")
|
||||
}
|
||||
txLogAttrs = append(txLogAttrs, sdk.NewAttribute(types.AttributeKeyTxLog, string(value)))
|
||||
}
|
||||
|
||||
// emit events
|
||||
|
||||
Reference in New Issue
Block a user