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

Extrinsic hash is None for unsigned extrinsic #113

Closed
hemz10 opened this issue Sep 13, 2023 · 3 comments · Fixed by #114
Closed

Extrinsic hash is None for unsigned extrinsic #113

hemz10 opened this issue Sep 13, 2023 · 3 comments · Fixed by #114

Comments

@hemz10
Copy link

hemz10 commented Sep 13, 2023

I am trying to decode extrinsic for a block using get_block method from py-substrate interface. For an extrinsic with no signer, extrinsic hash is none. How do we get extrinsic hash when there is no signer.

Extrinsic hash is assigned to None here when there is no signer

Here is my code example:

from substrateinterface import SubstrateInterface
def polkadot_decodeExtrinsic(self):
    substrate = SubstrateInterface(url="https://rpc.polkadot.io")
    block = substrate.get_block(
        block_hash='0xa25f3b3840989455423acd6626ceb9dc91b9d2044ee8430f234f8c0c46ed728c')
        for i, extrinsic in enumerate(block['extrinsics']):
                assert (extrinsic.value["extrinsic_hash"]) is None
               # This should not be none

Expected Behaviour:
The Hash should not be None and there should be some value as seen in polkascan explorer for the first and as well as second extrinsic.

Reference:
The same issue was reported. Issue link fyr here

@arjanz
Copy link
Member

arjanz commented Sep 13, 2023

Thanks for pointing this out, the previous fix dud generate but still didn't include the extrinsic hash when decoding unsigned extrinsics.

Original rationale was that uniqueness cannot be guaranteed for unsigned extrinsics, but in practice collisions don't happen that often.

@arjanz
Copy link
Member

arjanz commented Sep 13, 2023

@hemz10
Copy link
Author

hemz10 commented Sep 13, 2023

Thank you, It's working now !!

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.

2 participants