Skip to content
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

client.keyStates().query() does not work without sn #184

Closed
nkongsuwan opened this issue Feb 5, 2024 · 6 comments · Fixed by WebOfTrust/keripy#797
Closed

client.keyStates().query() does not work without sn #184

nkongsuwan opened this issue Feb 5, 2024 · 6 comments · Fixed by WebOfTrust/keripy#797
Assignees

Comments

@nkongsuwan
Copy link

I am not sure if this is a feature or a bug. Currently, client.keyStates().query(prefix, sn) does not work if a sequence number sn is not specified.

In Signify-TS, sn is optional, so I expect that a client should be able to query for the entire KEL of an AID without specifying a sequence number for a particular key event.

@pfeairheller pfeairheller self-assigned this Feb 15, 2024
@lenkan
Copy link
Collaborator

lenkan commented Feb 15, 2024

Just as a recap of the short discussion in meeting: It would be useful to be able to query for the latest key state of an AID, without knowing the sequence number.

@2byrds
Copy link
Collaborator

2byrds commented May 2, 2024

From the dev meeting:
More detail in the issue would be helpful. Enpoint handler query for instance doesn't require SN.

@nkongsuwan
Copy link
Author

nkongsuwan commented May 3, 2024

I came across this problem when I was trying to do multisig delegated inception. I found that the delegatee needs to specify the precise sequence number of the delegating interaction event at which the delegatee's inception is anchored. Otherwise, the controllers of the delegatee could not find the interaction event and finish the waitOperation.

See:
https://github.com/WebOfTrust/signify-ts/blob/main/examples/integration-scripts/multisig-vlei-issuance.test.ts#L375

@iFergal
Copy link
Collaborator

iFergal commented May 28, 2024

The problem here appears to be with keripy and not KERIA.

sn causes KERIA to send /logs request, which will cause agents/witnesses to stream the KEL (each event in one message) to the caller. So the CESR parser parses individual events, which updates the kevers.

Without sn, it sends /ksn (key state notice) to get the latest state. There are two issues:

  1. processReplyKeyStateNotice is called when receiving the /ksn reply, but I don't think it does anything to update the kevers. I need to take a closer look but from what I can see it's just updating the tracking of queries and replies after validating the ksn with BADA.
  2. The long running op in KERIA for this will (at least on my machine) never complete even if the kevers are updated. A keyStateSaved event gets pushed on the kevery cues - but there are multiple Doers iterating to pull off cues - Respondant.cueDo seems to pull it off quicker on my machine and do nothing with it. Not sure what the HIO strategy is for this - we can re queue it but presume it would be better to only have one Doer processing cues.

@SmithSamuelM
Copy link
Contributor

ksn is a notice of key state. Its up to the recipient of a ksn to decide to request an update key state via a replay of missing Key events. I don't think that logic to decide to request an update to key state in response to a KSN was ever implemented. But I could be wrong.

@iFergal
Copy link
Collaborator

iFergal commented May 28, 2024

Got it, that makes sense! I took another look and I can see that the LogQuerier Doer that's created by the KeyStateNotifier will do what you describe automatically with the sequence number from the ksn reply. So number 1 isn't an issue.

The issue then I think seems to be number 2 in my list where the KeyStateNotifier cannot grab the ksn event off of cues fast enough before another Doer takes it, so the LogQuerier is never created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants