Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion beacon/engine/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ func SealBlock(bc *core.BlockChain, ub *types.UnsealedBlock) (*types.Block, erro
Nonce: types.EncodeNonce(0),
BaseFee: new(big.Int).SetUint64(ub.Env.Basefee),
WithdrawalsHash: withDrawalsHash,
BlobGasUsed: new(uint64),
BlobGasUsed: &ub.CumulativeBlobGasUsed,
ExcessBlobGas: new(uint64),
ParentBeaconRoot: &ub.Env.ParentBeaconBlockRoot,
RequestsHash: requestsHash,
Expand Down Expand Up @@ -536,6 +536,7 @@ type Seal struct {
StateRoot common.Hash `json:"stateRoot"`
WithdrawalsRoot common.Hash `json:"withdrawalsRoot"`
BlockHash common.Hash `json:"blockHash"`
BlobGasUsed uint64 `json:"blobGasUsed"`
}

type SignedEnv struct {
Expand Down
10 changes: 6 additions & 4 deletions core/blockchain_insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func (bc *BlockChain) InsertNewFrag(frag types.Frag) error {
Nonce: types.EncodeNonce(0),
BaseFee: new(big.Int).SetUint64(currentUnsealedBlock.Env.Basefee),
WithdrawalsHash: &types.EmptyWithdrawalsHash,
BlobGasUsed: new(uint64),
BlobGasUsed: &currentUnsealedBlock.CumulativeBlobGasUsed,
ExcessBlobGas: new(uint64),
ParentBeaconRoot: &currentUnsealedBlock.Env.ParentBeaconBlockRoot,
}).WithBody(types.Body{
Expand All @@ -216,15 +216,17 @@ func (bc *BlockChain) InsertNewFrag(frag types.Frag) error {
return err
}

for _, receipt := range res.Receipts {
currentUnsealedBlock.CumulativeBlobGasUsed += receipt.BlobGasUsed
}
// blob txs are not supported, blobGasUsed is used for DA footprint instead
// for _, receipt := range res.Receipts {
// currentUnsealedBlock.CumulativeBlobGasUsed += receipt.BlobGasUsed
// }

currentUnsealedBlock.Frags = append(currentUnsealedBlock.Frags, frag)
currentUnsealedBlock.LastSequenceNumber = &frag.Seq
currentUnsealedBlock.Receipts = append(currentUnsealedBlock.Receipts, res.Receipts...)
currentUnsealedBlock.Logs = append(currentUnsealedBlock.Logs, res.Logs...)
currentUnsealedBlock.CumulativeGasUsed = res.GasUsed
currentUnsealedBlock.CumulativeBlobGasUsed += frag.BlobGasUsed

return nil
}
5 changes: 5 additions & 0 deletions core/types/unsealed_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ type Frag struct {
BlockNumber uint64
Seq uint64
IsLast bool
BlobGasUsed uint64
Txs []*Transaction
}

Expand All @@ -103,6 +104,7 @@ func (f *Frag) UnmarshalJSON(data []byte) error {
BlockNumber uint64 `json:"blockNumber"`
Seq uint64 `json:"seq"`
IsLast bool `json:"isLast"`
BlobGasUsed uint64 `json:"blobGasUsed"`
Txs []hexutil.Bytes `json:"txs"`
}

Expand All @@ -114,6 +116,7 @@ func (f *Frag) UnmarshalJSON(data []byte) error {
f.BlockNumber = frag.BlockNumber
f.Seq = frag.Seq
f.IsLast = frag.IsLast
f.BlobGasUsed = frag.BlobGasUsed
f.Txs = make([]*Transaction, len(frag.Txs))

for i, txData := range frag.Txs {
Expand Down Expand Up @@ -144,11 +147,13 @@ func (f *Frag) MarshalJSON() ([]byte, error) {
Seq uint64 `json:"seq"`
IsLast bool `json:"isLast"`
WithdrawalsRoot common.Hash `json:"withdrawalsRoot"`
BlobGasUsed uint64 `json:"blobGasUsed"`
Txs [][]byte `json:"txs"`
}{
BlockNumber: f.BlockNumber,
Seq: f.Seq,
IsLast: f.IsLast,
BlobGasUsed: f.BlobGasUsed,
Txs: txs,
})
}
Expand Down
Loading