Skip to content

Conversation

@viviveevee
Copy link
Contributor

@viviveevee viviveevee commented Dec 8, 2025

Description

To make integrity verification easier, compute_state_hash should be accompanied with a way to figure out when assets changed last. This PR adds get_state_info, which serves the timestamp of the last modification, and the state hash if it is currently known.

How Has This Been Tested?

Tested manually

Checklist:

  • The title of this PR complies with Conventional Commits.
  • I have edited the CHANGELOG accordingly.
  • I have made corresponding changes to the documentation.

@viviveevee viviveevee changed the title feat(asset canister): expose state info feat: asset canister exposes state info Dec 8, 2025
@viviveevee viviveevee marked this pull request as ready for review December 8, 2025 09:12
@viviveevee viviveevee requested a review from a team as a code owner December 8, 2025 09:12

type StateInfo = record {
last_state_update_timestamp: nat64;
state_hash: opt text;
Copy link
Contributor

@ggreif ggreif Dec 8, 2025

Choose a reason for hiding this comment

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

I see that this is hex-encoded. Did you also consider returning it as a blob?

Copy link
Contributor

@ggreif ggreif left a comment

Choose a reason for hiding this comment

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

LGTM. Just another thought: One could also send the last known hash(+stamp) when requesting an asset and the canister could abort when recent. Otherwise it would include its last state hash in its response along with the asset. This would make an extra endpoint unnecessary.

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.

2 participants