-
Notifications
You must be signed in to change notification settings - Fork 241
FIR-9: Identity enhancements #549
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
Conversation
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
|
Thanks Andrew for the detailed review, and excellent suggestions. I've gone through each of the comments and addressed them with code/comment changes. Before we merge I'm planning to re-run the migration test I mentioned above one last time, but would be great to get your feedback first (as the migration test takes a while to set up and run). |
Signed-off-by: Peter Broadhurst <[email protected]>
| Method: http.MethodGet, | ||
| PathParams: []*oapispec.PathParam{ | ||
| {Name: "ns", ExampleFromConf: config.NamespacesDefault, Description: i18n.MsgTBD}, | ||
| {Name: "vid", Example: "id", Description: i18n.MsgTBD}, |
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.
Just want to note that this became a "hash" rather than an "id" in the latest pass. Might suggest a tweak to reflect that on the Swagger?
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 actually thought about that and didn't do it. My thinking was that it's actually a resource identifier, just one that's deterministically generated on all nodes. We don't rely on it being a hash for processing, and due to an edge case on migration there's a small number of environments where it might not actually be the Hash.
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.
OK - I'm mainly worried about the case where I query /verifiers and get a list of things, how do I know which one to put in vid in order to look up that one item? I have to know that hash maps to vid. Of course this is a detail that can easily be tweaked later.
| // It might be being processed in the same pin batch as us - so we can't | ||
|
|
||
| // See if the message has already arrived, if so we need to queue a rewind to it | ||
| claimMsg, err := dh.database.GetMessageByID(ctx, verification.Claim.ID) |
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.
Would it make sense to check the pending messages in the batch before hitting the database? Unless we expect the database to be the more common case. Probably getting into micro-optimization at this point anyway.
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.
Your suggestion feels right to me - will do it.
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.
Actually, it did make the logic a lot less clean... so going to defer this for now (the database case is more likely, as my best guess):
// See if the message has already arrived, if so we need to queue a rewind to it
claimMsg := state.GetPendingConfirm()[*verification.Claim.ID]
if claimMsg == nil {
claimMsg, err := dh.database.GetMessageByID(ctx, verification.Claim.ID)
if err != nil {
return HandlerResult{Action: ActionRetry}, err
}
if claimMsg != nil && claimMsg.State != fftypes.MessageStateConfirmed {
claimMsg = nil
}
}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.
Works for me; thanks for giving it a pass.
awrichar
left a comment
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 for the updates - this is looking even better and I think I can fully understand the flow now.
I marked most of my comments resolved, although there are 1 or 2 that may still need a look. Also left a handful more on small items. After one more pass to confirm all of this, I think it's good to go.
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
|
Moving onto the migration test re-run after the |
Signed-off-by: Peter Broadhurst <[email protected]>
|
Sadly the migration cheat of using a UUID to fill in the bytes that should be a hash work. First problem was Then the REST API code on retrieval failed with So I can write them twice, but it's feeling very messy at this point 🤔 |
Signed-off-by: Peter Broadhurst <[email protected]>
|
I added the double-UUID extension to the migration code, and tested the migration e2e. Racked my brains, and couldn't think of another simpler solution to supporting up+down migrations for this table split. I considered allocating a eyecatcher prefixed ID in the So let me know if you have any further inspiration @awrichar - otherwise, I believe this is all tested and good to go. |
|
Yea, I was suspicious that the UUID to hash hack wouldn't quite work. I think where it's landed is fine though. I considered the fact that Postgres could probably do actual hashing - but it would be a problem for sqlite, and would make the down migration harder in any case. Looks good to me now - will leave the button push to you! |
See hyperledger/firefly-fir#9
@awrichar - the E2E is passing on these changes, but leaving PR in review state as I'd like to add some more E2E tests and do migration testing before pulling it out of draft.
I will put comments in-line in the code to help orient your review