Closed DanielMS93 closed 1 year ago
further info from some investigations:
I think the signed extensions are wrong...
ok i think the type for the nonce enum is incorrect? it is currently set to be scale_info::601
whilst i think it should be the same as tip? i.e. scale_info::604
?
Confirmed, I debugged as well and there are currently actually several issues:
SetEvmOrigin
. Shouldn't be a problem though, because it doesn't seems to add any addition payload to the extrinsic or signature.CheckNonce
extension seems indeed changed to a Struct
type, requiring the input to be {'nonce': 5}
in stead of the int 5
. This is causing the mentioned exception to be thrown. I will have to change the input to match the type of the CheckNonce
extension. A workaround could be to for the time being wrap the nonce e.g.: substrate.create_signed_extrinsic(call=call, keypair=keypair, nonce={'nonce': nonce})
RuntimeApi
call to retrieve the nonce required manual type definition override (at least until MetadataV15
is available in Substrate). There is also a way to workaround this, I will look into thisExtrinsicSignature
detection, which cannot be easily worked around with, I will have to fix this and release before it's usable for Acala. ok i think the type for the nonce enum is incorrect? it is currently set to be
scale_info::601
whilst i think it should be the same as tip? i.e.scale_info::604
?
The type is correct, because this is retrieved from the embedded metadata (substrate.metadata[1][1]['extrinsic']['signed_extensions'].value
), but the issue is that the py-substrate-interface
library assumes its an Compact
when it passes an int
in the encode()
method. This needs to be changed to modify the input (or maybe better, to make py-scalecodec
tolerate a non-dict input for a Struct
when it only has 1 element. (e.g. 6
turns automatically into {'nonce': 6}
I'm running out of time today, but I will address this asap, as it blocks usage for networks like Acala.
What you could try as a temporary workaround is:
keypair = Keypair.create_from_uri("//Alice")
nonce = substrate.get_account_nonce(keypair.ss58_address)
extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair, nonce={'nonce': nonce})
This seems to work
thanks so much for getting back. oh interesting! i will give it a try and let you know
This seems to work
Too soon.. I forgot I already locally changed https://github.com/polkascan/py-substrate-interface/blob/b96c6124cf3a2ba52413fc4218e78ad5ec9e77d6/substrateinterface/base.py#L1959
to
if type(signature_cls.type_mapping) is list:
which is a dirty workaround, but if it's urgent you can get it working now by changing that.
ok nice, i have an extrinsic!! do let me know when this is more properly fixed :) but all good for now
no pressure at all of course but helpful for planning, when do u think you'll be able to make a release with these fixes?
Most likely there will be a release later today, I'm working on a fix right now
I am trying to sign a
swap_with_exact_supply
transaction on the acala network. I am using code that used to work with no problem on substrate-interface v1.0.5 but now seems to be struggling.The issue seems to arise during the processing of the generated payload where it expects the nonce to be a Dict whilst of course it is an int.
This is my call
{'call_module': 'Dex', 'call_function': 'swap_with_exact_supply', 'call_params': [{'name': 'path', 'value': [{'Token': 'AUSD'}, {'Token': 'ACA'}]}, {'name': 'supply_amount', 'value': 685233204169165}, {'name': 'min_target_amount', 'value': 2132526743724632}]}
And i get type int is not iterable.
Is this an issue you are aware of? any ideas as to what might be causing it?