Skip to content

Commit

Permalink
test(fixme) skip with block start height
Browse files Browse the repository at this point in the history
  • Loading branch information
r3v4s committed Jan 8, 2025
1 parent 6b53a2d commit 9134a2e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ package staker_test
import (
"std"
"strconv"
"time"

"gno.land/p/demo/grc/grc721"

Expand Down Expand Up @@ -178,18 +177,14 @@ func testCreateExternalIncentiveBar() {
1234569600,
1234569600+TIMESTAMP_90DAYS,
)
// startHeight 978
// endHeight 3888978
// nowHeight 127

// make it start
externalStartTime := int64(1234569600)
nowTime := time.Now().Unix()
timeLeft := externalStartTime - nowTime

blockAvgTime := consts.BLOCK_GENERATION_INTERVAL
blockLeft := timeLeft / blockAvgTime

blockLeft := 978 - 127
std.TestSkipHeights(int64(blockLeft)) // skip until external bar starts
std.TestSkipHeights(10) // skip bit more to see reward calculation

}

func testStakeToken01And02() {
Expand Down
2 changes: 2 additions & 0 deletions staker/type.gno
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ func NewExternalIncentive(
blocksLeftUntilEndHeight := (endTimestamp - currentTime) * 1000 / msPerBlock

startHeight := std.GetHeight() + blocksLeftUntilStartHeight
println("startHeight", startHeight)
endHeight := std.GetHeight() + blocksLeftUntilEndHeight
println("endHeight", endHeight)

return &ExternalIncentive{
incentiveId: incentiveId,
Expand Down

0 comments on commit 9134a2e

Please sign in to comment.