AcalaNetwork / chopsticks

Create parallel reality of your Substrate network.
Apache License 2.0
138 stars 84 forks source link

Error when fork Async Backing Enabling Runtime #808

Closed sfffaaa closed 2 months ago

sfffaaa commented 2 months ago

Hi, we encountered a similar issue: https://github.com/AcalaNetwork/chopsticks/pull/743. However, the fix doesn't help in our case.

    app: "chopsticks"
                     runtime  ERROR: panicked at /home/jaypan/.cargo/git/checkouts/polkadot-sdk-d4b773be765ce22f/538d3a3/substrate/frame/aura/src/lib.rs:416:9:
assertion `left == right` failed: Timestamp slot must match `CurrentSlot`
  left: Slot(287413136)
 right: Slot(287413137)
[07:53:50.693] WARN (block-builder): Failed to apply inherents {} Error: wasm `unreachable` instruction executed
    app: "chopsticks"
file:///home/jaypan/Work/peaq/chopsticks/packages/core/src/blockchain/block-builder.ts:190
            throw new Error('Failed to apply inherents');
                  ^

Error: Failed to apply inherents
    at initNewBlock (file:///home/jaypan/Work/peaq/chopsticks/packages/core/src/blockchain/block-builder.ts:190:19)
    at async buildBlock (file:///home/jaypan/Work/peaq/chopsticks/packages/core/src/blockchain/block-builder.ts:297:44)
    at async #buildBlock (file:///home/jaypan/Work/peaq/chopsticks/packages/core/src/blockchain/txpool.ts:215:47)
    at async #buildBlockIfNeeded (file:///home/jaypan/Work/peaq/chopsticks/packages/core/src/blockchain/txpool.ts:199:13)

Is that related to https://github.com/paritytech/polkadot-sdk/pull/3211?

My command is this

yarn start -e wss://docker-test.peaq.network -w peaq_runtime.compact.compressed.wasm.peaq.v0.0.101

And the WASM code is here

The version of WASM is based on polkadot-sdk 1.7.2

ermalkaleci commented 2 months ago

your problem seems to be missing aura runtime api to get slot duration and chopsticks is falling back to 12s block time

sfffaaa commented 2 months ago

Hi, thanks for replying. I'm checking about the aura runtime API (auraApi.slotDuration) and the return is 6000.

Screenshot 2024-08-25 at 13 48 03

In my survey, it looks like this didn't affect after writing, but I don't understand why

ermalkaleci commented 2 months ago

@sfffaaa ok I see. Chopsticks can't find aura storage and assuming there's no aura_runtime_api and it fallback to 12s block time

sfffaaa commented 2 months ago

Yep, you are right. I also found the solution and open the MR

ermalkaleci commented 2 months ago

I have this PR opened. I will apply a fix there

sfffaaa commented 2 months ago

Cool, that will be great! Thank you very much!