Skip to content

Commit

Permalink
Merge branch 'development' into feat/k/btree-scale
Browse files Browse the repository at this point in the history
  • Loading branch information
kanishkatn authored Dec 15, 2023
2 parents 73f923f + 989b6bf commit 71cbfb2
Show file tree
Hide file tree
Showing 263 changed files with 4,606 additions and 3,097 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CODEOWNERS: https://help.github.com/articles/about-codeowners/

# Primary repo maintainers
* @edwardmack @timwu20 @EclesioMeloJunior @jimjbrettj @kishansagathiya @dimartiro @kanishkatn
* @edwardmack @timwu20 @EclesioMeloJunior @jimjbrettj @kishansagathiya @dimartiro @kanishkatn @axaysagathiya
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
platform: [macos-latest, buildjet-4vcpu-ubuntu-2204]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
stable: true
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
timeout-minutes: 60
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
stable: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- uses: actions/checkout@v4

- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
stable: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/copyright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- uses: actions/checkout@v4

- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
stable: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/devnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- uses: actions/checkout@v4

- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
stable: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
with:
all_but_latest: true

- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
stable: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
with:
all_but_latest: true

- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
stable: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mocks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:

- uses: actions/checkout@v4

- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
stable: true
check-latest: true

- run: go install github.com/golang/mock/mockgen@v1.6
- run: go install go.uber.org/mock/mockgen@latest

- name: Check devnet module
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
node-version: latest
- name: Install dependencies
run: npm install @semantic-release/changelog @semantic-release/git @semantic-release/changelog @semantic-release/commit-analyzer @semantic-release/exec @semantic-release/git semantic-release/release-notes-generator
- name: Release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
with:
all_but_latest: true

- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
stable: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/zombienet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
zombienet-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
stable: true
Expand Down
102 changes: 102 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

48 changes: 37 additions & 11 deletions chain/kusama/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
"id": "ksmcc3",
"chainType": "Live",
"bootNodes": [
"/dns/p2p.cc3-0.kusama.network/tcp/30100/p2p/12D3KooWDgtynm4S9M3m6ZZhXYu2RrWKdvkCSScc25xKDVSg1Sjd",
"/dns/p2p.cc3-1.kusama.network/tcp/30100/p2p/12D3KooWNpGriWPmf621Lza9UWU9eLLBdCFaErf6d4HSK7Bcqnv4",
"/dns/p2p.cc3-2.kusama.network/tcp/30100/p2p/12D3KooWLmLiB4AenmN2g2mHbhNXbUcNiGi99sAkSk1kAQedp8uE",
"/dns/p2p.cc3-3.kusama.network/tcp/30100/p2p/12D3KooWEGHw84b4hfvXEfyq4XWEmWCbRGuHMHQMpby4BAtZ4xJf",
"/dns/p2p.cc3-4.kusama.network/tcp/30100/p2p/12D3KooWF9KDPRMN8WpeyXhEeURZGP8Dmo7go1tDqi7hTYpxV9uW",
"/dns/p2p.cc3-5.kusama.network/tcp/30100/p2p/12D3KooWDiwMeqzvgWNreS9sV1HW3pZv1PA7QGA7HUCo7FzN5gcA",
"/dns/kusama-connect-0.parity.io/tcp/443/wss/p2p/12D3KooWBjxpFhVNM9poSsMEfdnXJaSWSZQ7otK9aV1SPA9zJp5W",
"/dns/kusama-connect-1.parity.io/tcp/443/wss/p2p/12D3KooWAJRVca93jLm4zft4rtTLLxNV4ZrHPMBkbGy5XkXooBFt",
"/dns/kusama-connect-2.parity.io/tcp/443/wss/p2p/12D3KooWLn22TSPR3HXMRSSmWoK4pkDtspdCVi5j86QyyUNViDeL",
"/dns/kusama-connect-3.parity.io/tcp/443/wss/p2p/12D3KooWSwnJSP3QJ6cnFCTpcXq4EEFotVEiQuCWVprzCnWj5e4G",
"/dns/kusama-connect-4.parity.io/tcp/443/wss/p2p/12D3KooWHi7zHUev7n1zs9kSQwh4KMPJcS8Jky2JN58cNabcXGvK",
"/dns/kusama-connect-5.parity.io/tcp/443/wss/p2p/12D3KooWMBF6DXADrNLg6kNt1A1zmKzw478gJw79NmTQhSDxuZvR",
"/dns/kusama-connect-6.parity.io/tcp/443/wss/p2p/12D3KooWNnG7YqYB9eEoACRuSEax8qhuPQzRn878AWKN4vUUtQXd",
"/dns/kusama-connect-7.parity.io/tcp/443/wss/p2p/12D3KooWMmtoLnkVCGyuCpsWw4zoNtWPH4nsVLn92mutvjQknEqR",
"/dns/p2p.0.kusama.network/tcp/30333/p2p/12D3KooWJDohybWd7FvRmyeGjgi56yy36mRWLHmgRprFdUadUt6b",
"/dns/p2p.1.kusama.network/tcp/30333/p2p/12D3KooWC7dnTvDY97afoLrvQSBrh7dDFEkWniTwyxAsBjfpaZk6",
"/dns/p2p.2.kusama.network/tcp/30333/p2p/12D3KooWGGK6Mj1pWF1bk4R1HjBQ4E7bgkfSJ5gmEfVRuwRZapT5",
Expand All @@ -17,7 +19,31 @@
"/dns/p2p.5.kusama.network/tcp/30333/p2p/12D3KooWBsJKGJFuv83ixryzMsUS53A8JzEVeTA8PGi4U6T2dnif",
"/dns/kusama-bootnode-0.paritytech.net/tcp/30333/p2p/12D3KooWSueCPH3puP2PcvqPJdNaDNF3jMZjtJtDiSy35pWrbt5h",
"/dns/kusama-bootnode-0.paritytech.net/tcp/30334/ws/p2p/12D3KooWSueCPH3puP2PcvqPJdNaDNF3jMZjtJtDiSy35pWrbt5h",
"/dns/kusama-bootnode-1.paritytech.net/tcp/30333/p2p/12D3KooWQKqane1SqWJNWMQkbia9qiMWXkcHtAdfW5eVF8hbwEDw"
"/dns/kusama-bootnode-1.paritytech.net/tcp/30333/p2p/12D3KooWQKqane1SqWJNWMQkbia9qiMWXkcHtAdfW5eVF8hbwEDw",
"/dns/kusama-boot.dwellir.com/tcp/30333/ws/p2p/12D3KooWFj2ndawdYyk2spc42Y2arYwb2TUoHLHFAsKuHRzWXwoJ",
"/dns/kusama-boot.dwellir.com/tcp/443/wss/p2p/12D3KooWFj2ndawdYyk2spc42Y2arYwb2TUoHLHFAsKuHRzWXwoJ",
"/dns/boot.stake.plus/tcp/31333/p2p/12D3KooWLa1UyG5xLPds2GbiRBCTJjpsVwRWHWN7Dff14yiNJRpR",
"/dns/boot.stake.plus/tcp/31334/wss/p2p/12D3KooWLa1UyG5xLPds2GbiRBCTJjpsVwRWHWN7Dff14yiNJRpR",
"/dns/boot-node.helikon.io/tcp/7060/p2p/12D3KooWL4KPqfAsPE2aY1g5Zo1CxsDwcdJ7mmAghK7cg6M2fdbD",
"/dns/boot-node.helikon.io/tcp/7062/wss/p2p/12D3KooWL4KPqfAsPE2aY1g5Zo1CxsDwcdJ7mmAghK7cg6M2fdbD",
"/dns/kusama.bootnode.amforc.com/tcp/30333/p2p/12D3KooWLx6nsj6Fpd8biP1VDyuCUjazvRiGWyBam8PsqRJkbUb9",
"/dns/kusama.bootnode.amforc.com/tcp/30334/wss/p2p/12D3KooWLx6nsj6Fpd8biP1VDyuCUjazvRiGWyBam8PsqRJkbUb9",
"/dns/kusama-bootnode.polkadotters.com/tcp/30333/p2p/12D3KooWHB5rTeNkQdXNJ9ynvGz8Lpnmsctt7Tvp7mrYv6bcwbPG",
"/dns/kusama-bootnode.polkadotters.com/tcp/30334/wss/p2p/12D3KooWHB5rTeNkQdXNJ9ynvGz8Lpnmsctt7Tvp7mrYv6bcwbPG",
"/dns/boot-cr.gatotech.network/tcp/33200/p2p/12D3KooWRNZXf99BfzQDE1C8YhuBbuy7Sj18UEf7FNpD8egbURYD",
"/dns/boot-cr.gatotech.network/tcp/35200/wss/p2p/12D3KooWRNZXf99BfzQDE1C8YhuBbuy7Sj18UEf7FNpD8egbURYD",
"/dns/boot-kusama.metaspan.io/tcp/23012/p2p/12D3KooWE1tq9ZL9AAxMiUBBqy1ENmh5pwfWabnoBPMo8gFPXhn6",
"/dns/boot-kusama.metaspan.io/tcp/23015/ws/p2p/12D3KooWE1tq9ZL9AAxMiUBBqy1ENmh5pwfWabnoBPMo8gFPXhn6",
"/dns/boot-kusama.metaspan.io/tcp/23016/wss/p2p/12D3KooWE1tq9ZL9AAxMiUBBqy1ENmh5pwfWabnoBPMo8gFPXhn6",
"/dns/kusama-bootnode.turboflakes.io/tcp/30305/p2p/12D3KooWR6cMhCYRhbJdqYZfzWZT6bcck3unpRLk8GBQGmHBgPwu",
"/dns/kusama-bootnode.turboflakes.io/tcp/30405/wss/p2p/12D3KooWR6cMhCYRhbJdqYZfzWZT6bcck3unpRLk8GBQGmHBgPwu",
"/dns/kusama-boot-ng.dwellir.com/tcp/443/wss/p2p/12D3KooWLswepVYVdCNduvWRTyNTaDMXEBcmvJdZ9Bhw3u2Jhad2",
"/dns/kusama-boot-ng.dwellir.com/tcp/30334/p2p/12D3KooWLswepVYVdCNduvWRTyNTaDMXEBcmvJdZ9Bhw3u2Jhad2",
"/dns/kusama-bootnode.radiumblock.com/tcp/30335/wss/p2p/12D3KooWGzKffWe7JSXeKMQeSQC5xfBafZtgBDCuBVxmwe2TJRuc",
"/dns/kusama-bootnode.radiumblock.com/tcp/30333/p2p/12D3KooWGzKffWe7JSXeKMQeSQC5xfBafZtgBDCuBVxmwe2TJRuc",
"/dns/ksm-bootnode.stakeworld.io/tcp/30300/p2p/12D3KooWFRin7WWVS6RgUsSpkfUHSv4tfGKnr2zJPmf1pbMv118H",
"/dns/ksm-bootnode.stakeworld.io/tcp/30301/ws/p2p/12D3KooWFRin7WWVS6RgUsSpkfUHSv4tfGKnr2zJPmf1pbMv118H",
"/dns/ksm-bootnode.stakeworld.io/tcp/30302/wss/p2p/12D3KooWFRin7WWVS6RgUsSpkfUHSv4tfGKnr2zJPmf1pbMv118H"
],
"telemetryEndpoints": [
[
Expand All @@ -34,12 +60,12 @@
"consensusEngine": null,
"forkBlocks": null,
"badBlocks": [
"0x15b1b925b0aa5cfe43c88cd024f74258cb5cfe3af424882c901014e8acd0d241",
"0x2563260209012232649ab9dc003f62e274c684037de499a23062f8e0e816c605"
"0x15b1b925b0aa5cfe43c88cd024f74258cb5cfe3af424882c901014e8acd0d241",
"0x2563260209012232649ab9dc003f62e274c684037de499a23062f8e0e816c605"
],
"genesis": {
"raw": {
"top": {
"top": {
"0x9c5d795d0297be56027a4b2464e333979c5d795d0297be56027a4b2464e33397974a8f6e094002e424b603628718939b060c4c6305a73d36a014468c29b8b7d7": "0x00c0e1d0612100000000000000000000",
"0x9c5d795d0297be56027a4b2464e333979c5d795d0297be56027a4b2464e33397997f7003f78328f30c57e6ce10b1956c77d2187fe08441845cc0c18273852039": "0x00703874580800000000000000000000",
"0xc2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b41a7b36634518c4bd258451d3afca781ef41c43e2cc13767ade6d58216bb4b54e": "0x0000c52ebca2b1000000000000000000",
Expand Down Expand Up @@ -3460,7 +3486,7 @@
"0x9c5d795d0297be56027a4b2464e333979c5d795d0297be56027a4b2464e33397a95fc10899f9939fe9f376f90b678d436e6cbd6cfbad752e1d16e1bd207970fd": "0x00aa8af681571e000000000000000000",
"0x9c5d795d0297be56027a4b2464e333979c5d795d0297be56027a4b2464e33397be0013089e49d5187af79a902767da35cf39652bf8ee558f7780d185a484dd3c": "0x007202ee615f09000000000000000000"
},
"childrenDefault":{}
"childrenDefault": {}
}
}
}
8 changes: 4 additions & 4 deletions cmd/gossamer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ gossamer version
### Initialize the node

```bash
gossamer init --chain westend --key alice --basepath /tmp/gossamer
gossamer init --chain westend --key alice --base-path /tmp/gossamer
```

This initialises the node with the default configuration for the `westend` chain with the `alice` keypair at the base-path `/tmp/gossamer`.
Expand All @@ -45,7 +45,7 @@ This initialises the node with the default configuration for the `westend` chain
Supported flags:
--chain: The chain spec to initialise the node with. Supported chains are `polkadot`, `kusama`, `westend`, `westend-dev` and `westend_local`. It also accepts the chain-spec json path.
--key: The keypair to use for the node.
--basepath: The working directory for the node.
--base-path: The working directory for the node.
```

The init command will create the following files in the base-path:
Expand All @@ -63,15 +63,15 @@ The node configuration can be modified in the `config.toml` file.
### Start the node

```bash
gossamer --basepath /tmp/gossamer --key alice
gossamer --base-path /tmp/gossamer --key alice
```

**Note: The `init` command is optional. If the node is not initialised, it will be initialised with the default configuration.**

Here are the list of basic flags for the `gossamer` command:

```
--basepath: The working directory for the node.
--base-path: The working directory for the node.
--chain: The chain spec to initialise the node with. Supported chains are `polkadot`, `kusama`, `westend`, `westend-dev` and `westend_local`. It also accepts the chain-spec json path.
--key: The keypair to use for the node.
--name: The name of the node.
Expand Down
12 changes: 5 additions & 7 deletions cmd/gossamer/commands/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ var AccountCmd = &cobra.Command{
Use: "account",
Short: "Create and manage node keystore accounts",
Long: `The account command is used to manage the gossamer keystore.
Examples:
Examples:
To generate a new sr25519 account:
gossamer account generate --keystore-path=path/to/location --scheme=sr25519
To generate a new ed25519 account:
gossamer account generate --ed25519
To generate a new secp256k1 account:
To generate a new ed25519 account:
gossamer account generate --keystore-path=path/to/location --scheme=ed25519
To generate a new secp256k1 account:
gossamer account generate --keystore-path=path/to/location --scheme secp256k1
To import a keystore file:
To import a keystore file:
gossamer account import --keystore-path=path/to/location --keystore-file=keystore.json
To import a raw key:
gossamer account import-raw --keystore-path=path/to/location --keystore-file=keystore.json
Expand Down
19 changes: 17 additions & 2 deletions cmd/gossamer/commands/import_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ import (
"fmt"

"github.com/ChainSafe/gossamer/dot"
"github.com/ChainSafe/gossamer/lib/trie"
"github.com/ChainSafe/gossamer/lib/utils"
"github.com/spf13/cobra"
)

func init() {
ImportStateCmd.Flags().String("chain", "", "Chain id used to load default configuration for specified chain")
ImportStateCmd.Flags().String("state-file", "", "Path to JSON file consisting of key-value pairs")
ImportStateCmd.Flags().Uint32("state-version",
uint32(trie.DefaultStateVersion),
"State version to use when importing state",
)
ImportStateCmd.Flags().String("header-file", "", "Path to JSON file of block header corresponding to the given state")
ImportStateCmd.Flags().Uint64("first-slot", 0, "The first BABE slot of the network")
}
Expand All @@ -26,7 +31,8 @@ var ImportStateCmd = &cobra.Command{
in the form of key-value pairs to be imported.
Input can be generated by using the RPC function state_getPairs.
Example:
gossamer import-state --state-file state.json --header-file header.json --first-slot <first slot of network>`,
gossamer import-state --state-file state.json --state-version 1 --header-file header.json
--first-slot <first slot of network>`,
RunE: func(cmd *cobra.Command, args []string) error {
return execImportState(cmd)
},
Expand Down Expand Up @@ -54,6 +60,15 @@ func execImportState(cmd *cobra.Command) error {
return fmt.Errorf("state-file must be specified")
}

stateVersion, err := cmd.Flags().GetUint32("state-version")
if err != nil {
return fmt.Errorf("failed to get state-version: %s", err)
}
stateTrieVersion, err := trie.ParseVersion(stateVersion)
if err != nil {
return fmt.Errorf("invalid state version")
}

headerFile, err := cmd.Flags().GetString("header-file")
if err != nil {
return fmt.Errorf("failed to get header-file: %s", err)
Expand All @@ -64,5 +79,5 @@ func execImportState(cmd *cobra.Command) error {

basePath = utils.ExpandDir(basePath)

return dot.ImportState(basePath, stateFile, headerFile, firstSlot)
return dot.ImportState(basePath, stateFile, headerFile, stateTrieVersion, firstSlot)
}
57 changes: 57 additions & 0 deletions cmd/gossamer/commands/import_state_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright 2023 ChainSafe Systems (ON)
// SPDX-License-Identifier: LGPL-3.0-only

package commands

import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestImportStateMissingStateFile(t *testing.T) {
rootCmd, err := NewRootCommand()
require.NoError(t, err)
rootCmd.AddCommand(ImportStateCmd)

rootCmd.SetArgs([]string{ImportStateCmd.Name()})
err = rootCmd.Execute()
assert.ErrorContains(t, err, "state-file must be specified")
}

func TestImportStateInvalidFirstSlot(t *testing.T) {
rootCmd, err := NewRootCommand()
require.NoError(t, err)
rootCmd.AddCommand(ImportStateCmd)

rootCmd.SetArgs([]string{ImportStateCmd.Name(), "--first-slot", "wrong"})
err = rootCmd.Execute()
assert.ErrorContains(t, err, "invalid argument \"wrong\"")
}

func TestImportStateEmptyHeaderFile(t *testing.T) {
rootCmd, err := NewRootCommand()
require.NoError(t, err)
rootCmd.AddCommand(ImportStateCmd)

rootCmd.SetArgs([]string{ImportStateCmd.Name(),
"--state-file", "test",
"--header-file", "",
})
err = rootCmd.Execute()
assert.ErrorContains(t, err, "header-file must be specified")
}

func TestImportStateErrorImportingState(t *testing.T) {
rootCmd, err := NewRootCommand()
require.NoError(t, err)
rootCmd.AddCommand(ImportStateCmd)

rootCmd.SetArgs([]string{ImportStateCmd.Name(),
"--state-file", "test",
"--header-file", "test",
})
err = rootCmd.Execute()
assert.ErrorContains(t, err, "no such file or directory")
}
Loading

0 comments on commit 71cbfb2

Please sign in to comment.