Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Consensus error between native and wasm while deploying a smart-contract #1553

Closed
pepyakin opened this issue Jan 24, 2019 · 4 comments
Closed
Assignees
Labels
U1-asap No need to stop dead in your tracks, however issue should be addressed as soon as possible.
Milestone

Comments

@pepyakin
Copy link
Contributor

Discovered when I was deploying a smart-contract erc20token.wasm.gz on 9040ca9

I'm getting this:

2019-01-24 16:04:20 Starting consensus session on top of parent 0x6e94274eddbca03ca6b59861e3f72f32d014a52b5e68080832a3f1e905f0244c
Runtime: 613ebf890e8f952cc3d61cc188bc27cab9fc115eef71b134e4a2b220f2a71aba
613ebf890e8f952cc3d61cc188bc27cab9fc115eef71b134e4a2b220f2a71aba
/Users/pepyakin/dev/parity/substrate/srml/contract/src/wasm/prepare.rs
44
60
2019-01-24 16:04:22 Consensus error between wasm and native runtime execution at block Hash(0x6e94274eddbca03ca6b59861e3f72f32d014a52b5e68080832a3f1e905f0244c)
2019-01-24 16:04:22    Function "BlockBuilder_apply_extrinsic"
2019-01-24 16:04:22    Native result Ok([0, 0])
2019-01-24 16:04:22    Wasm result Err(Error(Wasmi(Trap(Trap { kind: Unreachable })), State { next_error: None, backtrace: InternalBacktrace { backtrace: None } }))

(613ebf890e8f952cc3d61cc188bc27cab9fc115eef71b134e4a2b220f2a71aba is the hash of code to verify that they work with the same input code)

@Robbepop
Copy link
Contributor

I tried deploying the same smart contract (but probably different version - in particular this version of it) in my local chain with the following similar output:

2019-01-24 16:57:24 Starting consensus session on top of parent 0x1e7e30357be4b2cab683f4138732bd785d18c0fc5da04cec50652856376c03c4
2019-01-24 16:57:24 Consensus error between wasm and native runtime execution at block Hash(0x1e7e30357be4b2cab683f4138732bd785d18c0fc5da04cec50652856376c03c4)
2019-01-24 16:57:24    Function "BlockBuilder_apply_extrinsic"
2019-01-24 16:57:24    Native result Ok([0, 0])
2019-01-24 16:57:24    Wasm result Ok([0, 1])
2019-01-24 16:57:24 Prepared block for proposing at 363 [hash: 0x307e59eb03d7a28b72271c15003fab11e7abfe2d20cc47b71b1890211a4a89c7; parent_hash: 0x1e7e…03c4; extrinsics: [0x45a0…060b, 0x0909…7c46]]
2019-01-24 16:57:24 Pre-sealed block for proposal at 363. Hash now 0x224447adbdcf05624b53cdc33e821ede6173fc6387d01093d0e5c9065541767a, previously 0x307e59eb03d7a28b72271c15003fab11e7abfe2d20cc47b71b1890211a4a89c7.
Hash: given=656464f4e3fc1c1066a30231f0e72cf1c6317808392389339ea8d2419befb002, expected=d2ddb769cb4e0d0e64b5b38d7f40bac376ec36097e3f2f0ee7ade55b275c718d
thread 'tokio-runtime-worker-6' panicked at 'Storage root must match that calculated.', srml/executive/src/lib.rs:218:3
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
can't decode wasm code

@pepyakin pepyakin added the I3-bug The node fails to follow expected behavior. label Jan 24, 2019
@Robbepop
Copy link
Contributor

Robbepop commented Jan 24, 2019

I tried deploying the same contract (and same version of it) with substrate at this commit.

And apparently PUT_CODE worked, however due to another bug using the UI I wasn't yet able to instantiate the contract using CREATE.

@jacogr
Copy link
Contributor

jacogr commented Jan 24, 2019

polkadot-js API is currently missing the new-ish CodeHash (& Schedule) types, so in this case it doesn't know wtf to do with the encoding of those those. So the UI is not happy when trying to use those types.

Pulling this is to add the types, will update apps as soon as that is available - polkadot-js/api#634

@gavofyork
Copy link
Member

Assuming you have an up to date wasm runtime blob, then the allocator look to be prime suspect...

@gavofyork gavofyork added F0-consensus U1-asap No need to stop dead in your tracks, however issue should be addressed as soon as possible. and removed I3-bug The node fails to follow expected behavior. labels Jan 25, 2019
@gavofyork gavofyork added this to the 1.0gamma milestone Jan 25, 2019
@cmichi cmichi self-assigned this Jan 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
U1-asap No need to stop dead in your tracks, however issue should be addressed as soon as possible.
Projects
None yet
Development

No branches or pull requests

5 participants