Skip to content

Commit

Permalink
fix(lib/genesis): Update missing and incorrect fields in genesis file. (
Browse files Browse the repository at this point in the history
#1681)

* Add missing genesis fields.

* Fix failing tests.

* Address comments and fix failing tests.

* Add Staking ForceEra field in genesis.

* Improve test coverage.

* Fix linting issues.

* Address comments.

* Update dev and gossamer genesis file.
  • Loading branch information
arijitAD authored Aug 17, 2021
1 parent a5270cc commit 8207704
Show file tree
Hide file tree
Showing 14 changed files with 1,183 additions and 67 deletions.
214 changes: 208 additions & 6 deletions chain/dev/genesis-spec.json

Large diffs are not rendered by default.

47 changes: 34 additions & 13 deletions chain/dev/genesis.json

Large diffs are not rendered by default.

210 changes: 206 additions & 4 deletions chain/gssmr/genesis-spec.json

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion chain/gssmr/genesis.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cmd/gossamer/import_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func createGenesisWithRuntime(fp string) (string, error) {
return "", err
}

genesis.Genesis.Runtime["system"]["code"] = fmt.Sprintf("0x%x", runtime)
genesis.Genesis.Runtime["System"]["code"] = fmt.Sprintf("0x%x", runtime)
bz, err := json.MarshalIndent(genesis, "", "\t")
if err != nil {
return "", err
Expand Down
2 changes: 1 addition & 1 deletion cmd/gossamer/import_runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ func TestCreateGenesisWithRuntime(t *testing.T) {
g := new(genesis.Genesis)
err = json.Unmarshal([]byte(out), g)
require.NoError(t, err)
require.Equal(t, testHex, g.Genesis.Runtime["system"]["code"].(string))
require.Equal(t, testHex, g.Genesis.Runtime["System"]["code"].(string))
}
4 changes: 4 additions & 0 deletions dot/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

"github.com/ChainSafe/gossamer/dot/types"
"github.com/ChainSafe/gossamer/lib/common"
"github.com/ChainSafe/gossamer/lib/utils"

"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -99,6 +100,9 @@ func TestImportState(t *testing.T) {

genFile := NewTestGenesisRawFile(t, cfg)
require.NotNil(t, genFile)

defer utils.RemoveTestDir(t)

cfg.Init.Genesis = genFile.Name()

cfg.Global.BasePath = basepath
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module github.com/ChainSafe/gossamer

require (
github.com/BurntSushi/toml v0.4.1 // indirect
github.com/ChainSafe/chaindb v0.1.5-0.20210608140454-9606fe8c3985
github.com/ChainSafe/go-schnorrkel v0.0.0-20210318173838-ccb5cd955283
github.com/ChainSafe/log15 v1.0.0
Expand Down Expand Up @@ -50,9 +51,9 @@ require (
github.com/wasmerio/go-ext-wasm v0.3.2-0.20200326095750-0a32be6068ec
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 // indirect
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 // indirect
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
golang.org/x/tools v0.1.4 // indirect
golang.org/x/tools v0.1.5 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/protobuf v1.26.0-rc.1
honnef.co/go/tools v0.2.0 // indirect
Expand Down
11 changes: 6 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxB
github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM=
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=
github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/ChainSafe/chaindb v0.1.5-0.20210608140454-9606fe8c3985 h1:jyFsOjzTMoRwNvmW/OORZpffmItkoLvsbxB8koHX4ns=
github.com/ChainSafe/chaindb v0.1.5-0.20210608140454-9606fe8c3985/go.mod h1:P01m9E6xj6Mps1rtf7SurEX9oOcy1jYEyccZQAEw9+4=
Expand Down Expand Up @@ -1265,8 +1266,8 @@ golang.org/x/sys v0.0.0-20210415045647-66c3f260301c/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210426080607-c94f62235c83/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q=
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 h1:siQdpVirKtzPhKl3lZWozZraCFObP8S1v6PRp0bLrtU=
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand Down Expand Up @@ -1323,8 +1324,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
Loading

0 comments on commit 8207704

Please sign in to comment.