mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Fix base fee endianness (#10253)
This commit is contained in:
@@ -187,7 +187,7 @@ func (e *ExecutionPayload) MarshalJSON() ([]byte, error) {
|
||||
for i, tx := range e.Transactions {
|
||||
transactions[i] = tx
|
||||
}
|
||||
baseFee := new(big.Int).SetBytes(e.BaseFeePerGas)
|
||||
baseFee := new(big.Int).SetBytes(bytesutil.ReverseByteOrder(e.BaseFeePerGas))
|
||||
baseFeeHex := hexutil.EncodeBig(baseFee)
|
||||
return json.Marshal(executionPayloadJSON{
|
||||
ParentHash: e.ParentHash,
|
||||
|
||||
@@ -79,6 +79,7 @@ func TestJsonMarshalUnmarshal(t *testing.T) {
|
||||
})
|
||||
t.Run("execution payload", func(t *testing.T) {
|
||||
baseFeePerGas := big.NewInt(6)
|
||||
baseFeePerGasBytes := bytesutil.ReverseByteOrder(baseFeePerGas.Bytes())
|
||||
parentHash := bytesutil.PadTo([]byte("parent"), fieldparams.RootLength)
|
||||
feeRecipient := bytesutil.PadTo([]byte("feeRecipient"), fieldparams.FeeRecipientLength)
|
||||
stateRoot := bytesutil.PadTo([]byte("stateRoot"), fieldparams.RootLength)
|
||||
@@ -99,7 +100,7 @@ func TestJsonMarshalUnmarshal(t *testing.T) {
|
||||
GasUsed: 3,
|
||||
Timestamp: 4,
|
||||
ExtraData: extra,
|
||||
BaseFeePerGas: baseFeePerGas.Bytes(),
|
||||
BaseFeePerGas: baseFeePerGasBytes,
|
||||
BlockHash: hash,
|
||||
Transactions: [][]byte{[]byte("hi")},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user