-
Notifications
You must be signed in to change notification settings - Fork 824
Simplify predicate handling #4175
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
Simplify predicate handling #4175
Conversation
|
|
||
| if trim[len(trim)-1] != delimiter { | ||
| return nil, errWrongEndDelimiter | ||
| predicates[el.Address] = append(predicates[el.Address], el.StorageKeys) |
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 removed the copy here... If we want to keep the copy to avoid mutating the predicates if StorageKeys is later modified, then we can do that... But I didn't see a need.
| { | ||
| name: "non-zero padding", | ||
| input: append(append([]byte{0x42, 0xff}, bytes.Repeat([]byte{0}, 29)...), 0x01, 0x00), | ||
| name: "wrong_delimiter", |
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.
Why do we add underscoring between words? My guess was that tooling doesn't like the white space.... on my IDE it replaces whitespace with _ so I wasn't sure what the rationale was here.
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.
The rationale behind replacing " " with "_" is that if a test fails it is printed with the spaces replaced with underscores, so searching for the test is nicer if the name uses underscores rather than spaces.
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 that's the case, results_test also needs to be modified
Why this should be merged
This PR slims down the public API exposed by the
predicatepackage for handling predicates. Now only[]common.Hashand[]byteare exposed publicly.How this works
Mainly just deleted code that wasn't needed and simplified a couple implementations.
This PR doesn't touch any result handling logic.
How this was tested
Unit tests.
Need to be documented in RELEASES.md?