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
20f8eb75
Unverified
Commit
20f8eb75
authored
Mar 22, 2023
by
Marius van der Wijden
Committed by
GitHub
Mar 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/catalyst: fix races (#26950)
parent
b3f43c89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
9 deletions
+27
-9
api_test.go
eth/catalyst/api_test.go
+27
-9
No files found.
eth/catalyst/api_test.go
View file @
20f8eb75
...
...
@@ -879,15 +879,10 @@ func TestNewPayloadOnInvalidTerminalBlock(t *testing.T) {
genesis
,
preMergeBlocks
:=
generateMergeChain
(
100
,
false
)
n
,
ethservice
:=
startEthService
(
t
,
genesis
,
preMergeBlocks
)
defer
n
.
Close
()
ethservice
.
BlockChain
()
.
Config
()
.
TerminalTotalDifficulty
=
preMergeBlocks
[
0
]
.
Difficulty
()
//.Sub(genesis.Config.TerminalTotalDifficulty, preMergeBlocks[len(preMergeBlocks)-1].Difficulty())
var
(
api
=
NewConsensusAPI
(
ethservice
)
parent
=
preMergeBlocks
[
len
(
preMergeBlocks
)
-
1
]
)
api
:=
NewConsensusAPI
(
ethservice
)
// Test parent already post TTD in FCU
parent
:=
preMergeBlocks
[
len
(
preMergeBlocks
)
-
2
]
fcState
:=
engine
.
ForkchoiceStateV1
{
HeadBlockHash
:
parent
.
Hash
(),
SafeBlockHash
:
common
.
Hash
{},
...
...
@@ -913,6 +908,28 @@ func TestNewPayloadOnInvalidTerminalBlock(t *testing.T) {
t
.
Fatalf
(
"error preparing payload, err=%v"
,
err
)
}
data
:=
*
payload
.
Resolve
()
.
ExecutionPayload
// We need to recompute the blockhash, since the miner computes a wrong (correct) blockhash
txs
,
_
:=
decodeTransactions
(
data
.
Transactions
)
header
:=
&
types
.
Header
{
ParentHash
:
data
.
ParentHash
,
UncleHash
:
types
.
EmptyUncleHash
,
Coinbase
:
data
.
FeeRecipient
,
Root
:
data
.
StateRoot
,
TxHash
:
types
.
DeriveSha
(
types
.
Transactions
(
txs
),
trie
.
NewStackTrie
(
nil
)),
ReceiptHash
:
data
.
ReceiptsRoot
,
Bloom
:
types
.
BytesToBloom
(
data
.
LogsBloom
),
Difficulty
:
common
.
Big0
,
Number
:
new
(
big
.
Int
)
.
SetUint64
(
data
.
Number
),
GasLimit
:
data
.
GasLimit
,
GasUsed
:
data
.
GasUsed
,
Time
:
data
.
Timestamp
,
BaseFee
:
data
.
BaseFeePerGas
,
Extra
:
data
.
ExtraData
,
MixDigest
:
data
.
Random
,
}
block
:=
types
.
NewBlockWithHeader
(
header
)
.
WithBody
(
txs
,
nil
/* uncles */
)
data
.
BlockHash
=
block
.
Hash
()
// Send the new payload
resp2
,
err
:=
api
.
NewPayloadV1
(
data
)
if
err
!=
nil
{
t
.
Fatalf
(
"error sending NewPayload, err=%v"
,
err
)
...
...
@@ -1240,9 +1257,10 @@ func TestNilWithdrawals(t *testing.T) {
func
setupBodies
(
t
*
testing
.
T
)
(
*
node
.
Node
,
*
eth
.
Ethereum
,
[]
*
types
.
Block
)
{
genesis
,
blocks
:=
generateMergeChain
(
10
,
true
)
n
,
ethservice
:=
startEthService
(
t
,
genesis
,
blocks
)
// enable shanghai on the last block
ethservice
.
BlockChain
()
.
Config
()
.
ShanghaiTime
=
&
blocks
[
len
(
blocks
)
-
1
]
.
Header
()
.
Time
time
:=
blocks
[
len
(
blocks
)
-
1
]
.
Header
()
.
Time
+
1
genesis
.
Config
.
ShanghaiTime
=
&
time
n
,
ethservice
:=
startEthService
(
t
,
genesis
,
blocks
)
var
(
parent
=
ethservice
.
BlockChain
()
.
CurrentBlock
()
...
...
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