-
Notifications
You must be signed in to change notification settings - Fork 109
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
Sort signatures by keys IDs for deterministic signature order #155
Sort signatures by keys IDs for deterministic signature order #155
Conversation
Pull Request Test Coverage Report for Build 1338037733
💛 - Coveralls |
Best for @hosseinsia to review as it might affect fixtures in his #143 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.
Thanks! I'm not opposed to this change, but could you point me to where the testdata needed to be ordered?
I'm seeing a few checks in the interop_test/client_test but they don't seem to require ordering.
Just wondering if it makes more sense to change tests to test equality/expectation without ordering
@asraa The tests that are flaky if signature order is nondeterministic are:
I addressed (1) by sorting signatures by key IDs and regenerating these fixtures. I addressed (2) by sorting keys IDs in the tests before making comparisons. |
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.
LGTM!
@ethan-lowman-dd need to resolve conflicts... |
591dd73
Conflicts resolved -- need re-approvals to merge, since the commit dismissed the existing ones. |
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.
LGTM!
Wonderful! Many thanks!
…ateframework#155) * Sort signatures by key ID * Improve slice comparison * Fix assert comment * Remove sortStrings test helper * Add test for Signer sort * Sort keys before usage * Revert "Sort keys before usage" This reverts commit 88d9340. * Rename to getSortedSigningKeys * Check sort in a different way
In the course of implementing delegations in the repo writer (WIP branch), I had to change how keys are stored internally, which introduced non-determinism in the order of signatures. This caused tests which relied on fixtures to become flaky, as the order of signatures was not consistent. In order to keep support for static fixtures (using deterministic signature schemes like Ed25519), this PR sorts signatures by key ID.
I regenerated the fixtures using
regenerate-metadata.sh
, which reordered signatures of root.json, and updated dependent hashes.I also updated the two tests that made assertions about signature/key slices to disregard order. In the process I fixed a test on line 1174 of
repo_test.go
which was comparingexpected
to itself rather than comparingexpected
toactual
.