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

Polkadot.js fails to decode dry run error with contracts-node v0.12.0 #282

Closed
statictype opened this issue Apr 13, 2022 · 1 comment · Fixed by #316
Closed

Polkadot.js fails to decode dry run error with contracts-node v0.12.0 #282

statictype opened this issue Apr 13, 2022 · 1 comment · Fixed by #316
Labels
bug Something isn't working

Comments

@statictype
Copy link
Contributor

Polkadot.js fails to decode dry run error with contracts-node v0.12.0

To Reproduce

  1. run the latest contracts-node in --dev mode (v0.12.0)
  2. try to deploy a multisig
  3. predicted outcome panel shows no values and I can move to the next step even though the dry run fails.
  4. there is a console error
InstantiateContext.tsx:79 Error: createType(ContractInstantiateResult):: Struct: failed on result: {"_enum":{"Ok":"InstantiateReturnValueOk","Err":"DispatchError"}}:: Enum(Err):: Enum(Module):: Struct: failed on error: u8:: u8: Input too large. Found input with 28 bits, expected 8
    at createTypeUnsafe (type.js:56:1)
    at TypeRegistry.createTypeUnsafe (registry.js:288:28)
    at RpcCore._formatOutput (bundle.js:355:1)
    at RpcCore._formatResult (bundle.js:184:1)
    at callWithRegistry (bundle.js:209:1)

Expected behavior
the Predicted Outcome panel shows a ContractTrapped error because of the requirement being too low. Next button is disabled.

Additional context
Dry run works fine with contracts-node v0.11.0

@statictype statictype added the bug Something isn't working label Apr 13, 2022
@athei
Copy link
Contributor

athei commented Apr 13, 2022

I think this is because the DispatchError type was changed by this PR.

The Module variant was changed. The error field is no longer an index (u8) but a 4 byte array that encodes the error using SCALE instead of relying on a lookup.

/// Old type
Module {
	index: u8,
	error: u8,
	message: Option<&'static str>,
}

/// New type
Module {
	index: u8,
	error: [u8; 4],
	message: Option<&'static str>,
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants