Skip to content

Commit 8207704

Browse files
authored
fix(lib/genesis): Update missing and incorrect fields in genesis file. (ChainSafe#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.
1 parent a5270cc commit 8207704

File tree

14 files changed

+1183
-67
lines changed

14 files changed

+1183
-67
lines changed

chain/dev/genesis-spec.json

Lines changed: 208 additions & 6 deletions
Large diffs are not rendered by default.

chain/dev/genesis.json

Lines changed: 34 additions & 13 deletions
Large diffs are not rendered by default.

chain/gssmr/genesis-spec.json

Lines changed: 206 additions & 4 deletions
Large diffs are not rendered by default.

chain/gssmr/genesis.json

Lines changed: 21 additions & 1 deletion
Large diffs are not rendered by default.

cmd/gossamer/import_runtime.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func createGenesisWithRuntime(fp string) (string, error) {
3838
return "", err
3939
}
4040

41-
genesis.Genesis.Runtime["system"]["code"] = fmt.Sprintf("0x%x", runtime)
41+
genesis.Genesis.Runtime["System"]["code"] = fmt.Sprintf("0x%x", runtime)
4242
bz, err := json.MarshalIndent(genesis, "", "\t")
4343
if err != nil {
4444
return "", err

cmd/gossamer/import_runtime_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ func TestCreateGenesisWithRuntime(t *testing.T) {
4646
g := new(genesis.Genesis)
4747
err = json.Unmarshal([]byte(out), g)
4848
require.NoError(t, err)
49-
require.Equal(t, testHex, g.Genesis.Runtime["system"]["code"].(string))
49+
require.Equal(t, testHex, g.Genesis.Runtime["System"]["code"].(string))
5050
}

dot/import_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525

2626
"github.com/ChainSafe/gossamer/dot/types"
2727
"github.com/ChainSafe/gossamer/lib/common"
28+
"github.com/ChainSafe/gossamer/lib/utils"
2829

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

100101
genFile := NewTestGenesisRawFile(t, cfg)
101102
require.NotNil(t, genFile)
103+
104+
defer utils.RemoveTestDir(t)
105+
102106
cfg.Init.Genesis = genFile.Name()
103107

104108
cfg.Global.BasePath = basepath

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module github.com/ChainSafe/gossamer
22

33
require (
4+
github.com/BurntSushi/toml v0.4.1 // indirect
45
github.com/ChainSafe/chaindb v0.1.5-0.20210608140454-9606fe8c3985
56
github.com/ChainSafe/go-schnorrkel v0.0.0-20210318173838-ccb5cd955283
67
github.com/ChainSafe/log15 v1.0.0
@@ -50,9 +51,9 @@ require (
5051
github.com/wasmerio/go-ext-wasm v0.3.2-0.20200326095750-0a32be6068ec
5152
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
5253
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
53-
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 // indirect
54+
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 // indirect
5455
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
55-
golang.org/x/tools v0.1.4 // indirect
56+
golang.org/x/tools v0.1.5 // indirect
5657
google.golang.org/appengine v1.6.6 // indirect
5758
google.golang.org/protobuf v1.26.0-rc.1
5859
honnef.co/go/tools v0.2.0 // indirect

go.sum

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxB
4242
github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM=
4343
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
4444
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
45-
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
4645
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
46+
github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=
47+
github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
4748
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
4849
github.com/ChainSafe/chaindb v0.1.5-0.20210608140454-9606fe8c3985 h1:jyFsOjzTMoRwNvmW/OORZpffmItkoLvsbxB8koHX4ns=
4950
github.com/ChainSafe/chaindb v0.1.5-0.20210608140454-9606fe8c3985/go.mod h1:P01m9E6xj6Mps1rtf7SurEX9oOcy1jYEyccZQAEw9+4=
@@ -1265,8 +1266,8 @@ golang.org/x/sys v0.0.0-20210415045647-66c3f260301c/go.mod h1:h1NjWce9XRLGQEsW7w
12651266
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
12661267
golang.org/x/sys v0.0.0-20210426080607-c94f62235c83/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
12671268
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1268-
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q=
1269-
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1269+
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069 h1:siQdpVirKtzPhKl3lZWozZraCFObP8S1v6PRp0bLrtU=
1270+
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
12701271
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
12711272
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
12721273
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
@@ -1323,8 +1324,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
13231324
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
13241325
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
13251326
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
1326-
golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs=
1327-
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
1327+
golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
1328+
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
13281329
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
13291330
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
13301331
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

0 commit comments

Comments
 (0)