Skip to content

Commit

Permalink
chore(imports): fix imports post file moves
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Jan 5, 2022
1 parent f53dda9 commit c7294e6
Show file tree
Hide file tree
Showing 341 changed files with 1,171 additions and 1,157 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST/pull_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"fmt"
"os"

"github.com/ChainSafe/gossamer/lib/utils"
"github.com/ChainSafe/gossamer/internal/lib/utils"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ RUN wget -O /usr/local/bin/subkey https://chainbridge.ams3.digitaloceanspaces.co
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 ./
WORKDIR /go/src/github.com/ChainSafe/gossamer/internal/tests/polkadotjs_test
COPY internal/tests/polkadotjs_test/package.json internal/tests/polkadotjs_test/package-lock.json ./
RUN npm install

WORKDIR /go/src/github.com/ChainSafe/gossamer
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ format:

proto:
go install google.golang.org/protobuf/cmd/protoc-gen-go
protoc -I=./dot/network/proto --go_out=./dot/network/proto dot/network/proto/api.v1.proto
protoc -I=./internal/dot/network/proto --go_out=./internal/dot/network/proto dot/network/proto/api.v1.proto

## test: Runs `go test` on project test files.
test:
Expand All @@ -47,28 +47,28 @@ it-stable:
## 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_
HOSTNAME=0.0.0.0 MODE=stress go test ./internal/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_
HOSTNAME=0.0.0.0 MODE=stress go test ./internal/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
HOSTNAME=0.0.0.0 MODE=rpc go test ./internal/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
HOSTNAME=0.0.0.0 MODE=sync go test ./internal/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
HOSTNAME=0.0.0.0 MODE=polkadot go test ./internal/tests/polkadotjs_test/... -timeout=5m -v

## test: Runs `go test -race` on project test files.
test-state-race:
@echo " > \033[32mRunning race tests...\033[0m "
go test ./dot/state/... -short -race -timeout=5m
go test ./internal/dot/state/... -short -race -timeout=5m

## deps: Install missing dependencies. Runs `go mod download` internally.
deps:
Expand Down
40 changes: 20 additions & 20 deletions cmd/gossamer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This is the default Gossamer execution method, which invokes the `gossamerAction
blockchain client are [described below in the Client Components section](#client-components).

- `--basepath` - the path to the directory where Gossamer will store its data
- `--chain` - specifies the [chain configuration](../../chain) that the
- `--chain` - specifies the [chain configuration](../../internal/chain) that the
[Gossamer host node](https://chainsafe.github.io/gossamer/getting-started/overview/host-architecture/) should load
- `--key` - specifies a test keyring account to use (e.g. `--key=alice`)
- `--log` - supports levels `crit` (silent), `error`, `warn`, `info`, `debug`, and `trce` (detailed), default is `info`
Expand All @@ -39,7 +39,7 @@ This subcommand accepts a genesis configuration file and uses it to initialise t
The `account` subcommand provides the user with capabilities related to generating and using `ed25519`, `secp256k1`, and
`sr25519` [account keys](https://wiki.polkadot.network/docs/learn-keys), and managing the keys present in the
[Gossamer keystore](#keystore). The `accountAction` function is defined in [account.go](account.go); it is an interface
to the capabilities defined in the [`lib/crypto`](../../lib/crypto) and [`lib/keystore`](../../lib/keystore) packages.
to the capabilities defined in the [`lib/crypto`](../../internal/lib/crypto) and [`lib/keystore`](../../internal/lib/keystore) packages.
This subcommand provides capabilities that are similar to
[Parity's Subkey utility](https://docs.substrate.io/v3/tools/subkey).

Expand Down Expand Up @@ -68,7 +68,7 @@ in [`main.go`](main.go).

### Import State Subcommand

The `import-state` subcommand allows a user to seed [Gossamer storage](../../dot/state) with key-value pairs in the form
The `import-state` subcommand allows a user to seed [Gossamer storage](../../internal/dot/state) with key-value pairs in the form
of a JSON file. The input for this subcommand can be retrieved from
[the `state_getPairs` RPC endpoint](https://github.com/w3f/PSPs/blob/master/PSPs/drafts/psp-6.md#1114-state_getpairs).
The `importStateAction` function is defined in [`main.go`](main.go).
Expand All @@ -86,7 +86,7 @@ The `importStateAction` function is defined in [`main.go`](main.go).
The `export` subcommand transforms a genesis configuration and Gossamer state into a TOML configuration file. This
subcommand invokes the `exportAction` function defined in [`export.go`](export.go).

- `--config` - path to a TOML configuration file (e.g. those defined in [the `chain` directory](../../chain))
- `--config` - path to a TOML configuration file (e.g. those defined in [the `chain` directory](../../internal/chain))
- `--basepath` - path to the Gossamer data directory that defines the state to export

## Client Components
Expand All @@ -96,8 +96,8 @@ In its default method of execution, Gossamer orchestrates a number of modular se
a blockchain network. Alongside these services, Gossamer manages [a keystore](#keystore), [a runtime](#runtime), and
[monitoring utilities](#monitoring), all of which are described in greater detail below. The entry point to the Gossamer
blockchain client capabilities is the `gossamerAction` function that is defined in [main.go](main.go), which in turn
invokes the `NewNode` function in [dot/node.go](../../dot/node.go). `NewNode` calls into functions that are defined in
[dot/services.go](../../dot/services.go) and starts the services that power a Gossamer node.
invokes the `NewNode` function in [dot/node.go](../../internal/dot/node.go). `NewNode` calls into functions that are defined in
[dot/services.go](../../internal/dot/services.go) and starts the services that power a Gossamer node.

### Services & Capabilities

Expand All @@ -108,60 +108,60 @@ What follows is a list that describes the services and capabilities that inform
This service is a wrapper around an instance of [`chaindb`](https://github.com/ChainSafe/chaindb), a key-value database
that is built on top of [BadgerDB](https://github.com/dgraph-io/badger) from [Dgraph](https://dgraph.io/). The state
service provides storage capabilities for the other Gossamer services - each service is assigned a prefix that is added
to its storage keys. The state service is defined in [dot/state/service.go](../../dot/state/service.go).
to its storage keys. The state service is defined in [dot/state/service.go](../../internal/dot/state/service.go).

#### Network

The network service, which is defined in [dot/network/service.go](../../dot/network/service.go), is built on top of
The network service, which is defined in [dot/network/service.go](../../internal/dot/network/service.go), is built on top of
[the Go implementation](https://github.com/libp2p/go-libp2p) of [the `libp2p` protocol](https://libp2p.io/). This
service manages a `libp2p` "host", a peer-to-peer networking term for a network participant that is providing both
client _and_ server capabilities to a peer-to-peer network. Gossamer's network service manages the discovery of other
hosts as well as the connections with these hosts that allow Gossamer to communicate with its network peers.

#### Digest Handler

The digest handler ([dot/digest/digest.go](../../dot/digest/digest.go)) manages the verification of the
The digest handler ([dot/digest/digest.go](../../internal/dot/digest/digest.go)) manages the verification of the
[digests](https://docs.substrate.io/v3/getting-started/glossary/#digest) that are present in block headers.

#### Consensus

The BABE and GRANDPA services work together to provide Gossamer with its
[hybrid consensus](https://wiki.polkadot.network/docs/learn-consensus#hybrid-consensus) capabilities. The term "hybrid
consensus" refers to the fact that block _production_ is decoupled from block _finalisation_. Block production is
handled by the BABE service, which is defined in [lib/babe/babe.go](../../lib/babe/babe.go); block finalisation is
handled by the GRANDPA service, which is defined in [lib/grandpa/grandpa.go](../../lib/grandpa/grandpa.go).
handled by the BABE service, which is defined in [lib/babe/babe.go](../../internal/lib/babe/babe.go); block finalisation is
handled by the GRANDPA service, which is defined in [lib/grandpa/grandpa.go](../../internal/lib/grandpa/grandpa.go).

#### Sync

This service is concerned with keeping Gossamer in sync with a blockchain - it implements a "bootstrap" mode, to
download and verify blocks that are part of an existing chain's history, and a "tip-syncing" mode that manages the
multiple candidate forks that may exist at the head of a live chain. The sync service makes use of
[a block verification utility](../../lib/babe/verify.go) that implements BABE logic and is used by Gossamer to verify
[a block verification utility](../../internal/lib/babe/verify.go) that implements BABE logic and is used by Gossamer to verify
blocks that were produced by other other nodes in the network. The sync service is defined in
[dot/sync/syncer.go](../../dot/sync/syncer.go).
[dot/sync/syncer.go](../../internal/dot/sync/syncer.go).

#### RPC

This service, which is defined in [dot/rpc/service.go](../../dot/rpc/service.go), exposes a JSON-RPC interface that is
This service, which is defined in [dot/rpc/service.go](../../internal/dot/rpc/service.go), exposes a JSON-RPC interface that is
used by client applications like [Polkadot JS Apps UI](https://polkadot.js.org/apps/). The RPC interface is used to
interact with Gossamer to perform administrative tasks such as key management, as well as for interacting with the
runtime by querying storage and submitting transactions, and inspecting the chain's history.

#### System

The system service is defined in [dot/system/service.go](../../dot/system/service.go) and exposes metadata about the
The system service is defined in [dot/system/service.go](../../internal/dot/system/service.go) and exposes metadata about the
Gossamer system, such as the names and versions of the protocols that it implements.

#### Core

As its name implies, the core service ([dot/core/service.go](../../dot/core/service.go)) encapsulates a range of
As its name implies, the core service ([dot/core/service.go](../../internal/dot/core/service.go)) encapsulates a range of
capabilities that are central to the functioning of a Gossamer node. In general, the core service is a type of
dispatcher that coordinates interactions between services, e.g. writing blocks to the database, reloading
[the runtime](#runtime) when its definition is updated, etc.

### Keystore

The Gossamer keystore ([lib/keystore](../../lib/keystore)) is used for managing the public/private cryptographic key
The Gossamer keystore ([lib/keystore](../../internal/lib/keystore)) is used for managing the public/private cryptographic key
pairs that are used for participating in a blockchain network. Public keys are used to identify network participants;
network participants use their private keys to sign messages in order to authorise privileged actions. In addition to
informing the Gossamer blockchain client capabilities, the Gossamer keystore is accessible by way of the `account`
Expand All @@ -177,16 +177,16 @@ subcommand. The Gossamer keystore manages a number of key types, some of which a

In addition to the above-described services, Gossamer hosts a Wasm execution environment that is used to manage an
upgradeable blockchain runtime. The runtime must be implemented in Wasm, and must expose an interface that is specified
in [lib/runtime/interface.go](../../lib/runtime/interface.go). The runtime defines the blockchain's state transition
in [lib/runtime/interface.go](../../internal/lib/runtime/interface.go). The runtime defines the blockchain's state transition
function, and the various Gossamer services consume this capability in order to author blocks, as well as to verify
blocks that were authored by network peers. The runtime is dependent on a
[Wasm host interface](https://docs.wasmer.io/integrations/examples/host-functions), which Gossamer implements and is
defined in [lib/runtime/wasmer/exports.go](../../lib/runtime/wasmer/exports.go).
defined in [lib/runtime/wasmer/exports.go](../../internal/lib/runtime/wasmer/exports.go).

### Monitoring

Gossamer publishes telemetry data and also includes an embedded Prometheus server that reports metrics. The metrics
capabilities are defined in the [dot/metrics](../../dot/metrics) package and build on
capabilities are defined in the [dot/metrics](../../internal/dot/metrics) package and build on
[the metrics library that is included with Go Ethereum](https://github.com/ethereum/go-ethereum/blob/master/metrics/README.md).
The default port for Prometheus metrics is 9090, and Gossamer allows the user to configure this parameter with the
`--metrics-port` command-line parameter. The Gossamer telemetry server publishes telemetry data that is compatible with
Expand Down
6 changes: 3 additions & 3 deletions cmd/gossamer/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"fmt"
"strings"

"github.com/ChainSafe/gossamer/lib/crypto"
"github.com/ChainSafe/gossamer/lib/keystore"
"github.com/ChainSafe/gossamer/lib/utils"
"github.com/ChainSafe/gossamer/internal/lib/crypto"
"github.com/ChainSafe/gossamer/internal/lib/keystore"
"github.com/ChainSafe/gossamer/internal/lib/utils"

"github.com/urfave/cli"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/gossamer/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"fmt"
"testing"

"github.com/ChainSafe/gossamer/lib/utils"
"github.com/ChainSafe/gossamer/internal/lib/utils"

"github.com/stretchr/testify/require"
)
Expand Down
32 changes: 16 additions & 16 deletions cmd/gossamer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@ import (
"strings"
"time"

"github.com/ChainSafe/gossamer/chain/dev"
"github.com/ChainSafe/gossamer/chain/gssmr"
"github.com/ChainSafe/gossamer/dot"
ctoml "github.com/ChainSafe/gossamer/dot/config/toml"
"github.com/ChainSafe/gossamer/dot/state"
"github.com/ChainSafe/gossamer/dot/state/pruner"
"github.com/ChainSafe/gossamer/dot/types"
"github.com/ChainSafe/gossamer/internal/chain/dev"
"github.com/ChainSafe/gossamer/internal/chain/gssmr"
"github.com/ChainSafe/gossamer/internal/dot"
ctoml "github.com/ChainSafe/gossamer/internal/dot/config/toml"
"github.com/ChainSafe/gossamer/internal/dot/state"
"github.com/ChainSafe/gossamer/internal/dot/state/pruner"
"github.com/ChainSafe/gossamer/internal/dot/types"
"github.com/ChainSafe/gossamer/internal/lib/common"
"github.com/ChainSafe/gossamer/internal/lib/genesis"
"github.com/ChainSafe/gossamer/internal/lib/runtime/life"
"github.com/ChainSafe/gossamer/internal/lib/runtime/wasmer"
"github.com/ChainSafe/gossamer/internal/lib/utils"
"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"
)

var (
// DefaultCfg is the default configuration for the node.
DefaultCfg = dot.GssmrConfig
defaultGssmrConfigPath = "./chain/gssmr/config.toml"
defaultKusamaConfigPath = "./chain/kusama/config.toml"
defaultPolkadotConfigPath = "./chain/polkadot/config.toml"
defaultDevConfigPath = "./chain/dev/config.toml"
defaultGssmrConfigPath = "./internal/chain/gssmr/config.toml"
defaultKusamaConfigPath = "./internal/chain/kusama/config.toml"
defaultPolkadotConfigPath = "./internal/chain/polkadot/config.toml"
defaultDevConfigPath = "./internal/chain/dev/config.toml"

gossamerName = "gssmr"
kusamaName = "kusama"
Expand Down
16 changes: 8 additions & 8 deletions cmd/gossamer/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import (
"testing"
"time"

"github.com/ChainSafe/gossamer/chain/dev"
"github.com/ChainSafe/gossamer/chain/gssmr"
"github.com/ChainSafe/gossamer/dot"
ctoml "github.com/ChainSafe/gossamer/dot/config/toml"
"github.com/ChainSafe/gossamer/dot/state"
"github.com/ChainSafe/gossamer/dot/types"
"github.com/ChainSafe/gossamer/internal/chain/dev"
"github.com/ChainSafe/gossamer/internal/chain/gssmr"
"github.com/ChainSafe/gossamer/internal/dot"
ctoml "github.com/ChainSafe/gossamer/internal/dot/config/toml"
"github.com/ChainSafe/gossamer/internal/dot/state"
"github.com/ChainSafe/gossamer/internal/dot/types"
"github.com/ChainSafe/gossamer/internal/lib/genesis"
"github.com/ChainSafe/gossamer/internal/lib/utils"
"github.com/ChainSafe/gossamer/internal/log"
"github.com/ChainSafe/gossamer/lib/genesis"
"github.com/ChainSafe/gossamer/lib/utils"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
6 changes: 3 additions & 3 deletions cmd/gossamer/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"fmt"
"time"

"github.com/ChainSafe/gossamer/dot"
ctoml "github.com/ChainSafe/gossamer/dot/config/toml"
"github.com/ChainSafe/gossamer/lib/utils"
"github.com/ChainSafe/gossamer/internal/dot"
ctoml "github.com/ChainSafe/gossamer/internal/dot/config/toml"
"github.com/ChainSafe/gossamer/internal/lib/utils"

"github.com/urfave/cli"
)
Expand Down
8 changes: 4 additions & 4 deletions cmd/gossamer/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"io"
"testing"

"github.com/ChainSafe/gossamer/chain/gssmr"
"github.com/ChainSafe/gossamer/dot"
"github.com/ChainSafe/gossamer/lib/utils"
"github.com/ChainSafe/gossamer/internal/chain/gssmr"
"github.com/ChainSafe/gossamer/internal/dot"
"github.com/ChainSafe/gossamer/internal/lib/utils"

ctoml "github.com/ChainSafe/gossamer/dot/config/toml"
ctoml "github.com/ChainSafe/gossamer/internal/dot/config/toml"
"github.com/ChainSafe/gossamer/internal/log"
"github.com/stretchr/testify/require"
"github.com/urfave/cli"
Expand Down
2 changes: 1 addition & 1 deletion cmd/gossamer/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package main

import (
"github.com/ChainSafe/gossamer/chain/dev"
"github.com/ChainSafe/gossamer/internal/chain/dev"
"github.com/urfave/cli"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/gossamer/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"io"
"testing"

"github.com/ChainSafe/gossamer/chain/dev"
"github.com/ChainSafe/gossamer/dot"
"github.com/ChainSafe/gossamer/lib/utils"
"github.com/ChainSafe/gossamer/internal/chain/dev"
"github.com/ChainSafe/gossamer/internal/dot"
"github.com/ChainSafe/gossamer/internal/lib/utils"

"github.com/stretchr/testify/require"
"github.com/urfave/cli"
Expand Down
4 changes: 2 additions & 2 deletions cmd/gossamer/import_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"os"
"path/filepath"

"github.com/ChainSafe/gossamer/lib/genesis"
"github.com/ChainSafe/gossamer/internal/lib/genesis"
)

var defaultGenesisSpecPath = "./chain/gssmr/genesis-spec.json"
var defaultGenesisSpecPath = "./internal/chain/gssmr/genesis-spec.json"

func createGenesisWithRuntime(fp string) (string, error) {
runtime, err := os.ReadFile(filepath.Clean(fp))
Expand Down
6 changes: 3 additions & 3 deletions cmd/gossamer/import_runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (
"os"
"testing"

"github.com/ChainSafe/gossamer/lib/common"
"github.com/ChainSafe/gossamer/lib/genesis"
"github.com/ChainSafe/gossamer/internal/lib/common"
"github.com/ChainSafe/gossamer/internal/lib/genesis"

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

func TestCreateGenesisWithRuntime(t *testing.T) {
defaultGenesisSpecPath = "../../chain/gssmr/genesis-spec.json"
defaultGenesisSpecPath = "../../internal/chain/gssmr/genesis-spec.json"

testCode := []byte("somecode")
testHex := common.BytesToHex(testCode)
Expand Down
8 changes: 4 additions & 4 deletions cmd/gossamer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"fmt"
"os"

"github.com/ChainSafe/gossamer/dot"
"github.com/ChainSafe/gossamer/dot/state"
"github.com/ChainSafe/gossamer/internal/dot"
"github.com/ChainSafe/gossamer/internal/dot/state"
"github.com/ChainSafe/gossamer/internal/lib/keystore"
"github.com/ChainSafe/gossamer/internal/lib/utils"
"github.com/ChainSafe/gossamer/internal/log"
"github.com/ChainSafe/gossamer/lib/keystore"
"github.com/ChainSafe/gossamer/lib/utils"
"github.com/urfave/cli"
)

Expand Down
Loading

0 comments on commit c7294e6

Please sign in to comment.