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
d0bb90c6
Commit
d0bb90c6
authored
Jun 25, 2015
by
Felix Lange
Committed by
Jeffrey Wilcke
Jun 29, 2015
Browse files
Options
Downloads
Patches
Plain Diff
core: generate benchmark keys only once
parent
992dc74e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/bench_test.go
+23
-9
23 additions, 9 deletions
core/bench_test.go
with
23 additions
and
9 deletions
core/bench_test.go
+
23
−
9
View file @
d0bb90c6
...
...
@@ -72,16 +72,24 @@ func genValueTx(nbytes int) func(int, *BlockGen) {
}
}
var
(
ringKeys
=
make
([]
*
ecdsa
.
PrivateKey
,
1000
)
ringAddrs
=
make
([]
common
.
Address
,
len
(
ringKeys
))
)
func
init
()
{
ringKeys
[
0
]
=
benchRootKey
ringAddrs
[
0
]
=
benchRootAddr
for
i
:=
1
;
i
<
len
(
ringKeys
);
i
++
{
ringKeys
[
i
],
_
=
crypto
.
GenerateKey
()
ringAddrs
[
i
]
=
crypto
.
PubkeyToAddress
(
ringKeys
[
i
]
.
PublicKey
)
}
}
// genTxRing returns a block generator that sends ether in a ring
// among n accounts. This is creates n entries in the state database
// and fills the blocks with many small transactions.
func
genTxRing
(
naccounts
int
)
func
(
int
,
*
BlockGen
)
{
keys
:=
make
([]
*
ecdsa
.
PrivateKey
,
naccounts
)
keys
[
0
]
=
benchRootKey
for
i
:=
1
;
i
<
naccounts
;
i
++
{
keys
[
i
],
_
=
crypto
.
GenerateKey
()
}
from
:=
0
return
func
(
i
int
,
gen
*
BlockGen
)
{
gas
:=
CalcGasLimit
(
gen
.
PrevBlock
(
i
-
1
))
...
...
@@ -91,9 +99,15 @@ func genTxRing(naccounts int) func(int, *BlockGen) {
break
}
to
:=
(
from
+
1
)
%
naccounts
fromaddr
:=
crypto
.
PubkeyToAddress
(
keys
[
from
]
.
PublicKey
)
toaddr
:=
crypto
.
PubkeyToAddress
(
keys
[
to
]
.
PublicKey
)
tx
,
_
:=
types
.
NewTransaction
(
gen
.
TxNonce
(
fromaddr
),
toaddr
,
benchRootFunds
,
params
.
TxGas
,
nil
,
nil
)
.
SignECDSA
(
keys
[
from
])
tx
:=
types
.
NewTransaction
(
gen
.
TxNonce
(
ringAddrs
[
from
]),
ringAddrs
[
to
],
benchRootFunds
,
params
.
TxGas
,
nil
,
nil
,
)
tx
,
_
=
tx
.
SignECDSA
(
ringKeys
[
from
])
gen
.
AddTx
(
tx
)
from
=
to
}
...
...
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