patractlabs / redspot

Redspot is an Substrate pallet-contracts (ink!) development environment. Compile your contracts and run them on a different networks. Redspot's core forks from Hardhat but changed a lot to suit substrate.
https://redspot.patract.io/
Other
67 stars 22 forks source link

ABI data v3 #170

Closed OAyomide closed 2 years ago

OAyomide commented 2 years ago

My smart contract has an abiData value of v3, not v1 or v2 and its breaking in TransactionWatcher class

ii-ii-ii commented 2 years ago

What version are you using now.

drewstone commented 2 years ago

@ii-ii-ii version of what? We're both facing this issue. We are following the readme's and using npx but the compiled contracts seem to have V3 even though the compiled code doesn't support this.

drewstone commented 2 years ago

@ii-ii-ii

Redspot version 0.13.3

Node version v14.17.0

The error due to mismatched abi version yields.

yarn redspot test
yarn run v1.22.17
$ /Users/drew/webb/protocol-ink/node_modules/.bin/redspot test
✔️ No file changes checked, skip compilation
An unexpected error occurred:

TypeError: Cannot read property 'messages' of undefined
    at /Users/drew/webb/protocol-ink/node_modules/@redspot/gas-reporter/reporter/Watcher.js:44:26
    at Array.reduce (<anonymous>)
    at new TransactionWatcher (/Users/drew/webb/protocol-ink/node_modules/@redspot/gas-reporter/reporter/Watcher.js:31:86)
    at new GasReporter (/Users/drew/webb/protocol-ink/node_modules/@redspot/gas-reporter/reporter/index.js:17:19)
    at Mocha.run (/Users/drew/webb/protocol-ink/node_modules/mocha/lib/mocha.js:1022:18)
    at testFailures (/Users/drew/webb/protocol-ink/node_modules/redspot/builtin-tasks/test.js:51:15)
    at new Promise (<anonymous>)
    at SimpleTaskDefinition.action (/Users/drew/webb/protocol-ink/node_modules/redspot/builtin-tasks/test.js:50:32)
    at Environment._runTaskDefinition (/Users/drew/webb/protocol-ink/node_modules/redspot/internal/core/runtime-environment.js:129:20)
    at Environment._runTaskDefinition (/Users/drew/webb/protocol-ink/node_modules/redspot/internal/core/runtime-environment.js:129:20)
ii-ii-ii commented 2 years ago

@ii-ii-ii

Redspot version 0.13.3

Node version v14.17.0

The error due to mismatched abi version yields.

yarn redspot test
yarn run v1.22.17
$ /Users/drew/webb/protocol-ink/node_modules/.bin/redspot test
✔️ No file changes checked, skip compilation
An unexpected error occurred:

TypeError: Cannot read property 'messages' of undefined
    at /Users/drew/webb/protocol-ink/node_modules/@redspot/gas-reporter/reporter/Watcher.js:44:26
    at Array.reduce (<anonymous>)
    at new TransactionWatcher (/Users/drew/webb/protocol-ink/node_modules/@redspot/gas-reporter/reporter/Watcher.js:31:86)
    at new GasReporter (/Users/drew/webb/protocol-ink/node_modules/@redspot/gas-reporter/reporter/index.js:17:19)
    at Mocha.run (/Users/drew/webb/protocol-ink/node_modules/mocha/lib/mocha.js:1022:18)
    at testFailures (/Users/drew/webb/protocol-ink/node_modules/redspot/builtin-tasks/test.js:51:15)
    at new Promise (<anonymous>)
    at SimpleTaskDefinition.action (/Users/drew/webb/protocol-ink/node_modules/redspot/builtin-tasks/test.js:50:32)
    at Environment._runTaskDefinition (/Users/drew/webb/protocol-ink/node_modules/redspot/internal/core/runtime-environment.js:129:20)
    at Environment._runTaskDefinition (/Users/drew/webb/protocol-ink/node_modules/redspot/internal/core/runtime-environment.js:129:20)

@drewstone Try 0.13.4 to see if it works

drewstone commented 2 years ago

It solves the previous error. Still get a contract instantiation error which I'm unsure how to resolve.

2022-02-20 10:48:14        API/INIT: RPC methods not decorated: contracts_upload_code

 WARN  Unable to find handler for subscription=author_extrinsicUpdate::n2LfQTiuq77wtNK7                                                                     10:48:14

 WARN  Unable to find handler for subscription=author_extrinsicUpdate::04SJL4iXYzaJru7r                                                                     10:48:18

 ERROR  contracts.ContractTrapped(Contract trapped during execution.)                                                                                       10:48:24

    1) Creates a new instance of the mixer

  0 passing (10s)
  1 failing

  1) mixer
       Creates a new instance of the mixer:
     RedspotPluginError: Instantiation failed
      at /Users/drew/webb/protocol-ink/node_modules/@redspot/patract/contractFactory.js:225:23
      at ContractFactory.instantiateWithCode (node_modules/@redspot/patract/contractFactory.js:221:28)
      at ContractFactory.deploy (node_modules/@redspot/patract/contractFactory.js:272:31)
ii-ii-ii commented 2 years ago

@drewstone What chain are you using? Is it successful to deploy with polkadot app?

https://github.com/patractlabs/redspot/issues/171#issuecomment-1045586447

As I replied before, this is a issue with canvas.. redspot is now using the substrate-contract-node chain as the test chain.

drewstone commented 2 years ago

Tried on the contracts node you linked.

On Sun, Feb 20, 2022 at 4:29 PM iiiiiiii @.***> wrote:

@drewstone https://github.com/drewstone What chain are you using? Is it successful to deploy with polkadot app?

— Reply to this email directly, view it on GitHub https://github.com/patractlabs/redspot/issues/170#issuecomment-1046324605, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADELLF5DAH7R4TIPCATBE2DU4FMKTANCNFSM5OXPYI2Q . You are receiving this because you were mentioned.Message ID: @.***>

ii-ii-ii commented 2 years ago

Tried on the contracts node you linked.

Can you give more information, I have tested with the latest redspot 1.3.4 and did not find this problem.

drewstone commented 2 years ago

Can you try to deploy with https://github.com/webb-tools/protocol-ink @ii-ii-ii ?

drewstone commented 2 years ago

Substrate Contracts Node Version

2022-02-22 15:38:06 Substrate Contracts Node
2022-02-22 15:38:06 ✌️  version 0.6.0-82834b3-aarch64-macos
2022-02-22 15:38:06 ❤️  by Parity Technologies <admin@parity.io>, 2021-2022

Node Version

v14.17.0

Redspot Version

> npx redspot --version
0.13.4

Compiler Version

> npx redspot compile
compiler version: 0.17.0
toolchain: nightly

Testing

import { expect } from "chai";
import { artifacts, network, patract } from "redspot";

const { getContractFactory, getRandomSigner } = patract;

const { api, getAddresses, getSigners } = network;

// to call a "method", you use contract.tx.methodName(args). to get a value, you use contract.query.methodName(args).
describe('mixer', () => {
    after(() => {
        return api.disconnect()
    });

    async function setup() {
        await api.isReady;
        const signerAddresses = await getAddresses();
        const Alice = signerAddresses[0];
        const sender = await getRandomSigner(Alice, '20000 UNIT');

        return { sender, Alice };
    }

    it('Creates a new instance of the mixer', async () => {
        const { sender } = await setup();

        // Poseidon instantiation
        const poseidonContractFactory = await getContractFactory('poseidon', sender.address);
        const poseidonContract = await poseidonContractFactory.deploy('new');
        const poseidonABI = artifacts.readArtifact('poseidon');
    });
})

Testing Output

yarn test
yarn run v1.22.17
$ yarn redspot test --no-compile
$ /Users/drew/webb/protocol-ink/node_modules/.bin/redspot test --no-compile

  mixer

 WARN  Unable to find handler for subscription=chain_newHead::LBb5MP5gFIJk8dfw                                                                               15:43:46

2022-02-22 15:43:46        API/INIT: RPC methods not decorated: contracts_upload_code

 WARN  Unable to find handler for subscription=state_runtimeVersion::HPA13Rl3FeQGWxf9                                                                        15:43:47

 WARN  Unable to find handler for subscription=author_extrinsicUpdate::16uuPTukXDnPMXxE                                                                      15:43:48

 ERROR  contracts.ContractTrapped(Contract trapped during execution.)                                                                                        15:43:54

    1) Creates a new instance of the mixer

  0 passing (7s)
  1 failing

  1) mixer
       Creates a new instance of the mixer:
     RedspotPluginError: Instantiation failed
      at /Users/drew/webb/protocol-ink/node_modules/@redspot/patract/contractFactory.js:225:23
      at ContractFactory.instantiateWithCode (node_modules/@redspot/patract/contractFactory.js:221:28)
      at ContractFactory.deploy (node_modules/@redspot/patract/contractFactory.js:272:31)

┌──────────┬─────────┬──────────────────────┬──────────────────────┬──────────────────────┬───────┐
│          │         │ Min                  │ Max                  │ Avg                  │       │
├──────────┼─────────┼─────────────┬────────┼─────────────┬────────┼─────────────┬────────┼───────┤
│ Contract │ Message │ EstimateGas │ Weight │ EstimateGas │ Weight │ EstimateGas │ Weight │ Calls │
└──────────┴─────────┴─────────────┴────────┴─────────────┴────────┴─────────────┴────────┴───────┘
ii-ii-ii commented 2 years ago

@drewstone I can't compile the contract, can you provide the contract file. Or please upgrade the substrate contract node to 0.7.0 and ink! to rc9 and try again.

ii-ii-ii commented 2 years ago

Maybe because there is something wrong with 1.3.4. https://github.com/patractlabs/redspot/issues/174

DukeCaesar commented 2 years ago

Still this issue persists with the latest 0.13.6.