-
Notifications
You must be signed in to change notification settings - Fork 57
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
Fix record author bug #345
Conversation
…scovered bug Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
TBDocs Report ✅ No errors or warnings @web5/api
TBDocs Report Updated at 2023-12-09T21:16:42Z |
Signed-off-by: Frank Hinek <[email protected]>
abc8e20
to
33f666a
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #345 +/- ##
==========================================
+ Coverage 92.69% 92.71% +0.01%
==========================================
Files 75 75
Lines 16838 16835 -3
Branches 1577 1578 +1
==========================================
Hits 15608 15608
+ Misses 1204 1201 -3
Partials 26 26
|
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! That last test case confused me a bit. Didn't look too much into it, but should we be able to send that?
/** | ||
* 4. Validate that Bob is able to write the record to Alice's remote DWN. | ||
*/ | ||
const { status: sendStatusToAlice } = await queryRecordsFrom[0]!.send(aliceDid.did); |
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 last part of the test is confusing. It says bob
is supposed to be able to write, however expects a 401
.
* Improve Record class test structure and add failing test for newly discovered bug * Rename remoteTarget to remoteOrigin * Correct typo in error message * Improve semantics of Record class --------- Signed-off-by: Frank Hinek <[email protected]>
* Improve Record class test structure and add failing test for newly discovered bug * Rename remoteTarget to remoteOrigin * Correct typo in error message * Improve semantics of Record class --------- Signed-off-by: Frank Hinek <[email protected]>
* Improve Record class test structure and add failing test for newly discovered bug * Rename remoteTarget to remoteOrigin * Correct typo in error message * Improve semantics of Record class --------- Signed-off-by: Frank Hinek <[email protected]>
Summary
This PR primarily focuses on fixing a bug reported by community members on Discord that occurred when interacting with records retrieved from remote DWNs and subsequent attempts to consume the data payload.
Context
A number of community members and TBD developers had reported that errors were returned when attempting to read data from
Record
instances:Uncaught Error: DwnManager: Signing key not found for author: 'did:ion:...'
Further troubleshooting revealed that when large (>
DwnConstant.maxDataSizeAllowedToBeEncoded
) records authored/signed by one party (Alice) were written to another party's DWN (Bob), the recipient (Bob) was unable to access the data payload with the aforementioned error being thrown. This bug only surfaces when accessing the data (record.data.*
) of a record signed by a different entity aRecord
instance's data, which requires fetching the data from a remote DWN. Since the large (>DwnConstant.maxDataSizeAllowedToBeEncoded
) data was not returned with the query asencodedData
, theRecord
instance's data is not available and must be fetched from the remote DWN using aRecordsRead
message.What made this bug particularly difficult to track down is that the bug only surfaces when keys used to sign the record are different than the keys used to fetch the record AND both sets of keys are unavailable to the test Agent used by the entity that is attempting to fetch the record. In all of the other existing tests, the same test agent is used to store the keys for all entities (e.g., "Alice", "Bob", etc.) so the bug never surfaced.
Changes
@web5/api
author
andtarget
inRecord
class that had been acting as a stand in for theconnectedDid
. This double-meaning has already introduced several bugs, so this PR removes the usage of the overloaded term and instead refers directly to theconnectedDid
, where applicable.remoteTarget
toremoteOrigin
to improve intuitiveness of semantic meaning.@web5/agent