Skip to content

Conversation

krpeacock
Copy link
Contributor

@krpeacock krpeacock commented Apr 15, 2025

Description

In order to distinguish between requests which must be retried using the same payload and requests that can be reconstructed each time during polling, we have broken out the read state method into two separate "signed" and "unsigned" methods. This accommodates signatures made with a hardware wallet for, say, the nns dapp, but as a default, new signatures and Ingress experies will be calculated automatically during polling

This matches the strategies available in the rust agent.

Fixes # SDK-1992

How Has This Been Tested?

New unit and e2e tests.

Checklist:

  • My changes follow the guidelines in CONTRIBUTING.md.
  • The title of this PR complies with Conventional Commits.
  • I have edited the CHANGELOG accordingly.
  • I have made corresponding changes to the documentation.

@krpeacock krpeacock requested a review from a team as a code owner April 15, 2025 00:00
@krpeacock krpeacock changed the title using proper signatures in pollforresponse feat!: breaking out readState into signed and unsigned Apr 15, 2025
@krpeacock krpeacock requested a review from nathanosdev April 22, 2025 23:12
function isSignedReadStateRequestWithExpiry(
value: unknown,
): value is SignedReadStateRequestWithExpiry {
function isObjectWithProperty<O extends object, P extends string>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much better now, thanks! I would just now rather move isObjectWithProperty and hasFunction outside the isSignedReadStateRequestWithExpiry function, especially because they are so generic and could be used elsewhere.

krpeacock and others added 8 commits April 23, 2025 13:01
Co-authored-by: Nathan Mc Grath <contact@nathanos.dev>
Co-authored-by: Luca Bertelli <luca.bertelli@dfinity.org>
* refactor: use new error system and error codes

* test: update throw assertions to use the new error classes

* feat: cbor error

* test: assert error kind

* test: fix e2e and mitm tests for certificate errors

* test: remove console logs

* fix: remove code and kind props from AgentErrorV2

* feat: der errors

* feat: der error on public key

* feat: hex decode error

* feat: timeout errors

* feat: polling errors

* feat: canister status errors

* feat: hash value errors

* refactor: use error kind constructors

* refactor: extend class instead of implementing abstract
@krpeacock krpeacock enabled auto-merge (squash) April 23, 2025 21:48
Copy link
Member

@ilbertt ilbertt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are still some comments not resolved, so @krpeacock feel free to fix and/or resolve them.

Approving in the meantime.

@krpeacock krpeacock merged commit 880f18e into main Apr 24, 2025
33 checks passed
@krpeacock krpeacock deleted the kaia/SDK-1992-signed-unsigned-readstate branch April 24, 2025 06:59
krpeacock added a commit that referenced this pull request May 2, 2025
Co-authored-by: Luca Bertelli <luca.bertelli@dfinity.org>
Co-authored-by: Nathan Mc Grath <contact@nathanos.dev>
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 this pull request may close these issues.

4 participants