Skip to content

Test parachain runtime upgrade locally #979

@Kailai-Wang

Description

@Kailai-Wang

Hi, I'd like to test and simulate the runtime upgrade locally by forking off a LIVE running parachain and execute the runtime upgrade programmatically with locally built new wasm / github release.

Here're my scripts:

I don't have sudo pallet so the authorization needs to be done via democracy.
I launch the parachain + relaychain network via chopsticks xcm and follow the system.authorize => system.apply way.

Locally the script runs well until trying to apply the upgrade (= authorization was done), then I always got error:

Apply upgrade transaction sent ✅
Transaction events: 2
Event: system.ExtrinsicSuccess {
  dispatchInfo: {
    weight: { refTime: '238,427,000', proofSize: '1,493' },
    class: 'Mandatory',
    paysFee: 'Yes'
  }
}
Event: system.ExtrinsicSuccess {
  dispatchInfo: {
    weight: { refTime: '108,157,000', proofSize: '0' },
    class: 'Mandatory',
    paysFee: 'No'
  }
}
Event: system.ExtrinsicFailed {
  dispatchError: { Module: { index: '0', error: '0x02000000' } },
  dispatchInfo: {
    weight: { refTime: '99,184,662,000', proofSize: '67,035' },
    class: 'Operational',
    paysFee: 'Yes'
  }
}

So it seems to error out with 0x02000000 from system pallet, which is FailedToExtractRuntimeVersion. It happens when sp_io::misc::runtime_version fails to extract the runtime version from the wasm.

I'm not sure why it occurs - the newly built wasm is compressed (~2MB), but sp_io::misc::runtime_version should be able to deal with compressed wasm too.

I also suspect that chopsticks/smoldot expects uncompressed wasm when calling the host fn, so I try to use uncompressed wasm when applying the upgrade, but ended up having a resourceExhausted error (so it's too large and can't fit into block weight I assume).

I'm kind of stuck on this - could you help with it? Or if you have links/docs about how to simulate runtime upgrade for a LIVE parachain, I'm happy to read them too!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions