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 |
asraa
left a comment
There was a problem hiding this comment.
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. |
|
@ethan-lowman-dd need to resolve conflicts... |
591dd73
|
Conflicts resolved -- need re-approvals to merge, since the commit dismissed the existing ones. |
hosseinsia
left a comment
There was a problem hiding this comment.
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.gowhich was comparingexpectedto itself rather than comparingexpectedtoactual.