substrate-developer-hub / substrate-docs

Substrate Developer Hub. Substrate is powered by best in class cryptographic research and comes with peer to peer networking, consensus mechanisms, and much more.
https://docs.substrate.io
BSD Zero Clause License
127 stars 271 forks source link

Update docs and tutorials for new ChainSpec API #2061

Open sacha-l opened 10 months ago

sacha-l commented 10 months ago

Changes in how the chainspec is generated (see: https://github.com/paritytech/polkadot-sdk/pull/1256) may affect the following tutorials that mention generating chainspecs for Rococo runtimes :

The docs on how to generate a chain spec will also need updating (see: the chain-spec-builder util section in https://github.com/paritytech/polkadot-sdk/pull/1256).

In addition, from_genesis is deprecated in favour of builder. So the files in the relay-chain-specs folder will need updating too.

cc @michalkucharczyk

Note that because the node templates that these tutorials reference are still using the polkadot-v1.0.0 branch on the archived Substrate repo, this change won't have an immediate impact until the templates get updated from the Polkadot SDK repo upstream.

saevaryoma commented 6 months ago

Is this issue on progress? Since I can't produce a customSpec.json from build-spec command that is relevant with the documentation as status-quo. Especially the one produced has no parts related to aura. Either customSpec.json of the document version or document needs updates. @sacha-l @wentelteefje @Rashmirreddy

michalkucharczyk commented 6 months ago

@saevaryoma would you please point to the specific part of docs that are no longer relevant?

saevaryoma commented 6 months ago
{
  "name": "Local Testnet",
  "id": "local_testnet",
  "chainType": "Local",
  "bootNodes": [],
  "telemetryEndpoints": null,
  "protocolId": null,
  "properties": null,
  "forkBlocks": null,
  "badBlocks": null,
  "lightSyncState": null,
  "codeSubstitutes": {},
  "genesis": {
    "runtimeGenesis": {
     "code": {
         // lots of code 
     },
     "patch": {
        "assets": {
          "assets": [
            [
              9,
              "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
              true,
              1
            ]
          ]
        },
        "babe": {
          "epochConfig": {
            "allowed_slots": "PrimaryAndSecondaryPlainSlots",
            "c": [
              1,
              4
            ]
          }
        },
        "balances": {
          "balances": [
            [
              "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
              1000000000000000000000
            ],
            [
              "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
              1000000000000000000000
            ],
            [
              "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
              1000000000000000000000
            ],
            [
              "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy",
              1000000000000000000000
            ],
            [
              "5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw",
              1000000000000000000000
            ],
            [
              "5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL",
              1000000000000000000000
            ],
            [
              "5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY",
              1000000000000000000000
            ],
            [
              "5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc",
              1000000000000000000000
            ],
            [
              "5Ck5SLSHYac6WFt5UZRSsdJjwmpSZq85fd5TRNAdZQVzEAPT",
              1000000000000000000000
            ],
            [
              "5HKPmK9GYtE1PSLsS1qiYU9xQ9Si1NcEhdeCq9sw5bqu4ns8",
              1000000000000000000000
            ],
            [
              "5FCfAonRZgTFrTd9HREEyeJjDpT397KMzizE6T3DvebLFE7n",
              1000000000000000000000
            ],
            [
              "5CRmqmsiNFExV6VbdmPJViVxrWmkaXXvBrSX8oqBT8R9vmWk",
              1000000000000000000000
            ]
          ]
        },
        "elections": {
          "members": [
            [
              "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
              1000000000000000000
            ],
            [
              "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
              1000000000000000000
            ],
            [
              "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
              1000000000000000000
            ],
            [
              "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy",
              1000000000000000000
            ],
            [
              "5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw",
              1000000000000000000
            ],
            [
              "5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL",
              1000000000000000000
            ]
          ]
        },
        "nominationPools": {
          "minCreateBond": 1000000000000000,
          "minJoinBond": 100000000000000
        },
        "session": {
          "keys": [
            [
              "5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY",
              "5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY",
              {
                "authority_discovery": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
                "babe": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
                "grandpa": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
                "im_online": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
                "mixnet": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
              }
            ],
            [
              "5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc",
              "5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc",
              {
                "authority_discovery": "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
                "babe": "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
                "grandpa": "5GoNkf6WdbxCFnPdAnYYQyCjAKPJgLNxXwPjwTh6DGg6gN3E",
                "im_online": "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
                "mixnet": "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty"
              }
            ]
          ]
        },
        "society": {
          "pot": 0
        },
        "staking": {
          "invulnerables": [
            "5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY",
            "5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc"
          ],
          "minimumValidatorCount": 2,
          "slashRewardFraction": 100000000,
          "stakers": [
            [
              "5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY",
              "5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY",
              1000000000000000000,
              "Validator"
            ],
            [
              "5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc",
              "5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc",
              1000000000000000000,
              "Validator"
            ]
          ],
          "validatorCount": 2
        },
        "sudo": {
          "key": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
        },
        "technicalCommittee": {
          "members": [
            "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
            "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
            "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
            "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy",
            "5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw",
            "5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL"
          ]
        }
      }
    }
  }
}

This is what you get after ./target/release/substrate-node build-spec --chain local > demo.json. There is, however, no part related to aura > authorities nor grandpa > authorities as the document denotes. at no. 8, 9 section @michalkucharczyk

saevaryoma commented 6 months ago

Oops... it was node-template and not substrate-node. I got confused and thought they would produce the same thing! Thanks for the heads-up @michalkucharczyk