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
5c1fc3bf
Unverified
Commit
5c1fc3bf
authored
Sep 07, 2021
by
Felix Lange
Committed by
GitHub
Sep 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: 64bit alignment of testBlockChain.gasLimit (#23543)
This fixes crashes in txpool tests on 32bit platforms.
parent
51ed39c0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
tx_pool_test.go
core/tx_pool_test.go
+21
-21
No files found.
core/tx_pool_test.go
View file @
5c1fc3bf
...
...
@@ -58,8 +58,8 @@ func init() {
}
type
testBlockChain
struct
{
gasLimit
uint64
// must be first field for 64 bit alignment (atomic access)
statedb
*
state
.
StateDB
gasLimit
uint64
chainHeadFeed
*
event
.
Feed
}
...
...
@@ -119,7 +119,7 @@ func setupTxPool() (*TxPool, *ecdsa.PrivateKey) {
func
setupTxPoolWithConfig
(
config
*
params
.
ChainConfig
)
(
*
TxPool
,
*
ecdsa
.
PrivateKey
)
{
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
10000000
,
new
(
event
.
Feed
)}
blockchain
:=
&
testBlockChain
{
10000000
,
statedb
,
new
(
event
.
Feed
)}
key
,
_
:=
crypto
.
GenerateKey
()
pool
:=
NewTxPool
(
testTxPoolConfig
,
config
,
blockchain
)
...
...
@@ -231,7 +231,7 @@ func TestStateChangeDuringTransactionPoolReset(t *testing.T) {
// setup pool with 2 transaction in it
statedb
.
SetBalance
(
address
,
new
(
big
.
Int
)
.
SetUint64
(
params
.
Ether
))
blockchain
:=
&
testChain
{
&
testBlockChain
{
statedb
,
1000000000
,
new
(
event
.
Feed
)},
address
,
&
trigger
}
blockchain
:=
&
testChain
{
&
testBlockChain
{
1000000000
,
statedb
,
new
(
event
.
Feed
)},
address
,
&
trigger
}
tx0
:=
transaction
(
0
,
100000
,
key
)
tx1
:=
transaction
(
1
,
100000
,
key
)
...
...
@@ -429,7 +429,7 @@ func TestTransactionChainFork(t *testing.T) {
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
statedb
.
AddBalance
(
addr
,
big
.
NewInt
(
100000000000000
))
pool
.
chain
=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
pool
.
chain
=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
<-
pool
.
requestReset
(
nil
,
nil
)
}
resetState
()
...
...
@@ -458,7 +458,7 @@ func TestTransactionDoubleNonce(t *testing.T) {
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
statedb
.
AddBalance
(
addr
,
big
.
NewInt
(
100000000000000
))
pool
.
chain
=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
pool
.
chain
=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
<-
pool
.
requestReset
(
nil
,
nil
)
}
resetState
()
...
...
@@ -656,7 +656,7 @@ func TestTransactionPostponing(t *testing.T) {
// Create the pool to test the postponing with
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
blockchain
:=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
pool
:=
NewTxPool
(
testTxPoolConfig
,
params
.
TestChainConfig
,
blockchain
)
defer
pool
.
Stop
()
...
...
@@ -869,7 +869,7 @@ func testTransactionQueueGlobalLimiting(t *testing.T, nolocals bool) {
// Create the pool to test the limit enforcement with
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
blockchain
:=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
config
:=
testTxPoolConfig
config
.
NoLocals
=
nolocals
...
...
@@ -961,7 +961,7 @@ func testTransactionQueueTimeLimiting(t *testing.T, nolocals bool) {
// Create the pool to test the non-expiration enforcement
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
blockchain
:=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
config
:=
testTxPoolConfig
config
.
Lifetime
=
time
.
Second
...
...
@@ -1146,7 +1146,7 @@ func TestTransactionPendingGlobalLimiting(t *testing.T) {
// Create the pool to test the limit enforcement with
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
blockchain
:=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
config
:=
testTxPoolConfig
config
.
GlobalSlots
=
config
.
AccountSlots
*
10
...
...
@@ -1248,7 +1248,7 @@ func TestTransactionCapClearsFromAll(t *testing.T) {
// Create the pool to test the limit enforcement with
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
blockchain
:=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
config
:=
testTxPoolConfig
config
.
AccountSlots
=
2
...
...
@@ -1282,7 +1282,7 @@ func TestTransactionPendingMinimumAllowance(t *testing.T) {
// Create the pool to test the limit enforcement with
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
blockchain
:=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
config
:=
testTxPoolConfig
config
.
GlobalSlots
=
1
...
...
@@ -1330,7 +1330,7 @@ func TestTransactionPoolRepricing(t *testing.T) {
// Create the pool to test the pricing enforcement with
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
blockchain
:=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
pool
:=
NewTxPool
(
testTxPoolConfig
,
params
.
TestChainConfig
,
blockchain
)
defer
pool
.
Stop
()
...
...
@@ -1578,7 +1578,7 @@ func TestTransactionPoolRepricingKeepsLocals(t *testing.T) {
// Create the pool to test the pricing enforcement with
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
blockchain
:=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
pool
:=
NewTxPool
(
testTxPoolConfig
,
eip1559Config
,
blockchain
)
defer
pool
.
Stop
()
...
...
@@ -1651,7 +1651,7 @@ func TestTransactionPoolUnderpricing(t *testing.T) {
// Create the pool to test the pricing enforcement with
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
blockchain
:=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
config
:=
testTxPoolConfig
config
.
GlobalSlots
=
2
...
...
@@ -1757,7 +1757,7 @@ func TestTransactionPoolStableUnderpricing(t *testing.T) {
// Create the pool to test the pricing enforcement with
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
blockchain
:=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
config
:=
testTxPoolConfig
config
.
GlobalSlots
=
128
...
...
@@ -1989,7 +1989,7 @@ func TestTransactionDeduplication(t *testing.T) {
// Create the pool to test the pricing enforcement with
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
blockchain
:=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
pool
:=
NewTxPool
(
testTxPoolConfig
,
params
.
TestChainConfig
,
blockchain
)
defer
pool
.
Stop
()
...
...
@@ -2055,7 +2055,7 @@ func TestTransactionReplacement(t *testing.T) {
// Create the pool to test the pricing enforcement with
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
blockchain
:=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
pool
:=
NewTxPool
(
testTxPoolConfig
,
params
.
TestChainConfig
,
blockchain
)
defer
pool
.
Stop
()
...
...
@@ -2260,7 +2260,7 @@ func testTransactionJournaling(t *testing.T, nolocals bool) {
// Create the original pool to inject transaction into the journal
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
blockchain
:=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
config
:=
testTxPoolConfig
config
.
NoLocals
=
nolocals
...
...
@@ -2302,7 +2302,7 @@ func testTransactionJournaling(t *testing.T, nolocals bool) {
// Terminate the old pool, bump the local nonce, create a new pool and ensure relevant transaction survive
pool
.
Stop
()
statedb
.
SetNonce
(
crypto
.
PubkeyToAddress
(
local
.
PublicKey
),
1
)
blockchain
=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
blockchain
=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
pool
=
NewTxPool
(
config
,
params
.
TestChainConfig
,
blockchain
)
...
...
@@ -2329,7 +2329,7 @@ func testTransactionJournaling(t *testing.T, nolocals bool) {
pool
.
Stop
()
statedb
.
SetNonce
(
crypto
.
PubkeyToAddress
(
local
.
PublicKey
),
1
)
blockchain
=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
blockchain
=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
pool
=
NewTxPool
(
config
,
params
.
TestChainConfig
,
blockchain
)
pending
,
queued
=
pool
.
Stats
()
...
...
@@ -2358,7 +2358,7 @@ func TestTransactionStatusCheck(t *testing.T) {
// Create the pool to test the status retrievals with
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
1000000
,
new
(
event
.
Feed
)}
blockchain
:=
&
testBlockChain
{
1000000
,
statedb
,
new
(
event
.
Feed
)}
pool
:=
NewTxPool
(
testTxPoolConfig
,
params
.
TestChainConfig
,
blockchain
)
defer
pool
.
Stop
()
...
...
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