Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
张蕾
Geth-Modification
Commits
d9556533
Unverified
Commit
d9556533
authored
Jul 27, 2023
by
Marius van der Wijden
Committed by
GitHub
Jul 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/types: put header fields in correct order (#27791)
parent
57268f7e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
16 deletions
+16
-16
block.go
core/types/block.go
+4
-4
gen_header_json.go
core/types/gen_header_json.go
+6
-6
gen_header_rlp.go
core/types/gen_header_rlp.go
+6
-6
No files found.
core/types/block.go
View file @
d9556533
...
...
@@ -85,11 +85,11 @@ type Header struct {
// WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers.
WithdrawalsHash
*
common
.
Hash
`json:"withdrawalsRoot" rlp:"optional"`
// ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers.
ExcessBlobGas
*
uint64
`json:"excessBlobGas" rlp:"optional"`
// BlobGasUsed was added by EIP-4844 and is ignored in legacy headers.
BlobGasUsed
*
uint64
`json:"blobGasUsed" rlp:"optional"`
// ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers.
ExcessBlobGas
*
uint64
`json:"excessBlobGas" rlp:"optional"`
}
// field type overrides for gencodec
...
...
@@ -102,8 +102,8 @@ type headerMarshaling struct {
Extra
hexutil
.
Bytes
BaseFee
*
hexutil
.
Big
Hash
common
.
Hash
`json:"hash"`
// adds call to Hash() in MarshalJSON
ExcessBlobGas
*
hexutil
.
Uint64
BlobGasUsed
*
hexutil
.
Uint64
ExcessBlobGas
*
hexutil
.
Uint64
}
// Hash returns the block hash of the header, which is simply the keccak256 hash of its
...
...
core/types/gen_header_json.go
View file @
d9556533
...
...
@@ -33,8 +33,8 @@ func (h Header) MarshalJSON() ([]byte, error) {
Nonce
BlockNonce
`json:"nonce"`
BaseFee
*
hexutil
.
Big
`json:"baseFeePerGas" rlp:"optional"`
WithdrawalsHash
*
common
.
Hash
`json:"withdrawalsRoot" rlp:"optional"`
ExcessBlobGas
*
hexutil
.
Uint64
`json:"excessBlobGas" rlp:"optional"`
BlobGasUsed
*
hexutil
.
Uint64
`json:"blobGasUsed" rlp:"optional"`
ExcessBlobGas
*
hexutil
.
Uint64
`json:"excessBlobGas" rlp:"optional"`
Hash
common
.
Hash
`json:"hash"`
}
var
enc
Header
...
...
@@ -55,8 +55,8 @@ func (h Header) MarshalJSON() ([]byte, error) {
enc
.
Nonce
=
h
.
Nonce
enc
.
BaseFee
=
(
*
hexutil
.
Big
)(
h
.
BaseFee
)
enc
.
WithdrawalsHash
=
h
.
WithdrawalsHash
enc
.
ExcessBlobGas
=
(
*
hexutil
.
Uint64
)(
h
.
ExcessBlobGas
)
enc
.
BlobGasUsed
=
(
*
hexutil
.
Uint64
)(
h
.
BlobGasUsed
)
enc
.
ExcessBlobGas
=
(
*
hexutil
.
Uint64
)(
h
.
ExcessBlobGas
)
enc
.
Hash
=
h
.
Hash
()
return
json
.
Marshal
(
&
enc
)
}
...
...
@@ -81,8 +81,8 @@ func (h *Header) UnmarshalJSON(input []byte) error {
Nonce
*
BlockNonce
`json:"nonce"`
BaseFee
*
hexutil
.
Big
`json:"baseFeePerGas" rlp:"optional"`
WithdrawalsHash
*
common
.
Hash
`json:"withdrawalsRoot" rlp:"optional"`
ExcessBlobGas
*
hexutil
.
Uint64
`json:"excessBlobGas" rlp:"optional"`
BlobGasUsed
*
hexutil
.
Uint64
`json:"blobGasUsed" rlp:"optional"`
ExcessBlobGas
*
hexutil
.
Uint64
`json:"excessBlobGas" rlp:"optional"`
}
var
dec
Header
if
err
:=
json
.
Unmarshal
(
input
,
&
dec
);
err
!=
nil
{
...
...
@@ -151,11 +151,11 @@ func (h *Header) UnmarshalJSON(input []byte) error {
if
dec
.
WithdrawalsHash
!=
nil
{
h
.
WithdrawalsHash
=
dec
.
WithdrawalsHash
}
if
dec
.
ExcessBlobGas
!=
nil
{
h
.
ExcessBlobGas
=
(
*
uint64
)(
dec
.
ExcessBlobGas
)
}
if
dec
.
BlobGasUsed
!=
nil
{
h
.
BlobGasUsed
=
(
*
uint64
)(
dec
.
BlobGasUsed
)
}
if
dec
.
ExcessBlobGas
!=
nil
{
h
.
ExcessBlobGas
=
(
*
uint64
)(
dec
.
ExcessBlobGas
)
}
return
nil
}
core/types/gen_header_rlp.go
View file @
d9556533
...
...
@@ -42,8 +42,8 @@ func (obj *Header) EncodeRLP(_w io.Writer) error {
w
.
WriteBytes
(
obj
.
Nonce
[
:
])
_tmp1
:=
obj
.
BaseFee
!=
nil
_tmp2
:=
obj
.
WithdrawalsHash
!=
nil
_tmp3
:=
obj
.
ExcessBlobGas
!=
nil
_tmp4
:=
obj
.
BlobGasUsed
!=
nil
_tmp3
:=
obj
.
BlobGasUsed
!=
nil
_tmp4
:=
obj
.
ExcessBlobGas
!=
nil
if
_tmp1
||
_tmp2
||
_tmp3
||
_tmp4
{
if
obj
.
BaseFee
==
nil
{
w
.
Write
(
rlp
.
EmptyString
)
...
...
@@ -62,17 +62,17 @@ func (obj *Header) EncodeRLP(_w io.Writer) error {
}
}
if
_tmp3
||
_tmp4
{
if
obj
.
ExcessBlobGas
==
nil
{
if
obj
.
BlobGasUsed
==
nil
{
w
.
Write
([]
byte
{
0x80
})
}
else
{
w
.
WriteUint64
((
*
obj
.
ExcessBlobGas
))
w
.
WriteUint64
((
*
obj
.
BlobGasUsed
))
}
}
if
_tmp4
{
if
obj
.
BlobGasUsed
==
nil
{
if
obj
.
ExcessBlobGas
==
nil
{
w
.
Write
([]
byte
{
0x80
})
}
else
{
w
.
WriteUint64
((
*
obj
.
BlobGasUsed
))
w
.
WriteUint64
((
*
obj
.
ExcessBlobGas
))
}
}
w
.
ListEnd
(
_tmp0
)
...
...
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