use-ink / contracts-ui

Web application for deploying wasm smart contracts on Substrate chains that include the FRAME contracts pallet
https://contracts-ui.substrate.io/
GNU General Public License v3.0
61 stars 45 forks source link

Add support for Peaq Agung #446

Closed statictype closed 4 months ago

statictype commented 1 year ago

Describe the bug Instantiating contracts on Peak Agung breaks the UI.

TypeError: Cannot read properties of undefined (reading 'isErr')

To Reproduce Steps to reproduce the behavior:

  1. Go to https://weightv1--contracts-ui.netlify.app/?rpc=wss://wss.agung.peaq.network
  2. Instantiate sbp.contract.zip
  3. See breaking error when navigating to step 2

Expected behavior The contract instantiation for this old contract should work, tested on Apps For newer contracts the dry-run is expected to fail with CodeRejected so instantiation should not be possible.

To do:

peetzweg commented 4 months ago

Peaq Agung seems still to be running and still using weightV1. Looking into this issue it stems from this "dry run" here: https://github.com/paritytech/contracts-ui/blob/7986deca6956d0453c368f8843b0c9d500cfabb6/src/ui/components/instantiate/Step2.tsx#L89-L98

Despite the type hinting the result beeing ContractInstantiateResult containing gasConsumed it's just the inner InstantiateReturnValue. Not sure why the actual Result containing the missing gasConsumed and gasRequired is missing. Might be a combination of node software and pjs version?


/** @name ContractInstantiateResult */
export interface ContractInstantiateResult extends Struct {
    readonly gasConsumed: u64;
    readonly gasRequired: u64;
    readonly storageDeposit: StorageDeposit;
    readonly debugMessage: Text;
    readonly result: InstantiateReturnValue;
}

/** @name InstantiateReturnValue */
export interface InstantiateReturnValue extends Result<InstantiateReturnValueOk, DispatchError> {
    readonly isErr: boolean;
    readonly asErr: DispatchError;
    readonly isOk: boolean;
    readonly asOk: InstantiateReturnValueOk;
}

Is this worth further investigation or should we just drop support for WeightsV1 @cmichi ? Resulting in closing this issue and removing the weightv1 specific deploy => https://weightv1--contracts-ui.netlify.app/ . Unfortunately we don't have any visiblity how many people might use this weightsV1 ui. Probably a fraction of the people using the most recent version. I've sent you the recent analytics for the live version.

As of now it's not straight forward to be how to resolves this bug. Probably some archival search of pjs packages and investigating the peaq aaung testnet node.

peetzweg commented 4 months ago

contracts-ui dropped support for a WeightsV1 version today.