mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 21:26:42 +00:00
fix(txJSON): L1 message type MarshalJSON (#630)
* fix(txJSON): L1 message type MarshalJSON * address comments * bump version * trigger ci * bump version * bump version
This commit is contained in:
parent
06a21f327d
commit
a807a41fd1
3 changed files with 16 additions and 5 deletions
|
|
@ -52,7 +52,7 @@ type txJSON struct {
|
||||||
Hash common.Hash `json:"hash"`
|
Hash common.Hash `json:"hash"`
|
||||||
|
|
||||||
// L1 message transaction fields:
|
// L1 message transaction fields:
|
||||||
Sender common.Address `json:"sender,omitempty"`
|
Sender *common.Address `json:"sender,omitempty"`
|
||||||
QueueIndex *hexutil.Uint64 `json:"queueIndex,omitempty"`
|
QueueIndex *hexutil.Uint64 `json:"queueIndex,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,6 +130,14 @@ func (tx *Transaction) MarshalJSON() ([]byte, error) {
|
||||||
yparity := itx.V.Uint64()
|
yparity := itx.V.Uint64()
|
||||||
enc.YParity = (*hexutil.Uint64)(&yparity)
|
enc.YParity = (*hexutil.Uint64)(&yparity)
|
||||||
|
|
||||||
|
case *L1MessageTx:
|
||||||
|
enc.QueueIndex = (*hexutil.Uint64)(&itx.QueueIndex)
|
||||||
|
enc.Gas = (*hexutil.Uint64)(&itx.Gas)
|
||||||
|
enc.To = tx.To()
|
||||||
|
enc.Value = (*hexutil.Big)(itx.Value)
|
||||||
|
enc.Input = (*hexutil.Bytes)(&itx.Data)
|
||||||
|
enc.Sender = &itx.Sender
|
||||||
|
|
||||||
case *BlobTx:
|
case *BlobTx:
|
||||||
enc.ChainID = (*hexutil.Big)(itx.ChainID.ToBig())
|
enc.ChainID = (*hexutil.Big)(itx.ChainID.ToBig())
|
||||||
enc.Nonce = (*hexutil.Uint64)(&itx.Nonce)
|
enc.Nonce = (*hexutil.Uint64)(&itx.Nonce)
|
||||||
|
|
@ -425,7 +433,10 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error {
|
||||||
return errors.New("missing required field 'input' in transaction")
|
return errors.New("missing required field 'input' in transaction")
|
||||||
}
|
}
|
||||||
itx.Data = *dec.Input
|
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:
|
default:
|
||||||
return ErrTxTypeNotSupported
|
return ErrTxTypeNotSupported
|
||||||
|
|
|
||||||
|
|
@ -1294,7 +1294,7 @@ type RPCTransaction struct {
|
||||||
S *hexutil.Big `json:"s"`
|
S *hexutil.Big `json:"s"`
|
||||||
|
|
||||||
// L1 message transaction fields:
|
// L1 message transaction fields:
|
||||||
Sender common.Address `json:"sender,omitempty"`
|
Sender *common.Address `json:"sender,omitempty"`
|
||||||
QueueIndex *hexutil.Uint64 `json:"queueIndex,omitempty"`
|
QueueIndex *hexutil.Uint64 `json:"queueIndex,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1344,7 +1344,7 @@ func NewRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber
|
||||||
}
|
}
|
||||||
case types.L1MessageTxType:
|
case types.L1MessageTxType:
|
||||||
msg := tx.AsL1MessageTx()
|
msg := tx.AsL1MessageTx()
|
||||||
result.Sender = msg.Sender
|
result.Sender = &msg.Sender
|
||||||
result.QueueIndex = (*hexutil.Uint64)(&msg.QueueIndex)
|
result.QueueIndex = (*hexutil.Uint64)(&msg.QueueIndex)
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import (
|
||||||
const (
|
const (
|
||||||
VersionMajor = 5 // Major version component of the current release
|
VersionMajor = 5 // Major version component of the current release
|
||||||
VersionMinor = 1 // Minor version component of the current release
|
VersionMinor = 1 // Minor version component of the current release
|
||||||
VersionPatch = 19 // Patch version component of the current release
|
VersionPatch = 20 // Patch version component of the current release
|
||||||
VersionMeta = "mainnet" // Version metadata to append to the version string
|
VersionMeta = "mainnet" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue