gencodec icon indicating copy to clipboard operation
gencodec copied to clipboard

Field override is failing

Open rjl493456442 opened this issue 6 months ago • 5 comments

The issue occurs when I try to replace **big.Int with **hexutil.Big.

//go:generate go run github.com/fjl/gencodec -type OverrideAccount -field-override overrideMarshaling -out gen_override_json.go

// OverrideAccount indicates the overriding fields of account during the
// execution of a message call.
//
// Note, state and stateDiff can't be specified at the same time.
// - If state is set, state lookup will be performed in this state set first;
// - If statDiff is set, state lookup will be performed in the diff set first;
type OverrideAccount struct {
	Nonce     *uint64                      `json:"nonce"`
	Code      *[]byte                      `json:"code"`
	Balance   **big.Int                    `json:"balance"`
	State     *map[common.Hash]common.Hash `json:"state"`
	StateDiff *map[common.Hash]common.Hash `json:"stateDiff"`
}

// nolint
type overrideMarshaling struct {
	Nonce   *hexutil.Uint64
	Code    *hexutil.Bytes
	Balance **hexutil.Big
}

Error message is

/usr/local/go/bin/go generate -run go run github.com/fjl/gencodec -type OverrideAccount -field-override overrideMarshaling -out gen_override_json.go -: invalid field override: type **github.com/ethereum/go-ethereum/common/hexutil.Big is not convertible to **math/big.Int exit status 1 overrides.go:28: running "go": exit status 1

rjl493456442 avatar Jan 11 '24 08:01 rjl493456442