Moonsong-Labs / moonwall

Testing Framework for Substrate networks
https://moonsong-labs.github.io/moonwall/
GNU General Public License v3.0
10 stars 5 forks source link

Abnormal Closure of chopsticks fork on port `8000` for Polkadot parachain network #338

Closed Chralt98 closed 10 months ago

Chralt98 commented 10 months ago

I have the following moonwall configuration:

{
   "label": "moonwall_config",
   "defaultTestTimeout": 120000,
   "scriptsDir": "scripts/",
   "environments": [
      {
         "name": "chopsticks_zeitgeist_upgrade",
         "testFileDir": ["tests/rt-upgrade-chopsticks"],
         "runScripts": [
            "build-parachain.sh"
         ],
         "foundation": {
             "type": "chopsticks",
             "rtUpgradePath": "../target/debug/wbuild/zeitgeist-runtime/zeitgeist_runtime.compact.compressed.wasm",
             "launchSpec": [
                 {
                     "name": "db",
                     "type": "parachain",
                     "configPath": "./configs/zeitgeist.yml"
                 }
             ]
         },
         "connections": [
             {
                 "name": "DB",
                 "type": "polkadotJs",
                 "endpoints": ["ws://127.0.0.1:8000"]
             }
         ]
      },
      {
         "name": "chopsticks_battery_station_upgrade",
         "testFileDir": ["tests/rt-upgrade-chopsticks"],
         "runScripts": [
            "build-parachain.sh"
         ],
         "foundation": {
             "type": "chopsticks",
             "rtUpgradePath": "../target/debug/wbuild/battery-station-runtime/battery_station_runtime.compact.compressed.wasm",
             "launchSpec": [
                 {
                     "name": "db",
                     "type": "parachain",
                     "configPath": "./configs/battery-station.yml"
                 }
             ]
         },
         "connections": [
             {
                 "name": "DB",
                 "type": "polkadotJs",
                 "endpoints": ["ws://127.0.0.1:8000"]
             }
         ]
      }
   ]
}

I get the following error, but only for the chopsticks_zeitgeist_upgrade environment.

 FAIL  tests/rt-upgrade-chopsticks/test-chopsticks-runtime-upgrade.ts > 🗃️  #CAN Chopsticks Zeitgeist or Battery Station Upgrade Test
Error: disconnected from ws://127.0.0.1:8000: 1006:: Abnormal Closure
 ❯ WebSocket.__internal__onSocketClose node_modules/.pnpm/@polkadot+rpc-provider@10.11.1/node_modules/@polkadot/rpc-provider/ws/index.js:349:23
 ❯ callListener node_modules/.pnpm/ws@8.14.2/node_modules/ws/lib/event-target.js:290:14
 ❯ WebSocket.onClose node_modules/.pnpm/ws@8.14.2/node_modules/ws/lib/event-target.js:220:9
 ❯ WebSocket.emit node:events:514:28
 ❯ WebSocket.emitClose node_modules/.pnpm/ws@8.14.2/node_modules/ws/lib/websocket.js:260:10
 ❯ Socket.socketOnClose node_modules/.pnpm/ws@8.14.2/node_modules/ws/lib/websocket.js:1272:15
 ❯ Socket.emit node:events:514:28
 ❯ TCP.<anonymous> node:net:337:12

You have to know that the rt-upgrade-chopsticks test works for chopsticks_battery_station_upgrade. So I am running the same test for both networks. Battery Station is our Zeitgeist parachain test network on the rococo relaychain, while chopsticks_zeitgeist_upgrade should trigger the runtime upgrade for the main-net, which is connected to Polkadot. The main-net chopsticks upgrade doesn't work, but the rococo parachain does. What could the cause of this problem be? Is this issue caused by chopsticks, if yes, what can be done?

Chralt98 commented 10 months ago

By the way, how to set the environment variables for the chopsticks foundation?

PORT: Set port for Chopsticks to listen on, default is 8000 LOG_LEVEL: Set log level, default is info. Available options: trace, debug, info, warn, error VERBOSE_LOG: If set, do not truncating log messages

I can only see options for the configuration of the chopsticks launch spec. But I assume, this does not set the environment variables.

EDIT:

Yeah this can be used for the environment variables for the chopsticks command. For example "envVars": ["LOG_LEVEL=trace", "VERBOSE_LOG"].

Here is the log and now I know what the cause of the problem is, thanks to Chopsticks logging.

[12:46:30.040] DEBUG (plugin/19898): Registered plugin CLI: decode-key
[12:46:30.061] DEBUG (plugin/19898): Registered plugin CLI: dry-run
[12:46:30.063] DEBUG (plugin/19898): Registered plugin CLI: follow-chain
[12:46:30.070] DEBUG (plugin/19898): Registered plugin CLI: run-block
[12:46:30.078] DEBUG (plugin/19898): Registered plugin CLI: try-runtime
[12:46:30.485] DEBUG (19898): Args
    endpoint: "wss://main.rpc.zeitgeist.pm/ws"
    buildBlockMode: 2
    db: {
      "datasource": {}
    }
    mockSignatureHost: true
    blockHash: "0x29861a163c368ef8ba6bde1aee6e5e343d26321c4ff00bd547d4c837e85af8c8"
Unable to map [u8; 32] to a lookup index
[12:46:33.019] DEBUG (ws/19898): Try starting on port 8000
[12:46:33.085] INFO (xcm/19898): Zeitgeist RPC listening on port 8000
[12:46:33.128] DEBUG (ws/19898): New connection
[12:46:33.219] DEBUG (ws/19898): Connection closed
[12:46:33.219] DEBUG (ws/19898): New connection
[12:46:33.438] DEBUG (ws/19898): New connection
[12:46:33.519] DEBUG (plugin/19898): Registered plugin set-storage RPC
[12:46:33.520] DEBUG (19898): dev_setStorage
    hash: "0x29861a163c368ef8ba6bde1aee6e5e343d26321c4ff00bd547d4c837e85af8c8"
    values: {
      "parachainSystem": {
        "authorizedUpgrade": "0x8ddc7dd6bc922210fdb4fe350399eb4824a75ed327d99a0737fab2c58641a8af"
      }
    }
[12:46:33.541] DEBUG (ws/19898): Connection closed
[12:46:33.541] DEBUG (ws/19898): New connection
[12:46:33.623] DEBUG (plugin/19898): Registered plugin new-block RPC
[12:46:33.950] INFO (block-builder/19898): Try building block #4,456,479
    number: 4456479
    extrinsicsCount: 0
    umpCount: 0
runtime                      ERROR: panicked at 'Block invalid, supplied author is not eligible.', /home/builder/cargo/git/checkouts/nimbus-f0ce2f53edf2630d/1c8ba39/pallets/author-inherent/src/lib.rs:133:13
[12:46:37.075] WARN (block-builder/19898): Failed to apply inherents {} Error: wasm `unreachable` instruction executed
/blockchain/block-builder.js:159
            throw new Error('Failed to apply inherents');
                  ^

Error: Failed to apply inherents
    at initNewBlock (/blockchain/block-builder.js:159:19)
    at async buildBlock (/blockchain/block-builder.js:264:33)
    at async TxPool.buildBlock (/blockchain/txpool.js:313:43)
    at async TxPool.buildBlockIfNeeded (/blockchain/txpool.js:295:9)

Node.js v20.10.0