Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
osmosis
Commits
b0573313
Commit
b0573313
authored
3 years ago
by
antstalepresh
Browse files
Options
Download
Email Patches
Plain Diff
benchmark to use AfterEpochEnd
parent
3e3a0454
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
x/incentives/keeper/bench_test.go
+3
-35
x/incentives/keeper/bench_test.go
with
3 additions
and
35 deletions
+3
-35
x/incentives/keeper/bench_test.go
+
3
-
35
View file @
b0573313
...
...
@@ -87,7 +87,6 @@ func benchmarkDistributionLogic(numAccts, numDenoms, numGauges, numLockups, numD
distrEpoch
:=
app
.
EpochsKeeper
.
GetEpochInfo
(
ctx
,
app
.
IncentivesKeeper
.
GetParams
(
ctx
)
.
DistrEpochIdentifier
)
durationOptions
:=
app
.
IncentivesKeeper
.
GetLockableDurations
(
ctx
)
// setup gauges
gaugeIds
:=
[]
uint64
{}
for
i
:=
0
;
i
<
numGauges
;
i
++
{
addr
:=
addrs
[
r
.
Int
()
%
numAccts
]
simCoins
:=
app
.
BankKeeper
.
SpendableCoins
(
ctx
,
addr
)
...
...
@@ -105,12 +104,10 @@ func benchmarkDistributionLogic(numAccts, numDenoms, numGauges, numLockups, numD
numEpochsPaidOver
=
uint64
(
r
.
Int63n
(
durationMillisecs
/
millisecsPerEpoch
))
+
1
}
gaugeId
,
err
:=
app
.
IncentivesKeeper
.
CreateGauge
(
ctx
,
isPerpetual
,
addr
,
rewards
,
distributeTo
,
startTime
,
numEpochsPaidOver
)
_
,
err
:=
app
.
IncentivesKeeper
.
CreateGauge
(
ctx
,
isPerpetual
,
addr
,
rewards
,
distributeTo
,
startTime
,
numEpochsPaidOver
)
if
err
!=
nil
{
fmt
.
Printf
(
"Create Gauge, %v
\n
"
,
err
)
b
.
FailNow
()
}
else
{
gaugeIds
=
append
(
gaugeIds
,
gaugeId
)
}
}
...
...
@@ -130,40 +127,11 @@ func benchmarkDistributionLogic(numAccts, numDenoms, numGauges, numLockups, numD
}
}
// begin distribution for all gauges
for
_
,
gaugeId
:=
range
gaugeIds
{
gauge
,
_
:=
app
.
IncentivesKeeper
.
GetGaugeByID
(
ctx
,
gaugeId
)
err
:=
app
.
IncentivesKeeper
.
BeginDistribution
(
ctx
,
*
gauge
)
if
err
!=
nil
{
fmt
.
Printf
(
"Begin distribution, %v
\n
"
,
err
)
b
.
FailNow
()
}
}
params
:=
app
.
IncentivesKeeper
.
GetParams
(
ctx
)
b
.
StartTimer
()
// distribute coins from gauges to lockup owners
for
i
:=
0
;
i
<
numDistrs
;
i
++
{
rewardsByAddr
:=
make
(
map
[
string
]
sdk
.
Coins
)
for
_
,
gaugeId
:=
range
gaugeIds
{
gauge
,
_
:=
app
.
IncentivesKeeper
.
GetGaugeByID
(
ctx
,
gaugeId
)
_
,
err
:=
app
.
IncentivesKeeper
.
Distribute
(
ctx
,
rewardsByAddr
,
*
gauge
)
if
err
!=
nil
{
fmt
.
Printf
(
"Distribute, %v
\n
"
,
err
)
b
.
FailNow
()
}
}
for
address
,
rewards
:=
range
rewardsByAddr
{
addr
,
err
:=
sdk
.
AccAddressFromBech32
(
address
)
if
err
!=
nil
{
fmt
.
Printf
(
"AccAddressFromBech32, %v
\n
"
,
err
)
b
.
FailNow
()
}
err
=
app
.
IncentivesKeeper
.
AutostakeRewards
(
ctx
,
addr
,
rewards
)
if
err
!=
nil
{
fmt
.
Printf
(
"AutostakeRewards, %v
\n
"
,
err
)
b
.
FailNow
()
}
}
app
.
IncentivesKeeper
.
AfterEpochEnd
(
ctx
,
params
.
DistrEpochIdentifier
,
int64
(
i
+
1
))
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets