Skip to content

Commit

Permalink
Merge branch 'development' into eclesio/remove-unused-code
Browse files Browse the repository at this point in the history
  • Loading branch information
EclesioMeloJunior committed Jul 18, 2022
2 parents 0e04437 + 055e5c3 commit 3574434
Show file tree
Hide file tree
Showing 249 changed files with 20,199 additions and 10,326 deletions.
33 changes: 0 additions & 33 deletions .github/workflows/docker-stable.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
restore-keys: ${{ runner.os }}-go-mod

- name: Fuzz trie
run: go test -fuzz=Fuzz_Trie_PutAndGet -fuzztime=5m github.com/ChainSafe/gossamer/lib/trie
run: go test -run Fuzz_Trie_PutAndGet -fuzz=Fuzz_Trie_PutAndGet -fuzztime=5m github.com/ChainSafe/gossamer/lib/trie
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ jobs:
restore-keys: ${{ runner.os }}-go-mod

- name: Run integration tests
run: go test -timeout=30m -tags integration ${{ matrix.packages }}
run: go test -timeout=45m -tags integration ${{ matrix.packages }}
2 changes: 1 addition & 1 deletion .github/workflows/mocks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
stable: true
check-latest: true

- run: go install github.com/vektra/mockery/v2@v2.10
- run: go install github.com/vektra/mockery/v2@v2.14

- run: go install github.com/golang/mock/[email protected]

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 @@ -67,7 +67,7 @@ jobs:
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Run unit tests
run: go test -short -coverprofile=coverage.out -covermode=atomic -timeout=30m ./...
run: go test -short -coverprofile=coverage.out -covermode=atomic -timeout=45m ./...

- name: Test State - Race
run: make test-state-race
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ test_data
trie_putandget_failed_test_data_*
tmp

tests/utils/config*
tests/utils/genesis*

# node_modules used by polkadot.js/api tests
tests/polkadotjs_test/node_modules
!tests/polkadotjs_test/test/*.wasm
6 changes: 1 addition & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ linters:
- nolintlint
- revive
- staticcheck
- tparallel
- unconvert
- unparam
- varcheck
Expand Down Expand Up @@ -93,11 +94,6 @@ issues:
- revive
text: "package comment should be of the form"

- linters:
- revive
path: lib/runtime/life/
text: "don't use underscores in Go names;"

- linters:
- nolintlint
source: "^//nolint:revive"
Expand Down
5 changes: 0 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ RUN wget -qO- https://deb.nodesource.com/setup_14.x | bash - && \
RUN wget -O /usr/local/bin/subkey https://chainbridge.ams3.digitaloceanspaces.com/subkey-v2.0.0 && \
chmod +x /usr/local/bin/subkey

# Polkadot JS dependencies
WORKDIR /go/src/github.com/ChainSafe/gossamer/tests/polkadotjs_test
COPY tests/polkadotjs_test/package.json tests/polkadotjs_test/package-lock.json ./
RUN npm install

WORKDIR /go/src/github.com/ChainSafe/gossamer

# Go dependencies
Expand Down
16 changes: 5 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,26 @@ test:
git lfs pull
go test -short -coverprofile c.out ./... -timeout=30m

## it-stable: Runs Integration Tests Stable mode
it-stable:
@echo " > \033[32mRunning Integration Tests...\033[0m "
@chmod +x scripts/integration-test-all.sh
./scripts/integration-test-all.sh -q 3 -s 10

## it-stress: Runs Integration Tests stress mode
it-stress: build
@echo " > \033[32mRunning stress tests...\033[0m "
HOSTNAME=0.0.0.0 MODE=stress go test ./tests/stress/... -timeout=15m -v -short -run TestSync_
MODE=stress go test ./tests/stress/... -timeout=15m -v -short -run TestSync_

it-grandpa: build
@echo " > \033[32mRunning GRANDPA stress tests...\033[0m "
HOSTNAME=0.0.0.0 MODE=stress go test ./tests/stress/... -timeout=12m -v -short -run TestStress_Grandpa_
MODE=stress go test ./tests/stress/... -timeout=12m -v -short -run TestStress_Grandpa_

it-rpc: build
@echo " > \033[32mRunning Integration Tests RPC Specs mode...\033[0m "
HOSTNAME=0.0.0.0 MODE=rpc go test ./tests/rpc/... -timeout=10m -v
MODE=rpc go test ./tests/rpc/... -timeout=10m -v

it-sync: build
@echo " > \033[32mRunning Integration Tests sync mode...\033[0m "
HOSTNAME=0.0.0.0 MODE=sync go test ./tests/sync/... -timeout=5m -v
MODE=sync go test ./tests/sync/... -timeout=5m -v

it-polkadotjs: build
@echo " > \033[32mRunning Integration Tests polkadot.js/api mode...\033[0m "
HOSTNAME=0.0.0.0 MODE=polkadot go test ./tests/polkadotjs_test/... -timeout=5m -v
MODE=polkadot go test ./tests/polkadotjs_test/... -timeout=5m -v

## test: Runs `go test -race` on project test files.
test-state-race:
Expand Down
3 changes: 0 additions & 3 deletions cmd/gossamer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/ChainSafe/gossamer/internal/log"
"github.com/ChainSafe/gossamer/lib/common"
"github.com/ChainSafe/gossamer/lib/genesis"
"github.com/ChainSafe/gossamer/lib/runtime/life"
"github.com/ChainSafe/gossamer/lib/runtime/wasmer"
"github.com/ChainSafe/gossamer/lib/utils"
"github.com/urfave/cli"
Expand Down Expand Up @@ -622,8 +621,6 @@ func setDotCoreConfig(ctx *cli.Context, tomlCfg ctoml.CoreConfig, cfg *dot.CoreC
switch tomlCfg.WasmInterpreter {
case wasmer.Name:
cfg.WasmInterpreter = wasmer.Name
case life.Name:
cfg.WasmInterpreter = life.Name
case "":
cfg.WasmInterpreter = gssmr.DefaultWasmInterpreter
default:
Expand Down
5 changes: 2 additions & 3 deletions cmd/gossamer/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package main

import (
"context"
"encoding/hex"
"encoding/json"
"errors"
Expand Down Expand Up @@ -941,9 +942,7 @@ func TestGlobalNodeName_WhenNodeAlreadyHasStoredName(t *testing.T) {
cfg := newTestConfig(t)
cfg.Global.Name = globalName

runtimeFilePath := filepath.Join(t.TempDir(), "runtime")
_, testRuntimeURL := runtime.GetRuntimeVars(runtime.NODE_RUNTIME)
err := runtime.GetRuntimeBlob(runtimeFilePath, testRuntimeURL)
runtimeFilePath, err := runtime.GetRuntime(context.Background(), runtime.NODE_RUNTIME)
require.NoError(t, err)
runtimeData, err := os.ReadFile(runtimeFilePath)
require.NoError(t, err)
Expand Down
1 change: 0 additions & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ coverage:
- "dot/network"
- "dot/peerset"
- "dot/sync"
- "lib/runtime/life"
- "lib/grandpa"
- "lib/blocktree"
50pc:
Expand Down
17 changes: 16 additions & 1 deletion devnet/cmd/scale-down-ecs-service/mocks/ecsapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/docs/getting-started/resources/general-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Gossamer is an implementation of the Polkadot Host in Go. To learn more about Go

- To understand the vision behind Gossamer and how it fits into the Polkadot ecosystem, please read this blog post: <a target="_blank" rel="noopener noreferrer" href="https://medium.com/chainsafe-systems/the-future-of-polkadot-in-golang-gossamer-3345f0d6143d">"The Future of Polkadot in Golang: Gossamer"</a>.

- For a more technical explanation, we recommend watching this <a target="_blank" rel="noopener noreferrer" href="https://medium.com/chainsafe-systems/the-future-of-polkadot-in-golang-gossamer-3345f0d6143d">video</a>.
- For a more technical explanation, we recommend watching this <a target="_blank" rel="noopener noreferrer" href="https://youtu.be/ZIS0eLtBA9E">video</a>.

### Additional Resources

Expand Down
7 changes: 0 additions & 7 deletions docs/docs/testing-and-debugging/test-suite.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ Proceed to open `cover.html` in your preferred browser.
### Gossamer Integration Tests

Running Gossamer's integration tests with the below commands will build a Gossamer binary, install required dependencies, and then proceeds to run the provided set of tests. Integration tests can also be run within a docker container.


To run Gossamer integration tests in **stable** mode run the following command:

```
make it-stable
```

To run Gossamer integration tests in **stress** mode run the following command:

Expand Down
4 changes: 2 additions & 2 deletions dot/core/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"github.com/ChainSafe/gossamer/lib/runtime/wasmer"
"github.com/ChainSafe/gossamer/lib/services"
"github.com/ChainSafe/gossamer/lib/transaction"
cscale "github.com/centrifuge/go-substrate-rpc-client/v3/scale"
ctypes "github.com/centrifuge/go-substrate-rpc-client/v3/types"
cscale "github.com/centrifuge/go-substrate-rpc-client/v4/scale"
ctypes "github.com/centrifuge/go-substrate-rpc-client/v4/types"
)

var (
Expand Down
24 changes: 8 additions & 16 deletions dot/core/service_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package core

import (
"context"
"fmt"
"math/big"
"os"
Expand Down Expand Up @@ -134,20 +135,6 @@ func generateTestValidRemarkTxns(t *testing.T, pubKey []byte, accInfo types.Acco
return extBytes, rt
}

func TestMain(m *testing.M) {
wasmFilePaths, err := runtime.GenerateRuntimeWasmFile()
if err != nil {
log.Errorf("failed to generate runtime wasm file: %s", err)
os.Exit(1)
}

// Start all tests
code := m.Run()

runtime.RemoveFiles(wasmFilePaths)
os.Exit(code)
}

func TestStartService(t *testing.T) {
s := NewTestService(t, nil)

Expand Down Expand Up @@ -208,6 +195,7 @@ func TestAnnounceBlock(t *testing.T) {
}

func TestService_InsertKey(t *testing.T) {
t.Parallel()
ks := keystore.NewGlobalKeystore()

cfg := &Config{
Expand Down Expand Up @@ -695,7 +683,9 @@ func TestService_HandleRuntimeChanges(t *testing.T) {
func TestService_HandleCodeSubstitutes(t *testing.T) {
s := NewTestService(t, nil)

testRuntime, err := os.ReadFile(runtime.POLKADOT_RUNTIME_FP)
runtimeFilepath, err := runtime.GetRuntime(context.Background(), runtime.POLKADOT_RUNTIME)
require.NoError(t, err)
testRuntime, err := os.ReadFile(runtimeFilepath)
require.NoError(t, err)

// hash for known test code substitution
Expand Down Expand Up @@ -745,7 +735,9 @@ func TestService_HandleRuntimeChangesAfterCodeSubstitutes(t *testing.T) {
require.NoError(t, err)
require.Equal(t, codeHashBefore, parentRt.GetCodeHash()) // codeHash should remain unchanged after code substitute

testRuntime, err := os.ReadFile(runtime.POLKADOT_RUNTIME_FP)
runtimeFilepath, err := runtime.GetRuntime(context.Background(), runtime.POLKADOT_RUNTIME)
require.NoError(t, err)
testRuntime, err := os.ReadFile(runtimeFilepath)
require.NoError(t, err)

ts, err = s.storageState.TrieState(nil)
Expand Down
Loading

0 comments on commit 3574434

Please sign in to comment.