Skip to content

Commit

Permalink
fix(ci): embed old gssmr and dev runtimes for integration tests (#…
Browse files Browse the repository at this point in the history
…2671)

* restore old chain as gssmr-v3substrate, add genesis utils, update TestNodeRuntime_ValidateTransaction

* upgrade chaindb

* add todos to create new issues, test against old runtime

* use v3substrate runtime for dot/core integration tests

* lib/babe integration tests use old dev runtime

* fix lint

* fix grandpa stress tests

* use old dev chain for stress tests

* update rpc tests

* revise polkadotjstests to old dev runtime

* Update lib/genesis/test_utils.go

Co-authored-by: Quentin McGaw <[email protected]>

* Update lib/utils/utils.go

Co-authored-by: Quentin McGaw <[email protected]>

* Update lib/utils/utils.go

Co-authored-by: Quentin McGaw <[email protected]>

* Update lib/utils/utils.go

Co-authored-by: Quentin McGaw <[email protected]>

* Update lib/utils/utils.go

Co-authored-by: Quentin McGaw <[email protected]>

* Update lib/utils/utils.go

Co-authored-by: Quentin McGaw <[email protected]>

* remove config and go code from old runtimes

* undo new require in go.mod

Co-authored-by: Quentin McGaw <[email protected]>
  • Loading branch information
timwu20 and qdm12 committed Aug 9, 2022
1 parent 49dacc3 commit acea723
Show file tree
Hide file tree
Showing 21 changed files with 876 additions and 26 deletions.
316 changes: 316 additions & 0 deletions chain/dev-v3substrate/genesis-spec.json

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions chain/dev-v3substrate/genesis.json

Large diffs are not rendered by default.

346 changes: 346 additions & 0 deletions chain/gssmr-v3substrate/genesis-spec.json

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions chain/gssmr-v3substrate/genesis.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions dot/core/service_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"fmt"
"math/big"
"os"
"path/filepath"
"testing"
"time"

Expand Down Expand Up @@ -52,7 +51,7 @@ func balanceKey(t *testing.T, pub []byte) (bKey []byte) {

func generateTestValidRemarkTxns(t *testing.T, pubKey []byte, accInfo types.AccountInfo) ([]byte, runtime.Instance) {
t.Helper()
projectRootPath := filepath.Join(utils.GetProjectRootPathTest(t), "chain/gssmr/genesis.json")
projectRootPath := utils.GetGssmrV3SubstrateGenesisRawPathTest(t)
gen, err := genesis.NewGenesisFromJSONRaw(projectRootPath)
require.NoError(t, err)

Expand Down Expand Up @@ -409,6 +408,7 @@ func TestHandleChainReorg_WithReorg_Transactions(t *testing.T) {
require.Equal(t, transaction.NewValidTransaction(tx, validity), pending[0])
}

// TODO: add test against latest gssmr runtime
func TestMaintainTransactionPool_EmptyBlock(t *testing.T) {
accountInfo := types.AccountInfo{
Nonce: 0,
Expand Down Expand Up @@ -465,6 +465,7 @@ func TestMaintainTransactionPool_EmptyBlock(t *testing.T) {
require.Nil(t, head)
}

// TODO: add test against latest gssmr runtime
func TestMaintainTransactionPool_BlockWithExtrinsics(t *testing.T) {
accountInfo := types.AccountInfo{
Nonce: 0,
Expand Down
4 changes: 4 additions & 0 deletions dot/sync/chain_processor_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/stretchr/testify/require"
)

// TODO: add test against latest gssmr runtime
func TestChainProcessor_HandleBlockResponse_ValidChain(t *testing.T) {
syncer := newTestSyncer(t)
responder := newTestSyncer(t)
Expand Down Expand Up @@ -79,6 +80,7 @@ func TestChainProcessor_HandleBlockResponse_ValidChain(t *testing.T) {
}
}

// TODO: add test against latest gssmr runtime
func TestChainProcessor_HandleBlockResponse_MissingBlocks(t *testing.T) {
syncer := newTestSyncer(t)

Expand Down Expand Up @@ -154,6 +156,7 @@ func TestChainProcessor_HandleBlockResponse_NoBlockData(t *testing.T) {
require.Equal(t, ErrNilBlockData, err)
}

// TODO: add test against latest gssmr runtime
func TestChainProcessor_HandleBlockResponse_BlockData(t *testing.T) {
syncer := newTestSyncer(t)

Expand Down Expand Up @@ -183,6 +186,7 @@ func TestChainProcessor_HandleBlockResponse_BlockData(t *testing.T) {
}
}

// TODO: add test against latest gssmr runtime
func TestChainProcessor_ExecuteBlock(t *testing.T) {
syncer := newTestSyncer(t)

Expand Down
2 changes: 1 addition & 1 deletion dot/sync/syncer_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func newTestSyncer(t *testing.T) *Service {
}

func newTestGenesisWithTrieAndHeader(t *testing.T) (*genesis.Genesis, *trie.Trie, *types.Header) {
fp := utils.GetGssmrGenesisRawPathTest(t)
fp := utils.GetGssmrV3SubstrateGenesisRawPathTest(t)
gen, err := genesis.NewGenesisFromJSONRaw(fp)
require.NoError(t, err)

Expand Down
2 changes: 1 addition & 1 deletion dot/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
func newTestGenesisFile(t *testing.T, cfg *Config) (filename string) {
t.Helper()

fp := utils.GetGssmrGenesisRawPathTest(t)
fp := utils.GetGssmrV3SubstrateGenesisPathTest(t)
gssmrGen, err := genesis.NewGenesisFromJSON(fp, 0)
require.NoError(t, err)

Expand Down
12 changes: 7 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module github.com/ChainSafe/gossamer

require (
github.com/ChainSafe/chaindb v0.1.5-0.20220322154826-c0d431995732
github.com/ChainSafe/chaindb v0.1.5-0.20220708005902-df45dbc8e840
github.com/ChainSafe/go-schnorrkel v1.0.1-0.20220711122024-027d287d27bf
github.com/OneOfOne/xxhash v1.2.8
github.com/breml/rootcerts v0.2.6
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
github.com/chyeh/pubip v0.0.0-20170203095919-b7e679cf541c
github.com/cosmos/go-bip39 v1.0.0
github.com/dgraph-io/badger/v2 v2.2007.4
github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de
github.com/dgraph-io/ristretto v0.1.0
github.com/disiqueira/gotree v1.0.0
github.com/docker/docker v20.10.17+incompatible
github.com/ethereum/go-ethereum v1.10.21
Expand Down Expand Up @@ -69,8 +69,7 @@ require (
github.com/decred/base58 v1.0.3 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/elastic/gosigar v0.12.0 // indirect
github.com/flynn/noise v1.0.0 // indirect
Expand All @@ -83,6 +82,7 @@ require (
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
github.com/godbus/dbus/v5 v5.0.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.0.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
Expand Down Expand Up @@ -125,7 +125,7 @@ require (
github.com/marten-seemann/qtls-go1-17 v0.1.1 // indirect
github.com/marten-seemann/qtls-go1-18 v0.1.1 // indirect
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/mattn/go-colorable v0.1.9 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/miekg/dns v1.1.43 // indirect
Expand Down Expand Up @@ -189,4 +189,6 @@ require (
lukechampine.com/blake3 v1.1.7 // indirect
)

require github.com/docker/go-units v0.4.0 // indirect

go 1.18
16 changes: 11 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 h1:cTp8I5+VIo
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/ChainSafe/chaindb v0.1.5-0.20220322154826-c0d431995732 h1:dOdDfWtgfucQHXder8eSItN03JgQzY1V0BiKJgNERnE=
github.com/ChainSafe/chaindb v0.1.5-0.20220322154826-c0d431995732/go.mod h1:P01m9E6xj6Mps1rtf7SurEX9oOcy1jYEyccZQAEw9+4=
github.com/ChainSafe/chaindb v0.1.5-0.20220708005902-df45dbc8e840 h1:qdwel/UNcN1PmrzZG4iTf8/cKAVCas+/RdXq/5NOxps=
github.com/ChainSafe/chaindb v0.1.5-0.20220708005902-df45dbc8e840/go.mod h1:P01m9E6xj6Mps1rtf7SurEX9oOcy1jYEyccZQAEw9+4=
github.com/ChainSafe/go-schnorrkel v1.0.1-0.20220711122024-027d287d27bf h1:S195ZBRu20VgXC1i5nHTR6b4BbTQaMCDuq6tzFQN5zU=
github.com/ChainSafe/go-schnorrkel v1.0.1-0.20220711122024-027d287d27bf/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4=
github.com/ChainSafe/log15 v1.0.0 h1:vRDVtWtVwIH5uSCBvgTTZh6FA58UBJ6+QiiypaZfBf8=
Expand Down Expand Up @@ -188,11 +188,13 @@ github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdw
github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk=
github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
github.com/dgraph-io/ristretto v0.0.2/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA=
github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
github.com/dgraph-io/ristretto v0.1.0 h1:Jv3CGQHp9OjuMBSne1485aDpUkTKEcUqF+jm/LuerPI=
github.com/dgraph-io/ristretto v0.1.0/go.mod h1:fux0lOrBhrVCJd3lcTHsIJhq1T2rokOu6v9Vcb3Q9ug=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA=
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y=
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/disiqueira/gotree v1.0.0 h1:en5wk87n7/Jyk6gVME3cx3xN9KmUCstJ1IjHr4Se4To=
github.com/disiqueira/gotree v1.0.0/go.mod h1:7CwL+VWsWAU95DovkdRZAtA7YbtHwGk+tLV/kNi8niU=
github.com/docker/docker v20.10.17+incompatible h1:JYCuMrWaVNophQTOrMMoSwudOVEfcegoZZrleKc1xwE=
Expand Down Expand Up @@ -279,6 +281,8 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ=
github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4=
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
Expand Down Expand Up @@ -740,8 +744,9 @@ github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
Expand Down Expand Up @@ -1374,6 +1379,7 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
4 changes: 4 additions & 0 deletions lib/babe/build_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func createTestBlock(t *testing.T, babeService *Service, parent *types.Header,
return block
}

// TODO: add test against latest dev runtime
func TestBuildBlock_ok(t *testing.T) {
ctrl := gomock.NewController(t)
telemetryMock := NewMockClient(ctrl)
Expand Down Expand Up @@ -139,6 +140,7 @@ func TestBuildBlock_ok(t *testing.T) {
require.Equal(t, 1, len(extsBytes))
}

// TODO: add test against latest dev runtime
func TestApplyExtrinsic(t *testing.T) {
ctrl := gomock.NewController(t)
telemetryMock := NewMockClient(ctrl)
Expand Down Expand Up @@ -233,6 +235,7 @@ func TestApplyExtrinsic(t *testing.T) {
require.NoError(t, err)
}

// TODO: add test against latest dev runtime
func TestBuildAndApplyExtrinsic(t *testing.T) {
ctrl := gomock.NewController(t)
telemetryMock := NewMockClient(ctrl)
Expand Down Expand Up @@ -406,6 +409,7 @@ func TestDecodeExtrinsicBody(t *testing.T) {
require.True(t, contains)
}

// TODO: add test against latest dev runtime
func TestBuildBlockTimeMonitor(t *testing.T) {
metrics.Enabled = true
metrics.Unregister(buildBlockTimer)
Expand Down
9 changes: 9 additions & 0 deletions lib/babe/verify_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func newTestVerificationManager(t *testing.T, genCfg *types.BabeConfiguration) *
return vm
}

// TODO: add test against latest dev runtime
func TestVerificationManager_OnDisabled_InvalidIndex(t *testing.T) {
vm := newTestVerificationManager(t, nil)
babeService := createTestService(t, nil)
Expand All @@ -74,6 +75,7 @@ func TestVerificationManager_OnDisabled_InvalidIndex(t *testing.T) {
require.Equal(t, err, ErrInvalidBlockProducerIndex)
}

// TODO: add test against latest dev runtime
func TestVerificationManager_OnDisabled_NewDigest(t *testing.T) {
kp, err := sr25519.GenerateKeypair()
require.NoError(t, err)
Expand Down Expand Up @@ -111,6 +113,7 @@ func TestVerificationManager_OnDisabled_NewDigest(t *testing.T) {
require.NoError(t, err)
}

// TODO: add test against latest dev runtime
func TestVerificationManager_OnDisabled_DuplicateDigest(t *testing.T) {
kp, err := sr25519.GenerateKeypair()
require.NoError(t, err)
Expand Down Expand Up @@ -146,6 +149,7 @@ func TestVerificationManager_OnDisabled_DuplicateDigest(t *testing.T) {
require.Equal(t, ErrAuthorityAlreadyDisabled, err)
}

// TODO: add test against latest dev runtime
func TestVerificationManager_VerifyBlock_Ok(t *testing.T) {
babeService := createTestService(t, nil)
rt, err := babeService.blockState.GetRuntime(nil)
Expand All @@ -168,6 +172,7 @@ func TestVerificationManager_VerifyBlock_Ok(t *testing.T) {
require.NoError(t, err)
}

// TODO: add test against latest dev runtime
func TestVerificationManager_VerifyBlock_Secondary(t *testing.T) {
babeService := createTestService(t, nil)
rt, err := babeService.blockState.GetRuntime(nil)
Expand Down Expand Up @@ -276,6 +281,7 @@ func TestVerificationManager_VerifyBlock_MultipleEpochs(t *testing.T) {
require.NoError(t, err)
}

// TODO: add test against latest dev runtime
func TestVerificationManager_VerifyBlock_InvalidBlockOverThreshold(t *testing.T) {
babeService := createTestService(t, nil)
rt, err := babeService.blockState.GetRuntime(nil)
Expand All @@ -299,6 +305,7 @@ func TestVerificationManager_VerifyBlock_InvalidBlockOverThreshold(t *testing.T)
require.Equal(t, ErrVRFOutputOverThreshold, errors.Unwrap(err))
}

// TODO: add test against latest dev runtime
func TestVerificationManager_VerifyBlock_InvalidBlockAuthority(t *testing.T) {
babeService := createTestService(t, nil)
rt, err := babeService.blockState.GetRuntime(nil)
Expand Down Expand Up @@ -367,6 +374,7 @@ func TestVerifyPimarySlotWinner(t *testing.T) {
require.True(t, ok)
}

// TODO: add test against latest dev runtime
func TestVerifyAuthorshipRight(t *testing.T) {
babeService := createTestService(t, nil)
epochData, err := babeService.initiateEpoch(testEpochIndex)
Expand All @@ -386,6 +394,7 @@ func TestVerifyAuthorshipRight(t *testing.T) {
require.NoError(t, err)
}

// TODO: add test against latest dev runtime
func TestVerifyAuthorshipRight_Equivocation(t *testing.T) {
kp, err := sr25519.GenerateKeypair()
require.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions lib/genesis/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func CreateTestGenesisJSONFile(t *testing.T, fields Fields) (filename string) {

// NewTestGenesisWithTrieAndHeader generates genesis, genesis trie and genesis header
func NewTestGenesisWithTrieAndHeader(t *testing.T) (*Genesis, *trie.Trie, *types.Header) {
genesisPath := utils.GetGssmrGenesisRawPathTest(t)
genesisPath := utils.GetGssmrV3SubstrateGenesisRawPathTest(t)
gen, err := NewGenesisFromJSONRaw(genesisPath)
require.NoError(t, err)

Expand All @@ -87,7 +87,7 @@ func NewTestGenesisWithTrieAndHeader(t *testing.T) (*Genesis, *trie.Trie, *types

// NewDevGenesisWithTrieAndHeader generates test dev genesis, genesis trie and genesis header
func NewDevGenesisWithTrieAndHeader(t *testing.T) (*Genesis, *trie.Trie, *types.Header) {
genesisPath := utils.GetDevGenesisPath(t)
genesisPath := utils.GetDevV3SubstrateGenesisPath(t)

gen, err := NewGenesisFromJSONRaw(genesisPath)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion lib/runtime/wasmer/exports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func balanceKey(t *testing.T, pub []byte) []byte {
}

func TestNodeRuntime_ValidateTransaction(t *testing.T) {
genesisPath := utils.GetGssmrGenesisRawPathTest(t)
genesisPath := utils.GetGssmrV3SubstrateGenesisRawPathTest(t)
gen, err := genesis.NewGenesisFromJSONRaw(genesisPath)
require.NoError(t, err)

Expand Down
43 changes: 43 additions & 0 deletions lib/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,44 @@ func GetGssmrGenesisPathTest(t *testing.T) string {
return path
}

// GetGssmrV3SubstrateGenesisPathTest gets the v3 substrate gssmr genesis path
// and fails the test if it cannot find it.
func GetGssmrV3SubstrateGenesisPathTest(t *testing.T) string {
t.Helper()
path, err := GetGssmrV3SubstrateGenesisPath()
require.NoError(t, err)
return path
}

// GetGssmrV3SubstrateGenesisRawPathTest gets the v3 substrate gssmr raw genesis path
// and fails the test if it cannot find it.
func GetGssmrV3SubstrateGenesisRawPathTest(t *testing.T) string {
t.Helper()
path, err := GetGssmrV3SubstrateGenesisRawPath()
require.NoError(t, err)
return path
}

// GetGssmrV3SubstrateGenesisRawPath gets the v3 substrate gssmr raw genesis path
// and returns an error if it cannot find it.
func GetGssmrV3SubstrateGenesisRawPath() (path string, err error) {
rootPath, err := GetProjectRootPath()
if err != nil {
return "", err
}
return filepath.Join(rootPath, "./chain/gssmr-v3substrate/genesis.json"), nil
}

// GetDevGenesisPath gets the dev genesis path
func GetDevGenesisPath(t *testing.T) string {
return filepath.Join(GetProjectRootPathTest(t), "./chain/dev/genesis.json")
}

// GetDevV3SubstrateGenesisPath gets the v3 substrate dev genesis path
func GetDevV3SubstrateGenesisPath(t *testing.T) string {
return filepath.Join(GetProjectRootPathTest(t), "./chain/dev-v3substrate/genesis.json")
}

// GetDevGenesisSpecPathTest gets the dev genesis spec path
func GetDevGenesisSpecPathTest(t *testing.T) string {
return filepath.Join(GetProjectRootPathTest(t), "./chain/dev/genesis-spec.json")
Expand All @@ -196,6 +229,16 @@ func GetGssmrGenesisPath() (path string, err error) {
return filepath.Join(rootPath, "./chain/gssmr/genesis-spec.json"), nil
}

// GetGssmrV3SubstrateGenesisPath gets the v3 substrate gssmr genesis path
// and returns an error if it cannot find it.
func GetGssmrV3SubstrateGenesisPath() (path string, err error) {
rootPath, err := GetProjectRootPath()
if err != nil {
return "", err
}
return filepath.Join(rootPath, "./chain/gssmr-v3substrate/genesis-spec.json"), nil
}

// GetKusamaGenesisPath gets the Kusama genesis path
func GetKusamaGenesisPath(t *testing.T) string {
return filepath.Join(GetProjectRootPathTest(t), "./chain/kusama/genesis.json")
Expand Down
3 changes: 2 additions & 1 deletion tests/polkadotjs_test/start_polkadotjs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

var polkadotSuite = "polkadot"

// TODO: add test against latest dev runtime
func TestStartGossamerAndPolkadotAPI(t *testing.T) {
if utils.MODE != polkadotSuite {
t.Log("Going to skip polkadot.js/api suite tests")
Expand Down Expand Up @@ -46,7 +47,7 @@ func TestStartGossamerAndPolkadotAPI(t *testing.T) {
t.Log("starting gossamer for polkadot.js/api tests...")

tomlConfig := config.Default()
tomlConfig.Init.Genesis = libutils.GetDevGenesisSpecPathTest(t)
tomlConfig.Init.Genesis = libutils.GetDevV3SubstrateGenesisPath(t)
tomlConfig.Core.BABELead = true
tomlConfig.RPC.WS = true
tomlConfig.RPC.Unsafe = true
Expand Down
Loading

0 comments on commit acea723

Please sign in to comment.