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

chainHead/unpin: Return error on duplicate hashes #135

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

lexnv
Copy link
Contributor

@lexnv lexnv commented Feb 14, 2024

This PR clarifies the behavior of the server when the chainHead_unpin receives duplicate hashes.

When duplicate hashes are received as parameters, the server returns -32804.
Likewise, the server could return the -32602 for invalid parameters. However, I thought a dedicated error would provide clear details to the user wrt what needs to be changed. This felt appropriate since we also have a dedicated error for withRuntime flag:

-32802 is generated if the followSubscription corresponds to a follow where withRuntime was false.

cc @paritytech/subxt-team
cc: paritytech/polkadot-sdk#3313 (comment)

Closes: #133

@lexnv lexnv merged commit 5df129d into main Feb 14, 2024
3 checks passed
github-merge-queue bot pushed a commit to paritytech/polkadot-sdk that referenced this pull request Feb 14, 2024
This PR addresses an issue where calling chainHead_unpin with duplicate
hashes could lead to unintended side effects.

This backports:
paritytech/json-rpc-interface-spec#135

While at it, have added a test to check that the global reference count
is decremented only once on unpin.

cc @paritytech/subxt-team

---------

Signed-off-by: Alexandru Vasile <[email protected]>
Co-authored-by: Davide Galassi <[email protected]>
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
This PR addresses an issue where calling chainHead_unpin with duplicate
hashes could lead to unintended side effects.

This backports:
paritytech/json-rpc-interface-spec#135

While at it, have added a test to check that the global reference count
is decremented only once on unpin.

cc @paritytech/subxt-team

---------

Signed-off-by: Alexandru Vasile <[email protected]>
Co-authored-by: Davide Galassi <[email protected]>
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.

Unclear what happens in case of duplicate hashes passed to chainHead_unstable_unpin
3 participants