Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions venus-devtool/state-type-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ var stateTypesOpt = option{
// venus-shared/actors/types
var sharedTypesOpt = option{
skipStructs: map[string]struct{}{
"ActorV5": {},
"TempEthCall": {},
"ActorV5": {},
"EthCallDecode": {},
"EthCallRaw": {},
},
skipAllVar: false,
skipVars: []string{"Eip155ChainID"},
Expand Down
18 changes: 15 additions & 3 deletions venus-shared/actors/types/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,25 @@ func (c *EthCall) ToFilecoinMessage() (*Message, error) {
}

func (c *EthCall) UnmarshalJSON(b []byte) error {
type TempEthCall EthCall
var params TempEthCall
type EthCallRaw EthCall // Avoid a recursive call.
type EthCallDecode struct {
// The field should be "input" by spec, but many clients use "data" so we support
// both, but prefer "input".
Input *EthBytes `json:"input"`
EthCallRaw
}

var params EthCallDecode
if err := json.Unmarshal(b, &params); err != nil {
return err
}
*c = EthCall(params)

// If input is specified, prefer it.
if params.Input != nil {
params.Data = *params.Input
}

*c = EthCall(params.EthCallRaw)
return nil
}

Expand Down
Loading