-
Notifications
You must be signed in to change notification settings - Fork 44
Conversation
|
||
# if it is a free block | ||
if message.sequence_number > seq_number: | ||
# NOTE: preferably, would not do this for all new messages - rather just latest free block? |
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.
This could add some significant efficiency gains - I think. Will take a crack at this tomorrow (not too hard I don't think, just storing new messages in a dict + list, I think).
Ok, so the root of the bug above is (I'm 95% sure) the fact that I don't search through messages later than The issue here is that there are very likely viewables here that I am missing because of this (massive oversight - I know!). There should be an easy fixup tomorrow (and should fix the remaining bugs in all the oracles that result from these missing viewables). |
Where the tests at brah? Holler if you need another set of eyes. Going to leave it to you until you say otherwise for review/help |
Yep, manual testing and many assert statements. Will be able to get some tests up tonight with the fixes hopefully :~) Interestingly, though this is horribly bugged, none of our previous test cases catch it :) We need to bulk up on some safety oracle tests. |
Write some test cases before you fix it! It's good to see those red test
cases and fix them. Then we'll know we tested this previously untested set
of cases.
…On Thursday, October 19, 2017, Nate Rush ***@***.***> wrote:
Yep, manual testing and many assert statements. Will be able to get some
tests up tonight with the fixes hopefully :~)
Interestingly, though this is horribly bugged, none of our previous test
cases catch it :) We need to bulk up on some safety oracle tests.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#64 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABXf-9C1PmogM_b9NILZ0gV0VYUaE6ssks5st5QcgaJpZM4P9Oqe>
.
|
@djrtwo good call. Will do. |
9279f6f
to
67b52fa
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! A few things
- I'd like to see
oracle_class
passed into OracleManager. This will open up more easily testing against the Oracles. Consider getting some of the tests to run against multiple Oracles when you add this. - Break down some of the big functions in OracleManager to readability.
- Use a linting tool. Either integrate something into your editor that warns you or run pylint from the commandline. We're working on getting the entire repo linted up and once we do, having no linting errors will be part of CircleCI passing.
- testing
- Minimum unit tests doing at least some sanity checking on OracleManager initialization and basic functions. I know safety tests with testlang cover the heavy stuff. I want some test somewhere to at least break if we change the OracleManager API.
- Run safety tests against each Oracle.
self.last_checked_messages = dict() | ||
|
||
|
||
def update_viewables(self): |
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.
I'd like to see this broken into sub methods (prefixed with "_") -- something like _track_new_viewables
, _remove_outdated_viewables
, and _update_last_checked_messages
I want to be able to look at update_viewables
, read the two or three submethods it calls and know exactly what is going on from a high level just by reading those method names.
|
||
class OracleManager: | ||
|
||
def __init__(self, view, validator_set, safety_threshold): |
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.
Should probably take a param oracle_class
so the user can pass in CliqueOracle
, TuranOracle
, etc for the manager to use.
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.
One fun thing from this would be the ability to instantiate different validators with different oracles...
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.
Good call. Also, the ability for validators to have different safety_thesholds now :)
tests/test_safety_oracle.py
Outdated
|
||
def test_cache_checks_all_possible_viewables(test_lang_runner): | ||
test_string = '' | ||
for i in range(100): |
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.
This needs a comment or something. Very unreadable
tests/test_safety_oracle.py
Outdated
test_string += 'U' + str(j) + '-' + str(i) + ' ' + 'U' + str(j) + '-' + str(i + 100) + ' ' | ||
test_string = test_string[:-1] | ||
|
||
weights = {0: 10, 1: 9.5, 2: 8.32, 3: 7.123, 4: 6.02245} |
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.
What's the explanation on these weights? are they important to the test? The complexity of the test_string leaves me unsure.
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.
If the weights don't matter, consider doing a "parameters" header on this with 2 to 3 different weights
defs
@@ -0,0 +1,141 @@ | |||
from casper.safety_oracles.clique_oracle import CliqueOracle |
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.
If you pass in oracle_calss
to __init__
, you won't need to do any of these imports here.
103dfe5
to
7293950
Compare
@naterush Merged in simulationrunner changes |
…bc-casper into feat/oracle_cache
@@ -14,17 +14,17 @@ def __init__(self, view, validator_set, safety_threshold): | |||
def update_viewables(self): | |||
"""For each estimate being tracked, finds new and removes old viewables based on view""" | |||
# finds all new viewables, for each validator, for each estimate we are keeping track of | |||
self._track_new_viewables() | |||
val_with_new_messages = self._track_new_viewables() |
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.
Returning this from the track new viewables function is hack-y and unnecessary. The clean-up I was going to start on just breaks these into functions that do what they say they do.
For example, it might be better to have the for estimate in self.viewables_for_estimate:
loop in the update_viewables
function - and then pass in the estimate to each of the respective functions. It's not a hard change either way but would love to hear your thoughts.
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.
Very much agree. Yeah, that makes sense. Do everything that needs to be done for a given estimate and then move on to the next estimate
Once we settle on the best oracle_manager design, I think the best option is probably too close this PR, rebase onto a new branch, and then restart. Either that or clean up the commit history, b/c things are quite messy :) |
Closing this for now. Not a priority for devcon - and it's in a state of disrepair as of now. Will reopen when after. |
Work started on this issue: #59
Other tests are passing, so it appears I haven't broken anything too badly. The code could use some serious testing and cleanup though :)
@djrtwo would love to talk about architecture trade-offs here. Also, would love to get some stats about performance improvements :)