good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
5b31794d
Commit
5b31794d
authored
Nov 9, 2016
by
xiekeyang
Committed by
Felix Lange
Nov 9, 2016
Browse files
Options
Downloads
Patches
Plain Diff
cmd/geth: use a loop in TestDAOForkBlockNewChain (#3222)
parent
355f4b0c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmd/geth/dao_test.go
+68
-84
68 additions, 84 deletions
cmd/geth/dao_test.go
with
68 additions
and
84 deletions
cmd/geth/dao_test.go
+
68
−
84
View file @
5b31794d
...
...
@@ -80,91 +80,75 @@ var daoProForkGenesis = `{
var
daoGenesisHash
=
common
.
HexToHash
(
"5e1fc79cb4ffa4739177b5408045cd5d51c6cf766133f23f7cd72ee1f8d790e0"
)
var
daoGenesisForkBlock
=
big
.
NewInt
(
314
)
// Tests that the DAO hard-fork number and the nodes support/opposition is correctly
// Test
DAOForkBlockNewChain test
s that the DAO hard-fork number and the nodes support/opposition is correctly
// set in the database after various initialization procedures and invocations.
func
TestDAODefaultMainnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
""
,
[][
2
]
bool
{{
false
,
false
}},
params
.
MainNetDAOForkBlock
,
true
)
func
TestDAOForkBlockNewChain
(
t
*
testing
.
T
)
{
for
_
,
arg
:=
range
[]
struct
{
testnet
bool
genesis
string
votes
[][
2
]
bool
expectBlock
*
big
.
Int
expectVote
bool
}{
// Test DAO Default Mainnet
{
false
,
""
,
[][
2
]
bool
{{
false
,
false
}},
params
.
MainNetDAOForkBlock
,
true
},
// test DAO Support Mainnet
{
false
,
""
,
[][
2
]
bool
{{
true
,
false
}},
params
.
MainNetDAOForkBlock
,
true
},
// test DAO Oppose Mainnet
{
false
,
""
,
[][
2
]
bool
{{
false
,
true
}},
params
.
MainNetDAOForkBlock
,
false
},
// test DAO Switch To Support Mainnet
{
false
,
""
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
params
.
MainNetDAOForkBlock
,
true
},
// test DAO Switch To Oppose Mainnet
{
false
,
""
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
params
.
MainNetDAOForkBlock
,
false
},
// test DAO Default Testnet
{
true
,
""
,
[][
2
]
bool
{{
false
,
false
}},
params
.
TestNetDAOForkBlock
,
true
},
// test DAO Support Testnet
{
true
,
""
,
[][
2
]
bool
{{
true
,
false
}},
params
.
TestNetDAOForkBlock
,
true
},
// test DAO Oppose Testnet
{
true
,
""
,
[][
2
]
bool
{{
false
,
true
}},
params
.
TestNetDAOForkBlock
,
false
},
// test DAO Switch To Support Testnet
{
true
,
""
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
params
.
TestNetDAOForkBlock
,
true
},
// test DAO Switch To Oppose Testnet
{
true
,
""
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
params
.
TestNetDAOForkBlock
,
false
},
// test DAO Init Old Privnet
{
false
,
daoOldGenesis
,
[][
2
]
bool
{},
nil
,
false
},
// test DAO Default Old Privnet
{
false
,
daoOldGenesis
,
[][
2
]
bool
{{
false
,
false
}},
nil
,
false
},
// test DAO Support Old Privnet
{
false
,
daoOldGenesis
,
[][
2
]
bool
{{
true
,
false
}},
nil
,
true
},
// test DAO Oppose Old Privnet
{
false
,
daoOldGenesis
,
[][
2
]
bool
{{
false
,
true
}},
nil
,
false
},
// test DAO Switch To Support Old Privnet
{
false
,
daoOldGenesis
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
nil
,
true
},
// test DAO Switch To Oppose Old Privnet
{
false
,
daoOldGenesis
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
nil
,
false
},
// test DAO Init No Fork Privnet
{
false
,
daoNoForkGenesis
,
[][
2
]
bool
{},
daoGenesisForkBlock
,
false
},
// test DAO Default No Fork Privnet
{
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
false
,
false
}},
daoGenesisForkBlock
,
false
},
// test DAO Support No Fork Privnet
{
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
true
,
false
}},
daoGenesisForkBlock
,
true
},
// test DAO Oppose No Fork Privnet
{
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
false
,
true
}},
daoGenesisForkBlock
,
false
},
// test DAO Switch To Support No Fork Privnet
{
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
daoGenesisForkBlock
,
true
},
// test DAO Switch To Oppose No Fork Privnet
{
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
daoGenesisForkBlock
,
false
},
// test DAO Init Pro Fork Privnet
{
false
,
daoProForkGenesis
,
[][
2
]
bool
{},
daoGenesisForkBlock
,
true
},
// test DAO Default Pro Fork Privnet
{
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
false
,
false
}},
daoGenesisForkBlock
,
true
},
// test DAO Support Pro Fork Privnet
{
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
true
,
false
}},
daoGenesisForkBlock
,
true
},
// test DAO Oppose Pro Fork Privnet
{
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
false
,
true
}},
daoGenesisForkBlock
,
false
},
// test DAO Switch To Support Pro Fork Privnet
{
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
daoGenesisForkBlock
,
true
},
// test DAO Switch To Oppose Pro Fork Privnet
{
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
daoGenesisForkBlock
,
false
},
}
{
testDAOForkBlockNewChain
(
t
,
arg
.
testnet
,
arg
.
genesis
,
arg
.
votes
,
arg
.
expectBlock
,
arg
.
expectVote
)
}
func
TestDAOSupportMainnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
""
,
[][
2
]
bool
{{
true
,
false
}},
params
.
MainNetDAOForkBlock
,
true
)
}
func
TestDAOOpposeMainnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
""
,
[][
2
]
bool
{{
false
,
true
}},
params
.
MainNetDAOForkBlock
,
false
)
}
func
TestDAOSwitchToSupportMainnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
""
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
params
.
MainNetDAOForkBlock
,
true
)
}
func
TestDAOSwitchToOpposeMainnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
""
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
params
.
MainNetDAOForkBlock
,
false
)
}
func
TestDAODefaultTestnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
true
,
""
,
[][
2
]
bool
{{
false
,
false
}},
params
.
TestNetDAOForkBlock
,
true
)
}
func
TestDAOSupportTestnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
true
,
""
,
[][
2
]
bool
{{
true
,
false
}},
params
.
TestNetDAOForkBlock
,
true
)
}
func
TestDAOOpposeTestnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
true
,
""
,
[][
2
]
bool
{{
false
,
true
}},
params
.
TestNetDAOForkBlock
,
false
)
}
func
TestDAOSwitchToSupportTestnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
true
,
""
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
params
.
TestNetDAOForkBlock
,
true
)
}
func
TestDAOSwitchToOpposeTestnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
true
,
""
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
params
.
TestNetDAOForkBlock
,
false
)
}
func
TestDAOInitOldPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoOldGenesis
,
[][
2
]
bool
{},
nil
,
false
)
}
func
TestDAODefaultOldPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoOldGenesis
,
[][
2
]
bool
{{
false
,
false
}},
nil
,
false
)
}
func
TestDAOSupportOldPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoOldGenesis
,
[][
2
]
bool
{{
true
,
false
}},
nil
,
true
)
}
func
TestDAOOpposeOldPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoOldGenesis
,
[][
2
]
bool
{{
false
,
true
}},
nil
,
false
)
}
func
TestDAOSwitchToSupportOldPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoOldGenesis
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
nil
,
true
)
}
func
TestDAOSwitchToOpposeOldPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoOldGenesis
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
nil
,
false
)
}
func
TestDAOInitNoForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoNoForkGenesis
,
[][
2
]
bool
{},
daoGenesisForkBlock
,
false
)
}
func
TestDAODefaultNoForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
false
,
false
}},
daoGenesisForkBlock
,
false
)
}
func
TestDAOSupportNoForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
true
,
false
}},
daoGenesisForkBlock
,
true
)
}
func
TestDAOOpposeNoForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
false
,
true
}},
daoGenesisForkBlock
,
false
)
}
func
TestDAOSwitchToSupportNoForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
daoGenesisForkBlock
,
true
)
}
func
TestDAOSwitchToOpposeNoForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoNoForkGenesis
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
daoGenesisForkBlock
,
false
)
}
func
TestDAOInitProForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoProForkGenesis
,
[][
2
]
bool
{},
daoGenesisForkBlock
,
true
)
}
func
TestDAODefaultProForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
false
,
false
}},
daoGenesisForkBlock
,
true
)
}
func
TestDAOSupportProForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
true
,
false
}},
daoGenesisForkBlock
,
true
)
}
func
TestDAOOpposeProForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
false
,
true
}},
daoGenesisForkBlock
,
false
)
}
func
TestDAOSwitchToSupportProForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
false
,
true
},
{
true
,
false
}},
daoGenesisForkBlock
,
true
)
}
func
TestDAOSwitchToOpposeProForkPrivnet
(
t
*
testing
.
T
)
{
testDAOForkBlockNewChain
(
t
,
false
,
daoProForkGenesis
,
[][
2
]
bool
{{
true
,
false
},
{
false
,
true
}},
daoGenesisForkBlock
,
false
)
}
func
testDAOForkBlockNewChain
(
t
*
testing
.
T
,
testnet
bool
,
genesis
string
,
votes
[][
2
]
bool
,
expectBlock
*
big
.
Int
,
expectVote
bool
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment