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
d4bf299f
Commit
d4bf299f
authored
Jan 19, 2022
by
Annie Ke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: regenerate receipt json for optimism fields
parent
9d9bbc93
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
12 deletions
+20
-12
big-pants-remain.md
.changeset/big-pants-remain.md
+5
-0
gen_receipt_json.go
l2geth/core/types/gen_receipt_json.go
+12
-12
receipt.go
l2geth/core/types/receipt.go
+3
-0
No files found.
.changeset/big-pants-remain.md
0 → 100644
View file @
d4bf299f
---
'
@eth-optimism/l2geth'
:
patch
---
Add support to fully unmarshal Receipts with Optimism fields
l2geth/core/types/gen_receipt_json.go
View file @
d4bf299f
...
...
@@ -27,9 +27,9 @@ func (r Receipt) MarshalJSON() ([]byte, error) {
BlockHash
common
.
Hash
`json:"blockHash,omitempty"`
BlockNumber
*
hexutil
.
Big
`json:"blockNumber,omitempty"`
TransactionIndex
hexutil
.
Uint
`json:"transactionIndex"`
L1GasPrice
*
big
.
Int
`json:"l1GasPrice" gencodec:"required"`
L1GasUsed
*
big
.
Int
`json:"l1GasUsed" gencodec:"required"`
L1Fee
*
big
.
Int
`json:"l1Fee" gencodec:"required"`
L1GasPrice
*
hexutil
.
Big
`json:"l1GasPrice" gencodec:"required"`
L1GasUsed
*
hexutil
.
Big
`json:"l1GasUsed" gencodec:"required"`
L1Fee
*
hexutil
.
Big
`json:"l1Fee" gencodec:"required"`
FeeScalar
*
big
.
Float
`json:"l1FeeScalar" gencodec:"required"`
}
var
enc
Receipt
...
...
@@ -44,9 +44,9 @@ func (r Receipt) MarshalJSON() ([]byte, error) {
enc
.
BlockHash
=
r
.
BlockHash
enc
.
BlockNumber
=
(
*
hexutil
.
Big
)(
r
.
BlockNumber
)
enc
.
TransactionIndex
=
hexutil
.
Uint
(
r
.
TransactionIndex
)
enc
.
L1GasPrice
=
r
.
L1GasPrice
enc
.
L1GasUsed
=
r
.
L1GasUsed
enc
.
L1Fee
=
r
.
L1Fee
enc
.
L1GasPrice
=
(
*
hexutil
.
Big
)(
r
.
L1GasPrice
)
enc
.
L1GasUsed
=
(
*
hexutil
.
Big
)(
r
.
L1GasUsed
)
enc
.
L1Fee
=
(
*
hexutil
.
Big
)(
r
.
L1Fee
)
enc
.
FeeScalar
=
r
.
FeeScalar
return
json
.
Marshal
(
&
enc
)
}
...
...
@@ -65,9 +65,9 @@ func (r *Receipt) UnmarshalJSON(input []byte) error {
BlockHash
*
common
.
Hash
`json:"blockHash,omitempty"`
BlockNumber
*
hexutil
.
Big
`json:"blockNumber,omitempty"`
TransactionIndex
*
hexutil
.
Uint
`json:"transactionIndex"`
L1GasPrice
*
big
.
Int
`json:"l1GasPrice" gencodec:"required"`
L1GasUsed
*
big
.
Int
`json:"l1GasUsed" gencodec:"required"`
L1Fee
*
big
.
Int
`json:"l1Fee" gencodec:"required"`
L1GasPrice
*
hexutil
.
Big
`json:"l1GasPrice" gencodec:"required"`
L1GasUsed
*
hexutil
.
Big
`json:"l1GasUsed" gencodec:"required"`
L1Fee
*
hexutil
.
Big
`json:"l1Fee" gencodec:"required"`
FeeScalar
*
big
.
Float
`json:"l1FeeScalar" gencodec:"required"`
}
var
dec
Receipt
...
...
@@ -115,15 +115,15 @@ func (r *Receipt) UnmarshalJSON(input []byte) error {
if
dec
.
L1GasPrice
==
nil
{
return
errors
.
New
(
"missing required field 'l1GasPrice' for Receipt"
)
}
r
.
L1GasPrice
=
dec
.
L1GasPrice
r
.
L1GasPrice
=
(
*
big
.
Int
)(
dec
.
L1GasPrice
)
if
dec
.
L1GasUsed
==
nil
{
return
errors
.
New
(
"missing required field 'l1GasUsed' for Receipt"
)
}
r
.
L1GasUsed
=
dec
.
L1GasUsed
r
.
L1GasUsed
=
(
*
big
.
Int
)(
dec
.
L1GasUsed
)
if
dec
.
L1Fee
==
nil
{
return
errors
.
New
(
"missing required field 'l1Fee' for Receipt"
)
}
r
.
L1Fee
=
dec
.
L1Fee
r
.
L1Fee
=
(
*
big
.
Int
)(
dec
.
L1Fee
)
if
dec
.
FeeScalar
==
nil
{
return
errors
.
New
(
"missing required field 'l1FeeScalar' for Receipt"
)
}
...
...
l2geth/core/types/receipt.go
View file @
d4bf299f
...
...
@@ -81,6 +81,9 @@ type receiptMarshaling struct {
GasUsed
hexutil
.
Uint64
BlockNumber
*
hexutil
.
Big
TransactionIndex
hexutil
.
Uint
L1GasPrice
*
hexutil
.
Big
L1GasUsed
*
hexutil
.
Big
L1Fee
*
hexutil
.
Big
}
// receiptRLP is the consensus encoding of a receipt.
...
...
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