Skip to content

Commit e70e1c4

Browse files
committed
added BlobGasUsed in NewFrag and Seal
1 parent 450dc5f commit e70e1c4

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

op-node/rollup/engine/preconf.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func NewPreconfChannels() PreconfChannels {
4949
EnvCh: make(chan *eth.SignedEnv),
5050
NewFragCh: make(chan *eth.SignedNewFrag),
5151
SealCh: make(chan *eth.SignedSeal),
52-
l2BlockCh: make(chan *eth.L2BlockRef),
52+
l2BlockCh: make(chan *eth.L2BlockRef, 10),
5353
}
5454
}
5555

op-service/eth/ssz.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ func (envelope *ExecutionPayloadEnvelope) MarshalSSZ(w io.Writer) (n int, err er
522522
return hashSize + payloadSize, nil
523523
}
524524

525-
// block number, squence number, is_last, txs offset, version.
526-
const NewFragFixedSize = 8 + 8 + 1 + 4 + 8
525+
// block number, squence number, is_last, txs offset, version + blob gas used.
526+
const NewFragFixedSize = 8 + 8 + 1 + 4 + 8 + 8
527527

528528
// UnmarshalSSZ decodes the NewFrag as SSZ type
529529
func (newFrag *NewFrag) UnmarshalSSZ(scope uint32, r io.Reader) error {
@@ -574,7 +574,7 @@ func (signedNewFrag *SignedNewFrag) MarshalSSZ(w io.Writer) error {
574574
return nil
575575
}
576576

577-
func (s *Seal) SizeSSZ(siz *ssz.Sizer) uint32 { return 32*4 + 8*4 }
577+
func (s *Seal) SizeSSZ(siz *ssz.Sizer) uint32 { return 32*4 + 8*4 + 8 }
578578

579579
func (s *Seal) DefineSSZ(codec *ssz.Codec) {
580580
ssz.DefineUint64(codec, &s.TotalFrags)
@@ -586,11 +586,12 @@ func (s *Seal) DefineSSZ(codec *ssz.Codec) {
586586
ssz.DefineStaticBytes(codec, &s.ReceiptsRoot)
587587
ssz.DefineStaticBytes(codec, &s.StateRoot)
588588
ssz.DefineStaticBytes(codec, &s.BlockHash)
589+
ssz.DefineUint64(codec, &s.BlobGasUsed)
589590
}
590591

591592
func (f *NewFrag) SizeSSZ(siz *ssz.Sizer, fixed bool) uint32 {
592-
// fixed size, 2 uint64 + 1 bool + 1 offset
593-
size := uint32(8*2 + 1 + 4)
593+
// Fixed size: BlockNumber(8) + Seq(8) + IsLast(1) + TxsOffset(4) + BlobGasUsed(8)
594+
size := uint32(8*2 + 1 + 4 + 8)
594595
if fixed {
595596
return size
596597
}
@@ -608,9 +609,10 @@ func (f *NewFrag) DefineSSZ(codec *ssz.Codec) {
608609
ssz.DefineUint64(codec, &f.BlockNumber)
609610
ssz.DefineUint64(codec, &f.Seq)
610611
ssz.DefineBool(codec, &f.IsLast)
611-
ssz.DefineSliceOfDynamicBytesOffset(codec, &f.Txs, MaxTxAmount, MaxTxsSize)
612+
ssz.DefineUint64(codec, &f.BlobGasUsed)
612613

613614
// Variable size section
615+
ssz.DefineSliceOfDynamicBytesOffset(codec, &f.Txs, MaxTxAmount, MaxTxsSize)
614616
ssz.DefineSliceOfDynamicBytesContent(codec, &f.Txs, MaxTxAmount, MaxTxsSize)
615617
}
616618

op-service/eth/types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ type NewFrag struct {
246246
BlockNumber uint64 `ssz-size:"8"`
247247
Seq uint64 `ssz-size:"8"`
248248
IsLast bool `ssz-size:"1"`
249+
BlobGasUsed uint64 `ssz-size:"8"`
249250
Txs [][]byte `ssz-max:"1048576,1073741824"`
250251
}
251252

@@ -254,6 +255,7 @@ func (f *NewFrag) UnmarshalJSON(data []byte) error {
254255
BlockNumber uint64 `json:"blockNumber"`
255256
Seq uint64 `json:"seq"`
256257
IsLast bool `json:"isLast"`
258+
BlobGasUsed uint64 `json:"blobGasUsed"`
257259
Txs []hexutil.Bytes `json:"txs"`
258260
}
259261

@@ -265,6 +267,7 @@ func (f *NewFrag) UnmarshalJSON(data []byte) error {
265267
f.BlockNumber = frag.BlockNumber
266268
f.Seq = frag.Seq
267269
f.IsLast = frag.IsLast
270+
f.BlobGasUsed = frag.BlobGasUsed
268271
f.Txs = make([][]byte, len(frag.Txs))
269272
for i, tx := range frag.Txs {
270273
f.Txs[i] = tx
@@ -283,11 +286,13 @@ func (f *NewFrag) MarshalJSON() ([]byte, error) {
283286
BlockNumber uint64 `json:"blockNumber"`
284287
Seq uint64 `json:"seq"`
285288
IsLast bool `json:"isLast"`
289+
BlobGasUsed uint64 `json:"blobGasUsed"`
286290
Txs []hexutil.Bytes `json:"txs"`
287291
}{
288292
BlockNumber: f.BlockNumber,
289293
Seq: f.Seq,
290294
IsLast: f.IsLast,
295+
BlobGasUsed: f.BlobGasUsed,
291296
Txs: txs,
292297
})
293298
}
@@ -308,6 +313,7 @@ type Seal struct {
308313
ReceiptsRoot Bytes32 `json:"receiptsRoot" ssz-size:"32"`
309314
StateRoot Bytes32 `json:"stateRoot" ssz-size:"32"`
310315
BlockHash Bytes32 `json:"blockHash" ssz-size:"32"`
316+
BlobGasUsed uint64 `json:"blobGasUsed" ssz-size:"8"`
311317
}
312318

313319
type SignedEnv struct {

0 commit comments

Comments
 (0)