diff --git a/core/types/transaction_marshalling.go b/core/types/transaction_marshalling.go index 39eb207628..892b48ec20 100644 --- a/core/types/transaction_marshalling.go +++ b/core/types/transaction_marshalling.go @@ -51,7 +51,7 @@ type txJSON struct { Hash common.Hash `json:"hash"` // L1 message transaction fields: - Sender common.Address `json:"sender,omitempty"` + Sender *common.Address `json:"sender,omitempty"` QueueIndex *hexutil.Uint64 `json:"queueIndex,omitempty"` } @@ -153,7 +153,7 @@ func (tx *Transaction) MarshalJSON() ([]byte, error) { enc.To = tx.To() enc.Value = (*hexutil.Big)(itx.Value) enc.Input = (*hexutil.Bytes)(&itx.Data) - enc.Sender = itx.Sender + enc.Sender = &itx.Sender } return json.Marshal(&enc) } @@ -438,7 +438,10 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error { return errors.New("missing required field 'input' in transaction") } itx.Data = *dec.Input - itx.Sender = dec.Sender + if dec.Sender == nil { + return errors.New("missing required field 'sender' in transaction") + } + itx.Sender = *dec.Sender default: return ErrTxTypeNotSupported diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index dcec75f93c..439b8a6f2d 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1518,7 +1518,7 @@ type RPCTransaction struct { YParity *hexutil.Uint64 `json:"yParity,omitempty"` // L1 message transaction fields: - Sender common.Address `json:"sender,omitempty"` + Sender *common.Address `json:"sender,omitempty"` QueueIndex *hexutil.Uint64 `json:"queueIndex,omitempty"` } @@ -1597,7 +1597,7 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber case types.L1MessageTxType: msg := tx.AsL1MessageTx() - result.Sender = msg.Sender + result.Sender = &msg.Sender result.QueueIndex = (*hexutil.Uint64)(&msg.QueueIndex) } return result