Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
624db0cf
Unverified
Commit
624db0cf
authored
Feb 14, 2023
by
mergify[bot]
Committed by
GitHub
Feb 14, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4870 from ethereum-optimism/sc/opn-expose-gasused
feat(opn): expose GasUsed in BlockInfo type
parents
c1153b27
417e5dd9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
+17
-0
block_info.go
op-node/eth/block_info.go
+5
-0
types.go
op-node/sources/types.go
+6
-0
l1info.go
op-node/testutils/l1info.go
+6
-0
No files found.
op-node/eth/block_info.go
View file @
624db0cf
...
...
@@ -20,6 +20,7 @@ type BlockInfo interface {
MixDigest
()
common
.
Hash
BaseFee
()
*
big
.
Int
ReceiptHash
()
common
.
Hash
GasUsed
()
uint64
}
func
InfoToL1BlockRef
(
info
BlockInfo
)
L1BlockRef
{
...
...
@@ -79,6 +80,10 @@ func (h headerBlockInfo) ReceiptHash() common.Hash {
return
h
.
Header
.
ReceiptHash
}
func
(
h
headerBlockInfo
)
GasUsed
()
uint64
{
return
h
.
Header
.
GasUsed
}
// HeaderBlockInfo returns h as a BlockInfo implementation.
func
HeaderBlockInfo
(
h
*
types
.
Header
)
BlockInfo
{
return
headerBlockInfo
{
h
}
...
...
op-node/sources/types.go
View file @
624db0cf
...
...
@@ -46,6 +46,7 @@ type HeaderInfo struct {
baseFee
*
big
.
Int
txHash
common
.
Hash
receiptHash
common
.
Hash
gasUsed
uint64
}
var
_
eth
.
BlockInfo
=
(
*
HeaderInfo
)(
nil
)
...
...
@@ -90,6 +91,10 @@ func (info *HeaderInfo) ReceiptHash() common.Hash {
return
info
.
receiptHash
}
func
(
info
*
HeaderInfo
)
GasUsed
()
uint64
{
return
info
.
gasUsed
}
type
rpcHeader
struct
{
ParentHash
common
.
Hash
`json:"parentHash"`
UncleHash
common
.
Hash
`json:"sha3Uncles"`
...
...
@@ -182,6 +187,7 @@ func (hdr *rpcHeader) Info(trustCache bool, mustBePostMerge bool) (*HeaderInfo,
baseFee
:
(
*
big
.
Int
)(
hdr
.
BaseFee
),
txHash
:
hdr
.
TxHash
,
receiptHash
:
hdr
.
ReceiptHash
,
gasUsed
:
uint64
(
hdr
.
GasUsed
),
}
return
&
info
,
nil
}
...
...
op-node/testutils/l1info.go
View file @
624db0cf
...
...
@@ -21,6 +21,7 @@ type MockBlockInfo struct {
InfoMixDigest
[
32
]
byte
InfoBaseFee
*
big
.
Int
InfoReceiptRoot
common
.
Hash
InfoGasUsed
uint64
}
func
(
l
*
MockBlockInfo
)
Hash
()
common
.
Hash
{
...
...
@@ -59,6 +60,10 @@ func (l *MockBlockInfo) ReceiptHash() common.Hash {
return
l
.
InfoReceiptRoot
}
func
(
l
*
MockBlockInfo
)
GasUsed
()
uint64
{
return
l
.
InfoGasUsed
}
func
(
l
*
MockBlockInfo
)
ID
()
eth
.
BlockID
{
return
eth
.
BlockID
{
Hash
:
l
.
InfoHash
,
Number
:
l
.
InfoNum
}
}
...
...
@@ -81,6 +86,7 @@ func RandomBlockInfo(rng *rand.Rand) *MockBlockInfo {
InfoBaseFee
:
big
.
NewInt
(
rng
.
Int63n
(
1000
_000
*
1e9
)),
// a million GWEI
InfoReceiptRoot
:
types
.
EmptyRootHash
,
InfoRoot
:
RandomHash
(
rng
),
InfoGasUsed
:
rng
.
Uint64
(),
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment