-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
R4R: Simulation Queued Time Operations #2348
Conversation
Why is this a separate operation? Why not just add a BlockTime field to FutureOperation, and then just searching by either? (Or alternatively have NewFutureOperation methods) |
dfdb4f9
to
654cc2d
Compare
@ValarDragon Good point. |
Codecov Report
@@ Coverage Diff @@
## develop #2348 +/- ##
========================================
Coverage 64.97% 64.97%
========================================
Files 135 135
Lines 8418 8418
========================================
Hits 5470 5470
Misses 2587 2587
Partials 361 361 |
d93c4f5
to
058e470
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just left a few minor comments
} else { | ||
queuedOperations[futureOp.BlockHeight] = []Operation{futureOp.Op} | ||
index := sort.Search(len(queuedTimeOperations), func(i int) bool { return queuedTimeOperations[i].BlockTime.After(futureOp.BlockTime) }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have to do a search, can you make a TODO comment to make the queued time ops a sorted data structure? (This can then be addressed #postlaunch or if it bottlenecks the simulation)
Right now we have to copy all the time ops on insertion / deletion, which is an O(N) operation.
@@ -274,6 +284,27 @@ func runQueuedOperations(queueOperations map[int][]Operation, height int, tb tes | |||
return 0 | |||
} | |||
|
|||
// nolint: errcheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do want this passing errcheck though. Is there a specific line/error your trying to skip?
@@ -140,8 +141,10 @@ func SimulateFromSeed(tb testing.TB, app *baseapp.BaseApp, | |||
// Run queued operations. Ignores blocksize if blocksize is too small | |||
numQueuedOpsRan := runQueuedOperations(operationQueue, int(header.Height), tb, r, app, ctx, keys, logWriter, displayLogs, event) | |||
thisBlockSize -= numQueuedOpsRan | |||
numQueuedTimeOpsRan := runQueuedTimeOperations(timeOperationQueue, header.Time, tb, r, app, ctx, keys, logWriter, displayLogs, event) | |||
thisBlockSize -= numQueuedTimeOpsRan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you combine the lines subtracting the block size?
Simulator fail isn't from this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UtACK, can you update the existing changelog entry as well?
closes #2349
Targeted PR against correct branch (see CONTRIBUTING.md)
Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
Wrote tests
Updated relevant documentation (
docs/
)Added entries in
PENDING.md
with issue #rereviewed
Files changed
in the github PR explorerFor Admin Use: