Skip to content

Conversation

@JoeCap08055
Copy link
Collaborator

Description

This PR does the following:

  • Adds revoked_at block number to the overall DelegationResponse, indicating the revocation of the overall Provider relationship, rather than individual Intent(s)
  • Adds explicit_revoked_at block number to DelegationResponse for each delegated Intent; the existing revoked_at maintains its original meaning of the earlier of the Intent or overall Delegation revocation block.

Goal

Closes #2660

Checklist

  • Updated Pallet Readme?
  • Updated js/api-augment for Custom RPC APIs?
  • Unit Tests added?
  • Spec version incremented?

Comment on lines +97 to +100
/// Block number when the permission was/will be EFFECTIVELY revoked, taking into consideration the overall provider delegation revocation.
pub revoked_at: BlockNumber,
/// Block number the permission was/will be explicitly revoked (i.e., not implicitly revoked by a top-level revocation) (0 = not revoked)
pub explicit_revoked_at: BlockNumber,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Opted to add new explicit_revoked_at instead of effective_revoked_at, because revoked_at in this context has historically ALWAYS meant the effective revocation block.

@github-actions github-actions bot added the metadata-changed Metadata has changed since the latest full release label Jan 5, 2026
@github-actions github-actions bot removed the metadata-changed Metadata has changed since the latest full release label Jan 5, 2026
@codecov
Copy link

codecov bot commented Jan 5, 2026

Codecov Report

❌ Patch coverage is 96.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
common/primitives/src/msa.rs 90.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
pallets/msa/src/lib.rs 92.39% <100.00%> (+0.01%) ⬆️
pallets/msa/src/rpc/src/lib.rs 67.28% <ø> (ø)
common/primitives/src/msa.rs 88.42% <90.00%> (-0.22%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions bot added the metadata-changed Metadata has changed since the latest full release label Jan 5, 2026
@github-actions github-actions bot added metadata-changed Metadata has changed since the latest full release and removed metadata-changed Metadata has changed since the latest full release labels Jan 5, 2026
Copy link
Collaborator

@shannonwells shannonwells left a comment

Choose a reason for hiding this comment

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

Looks good, ship it!

Copy link
Collaborator

@aramikm aramikm left a comment

Choose a reason for hiding this comment

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

Approving, added a few comment just to make sure.

s.serialize_field("schema_id", &self.granted_id)?;
s.serialize_field("granted_id", &self.granted_id)?;
s.serialize_field("revoked_at", &self.revoked_at)?;
s.serialize_field("explicit_revoked_at", &self.explicit_revoked_at)?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

for these do we need to implement deserialization also? Since the default would not work

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think we ever deserialize...? The serialization is only for the node to generate the RPC JSON response for the custom RPC, I think.

SchemaGrantResponse: {
schema_id: 'IntentId',
revoked_at: 'BlockNumber',
explicit_revoked_at: 'BlockNumber',
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Do we need this field?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So, originally I thought that we had changed the behavior of the endpoint to tweak the revoked_at to show the effective revocation block, so @enddynayn suggested I instead keep revoked_at unmodified and add effective_revoked_at. However, on further investigation, we've ALWAYS tweaked the response of this endpoint to show the effective revocation block. So, we could just leave it alone. But that would mean the only way to determine if a permission was explicitly revoked would be to use a storage query, and we're trying to avoid those by giving clients appropriate runtime APIs. So I figured if we add explicit_revoked_at, then we never need to use a storage query.

I'm happy to remove if there's strong consensus against, though, since there isn't really a strong use case for needing the explicit_revoked_at block.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I like the idea of getting everything that is needed using this. My only concern was about backwards compatibility and making sure that there is no change of meaning in a way that if some service is using these would get confused or break.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If the backwards compatibility is ensured either by changing the using services or etc. then this should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

metadata-changed Metadata has changed since the latest full release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delegation API is missing top-level revocation block

4 participants