Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ rpc/client.gen.go
build/config/gen*.json

# Ignored generated files by build
bin/*
bin/*
306 changes: 9 additions & 297 deletions Makefile

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import (
"fmt"
"io/ioutil"

"github.com/pokt-network/pocket/runtime/test_artifacts"
"github.com/pokt-network/pocket/internal/runtime/test_artifacts"
)

// Utility to generate config and genesis files

const (
defaultGenesisFilePathFormat = "build/config/%sgenesis.json"
defaultConfigFilePathFormat = "build/config/%sconfig%d.json"
rwoPerm = 0777
rwoPerm = 0o777
)

var (
Expand Down
4 changes: 2 additions & 2 deletions build/scripts/watch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ genesis=$2

if [ -z "$DEBUG_PORT" ]; then
echo "DEBUG DISABLED"
command="go run app/pocket/main.go --config=$config --genesis=$genesis"
command="go run cmd/pocket/main.go --config=$config --genesis=$genesis"
else
echo "DEBUG ENABLED on port $DEBUG_PORT"
command="touch /tmp/output.dlv && dlv debug app/pocket/main.go --headless --accept-multiclient --listen=:$DEBUG_PORT --api-version=2 --continue --output /tmp/output.dlv -- --config=$config --genesis=$genesis"
command="touch /tmp/output.dlv && dlv debug cmd/pocket/main.go --headless --accept-multiclient --listen=:$DEBUG_PORT --api-version=2 --continue --output /tmp/output.dlv -- --config=$config --genesis=$genesis"
fi

reflex \
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/watch_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

if command -v reflex >/dev/null
then
reflex -r '\.go$' -s -- sh -c "go build -v app/pocket/main.go"
reflex -r '\.go$' -s -- sh -c "go build -v cmd/pocket/main.go"
else
echo "reflex not found. Install with `go install github.com/cespare/reflex@latest`"
fi
File renamed without changes.
4 changes: 2 additions & 2 deletions app/client/cli/account.go → cmd/p1/cli/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package cli
import (
"fmt"

"github.com/pokt-network/pocket/shared/crypto"
"github.com/pokt-network/pocket/utility/types"
"github.com/pokt-network/pocket/internal/shared/crypto"
"github.com/pokt-network/pocket/internal/utility/types"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion app/client/cli/actor.go → cmd/p1/cli/actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"regexp"
"strings"

typesUtil "github.com/pokt-network/pocket/utility/types"
typesUtil "github.com/pokt-network/pocket/internal/utility/types"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion app/client/cli/cmd.go → cmd/p1/cli/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cli
import (
"context"

"github.com/pokt-network/pocket/runtime/defaults"
"github.com/pokt-network/pocket/internal/runtime/defaults"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion app/client/cli/consensus.go → cmd/p1/cli/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cli
import (
"fmt"

"github.com/pokt-network/pocket/rpc"
"github.com/pokt-network/pocket/internal/rpc"
"github.com/spf13/cobra"
)

Expand Down
20 changes: 10 additions & 10 deletions app/client/cli/debug.go → cmd/p1/cli/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import (
"sync"

"github.com/manifoldco/promptui"
"github.com/pokt-network/pocket/consensus"
"github.com/pokt-network/pocket/logger"
"github.com/pokt-network/pocket/p2p"
"github.com/pokt-network/pocket/rpc"
"github.com/pokt-network/pocket/runtime"
"github.com/pokt-network/pocket/shared"
pocketCrypto "github.com/pokt-network/pocket/shared/crypto"
"github.com/pokt-network/pocket/shared/messaging"
"github.com/pokt-network/pocket/shared/modules"
"github.com/pokt-network/pocket/telemetry"
"github.com/pokt-network/pocket/internal/consensus"
"github.com/pokt-network/pocket/internal/logger"
"github.com/pokt-network/pocket/internal/p2p"
"github.com/pokt-network/pocket/internal/rpc"
"github.com/pokt-network/pocket/internal/runtime"
"github.com/pokt-network/pocket/internal/shared"
pocketCrypto "github.com/pokt-network/pocket/internal/shared/crypto"
"github.com/pokt-network/pocket/internal/shared/messaging"
"github.com/pokt-network/pocket/internal/shared/modules"
"github.com/pokt-network/pocket/internal/telemetry"
"github.com/spf13/cobra"
"google.golang.org/protobuf/types/known/anypb"
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"log"

"github.com/pokt-network/pocket/app/client/cli"
"github.com/pokt-network/pocket/cmd/p1/cli"

"github.com/spf13/cobra/doc"
)
Expand Down
2 changes: 1 addition & 1 deletion app/client/cli/gov.go → cmd/p1/cli/gov.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cli
import (
"fmt"

"github.com/pokt-network/pocket/utility/types"
"github.com/pokt-network/pocket/internal/utility/types"
"github.com/spf13/cobra"
"google.golang.org/protobuf/types/known/anypb"
"google.golang.org/protobuf/types/known/wrapperspb"
Expand Down
2 changes: 1 addition & 1 deletion app/client/cli/system.go → cmd/p1/cli/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"net/http"

"github.com/pokt-network/pocket/rpc"
"github.com/pokt-network/pocket/internal/rpc"
"github.com/spf13/cobra"
)

Expand Down
10 changes: 5 additions & 5 deletions app/client/cli/utils.go → cmd/p1/cli/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import (
"strings"
"time"

"github.com/pokt-network/pocket/rpc"
"github.com/pokt-network/pocket/shared/codec"
"github.com/pokt-network/pocket/shared/converters"
"github.com/pokt-network/pocket/shared/crypto"
typesUtil "github.com/pokt-network/pocket/utility/types"
"github.com/pokt-network/pocket/internal/rpc"
"github.com/pokt-network/pocket/internal/shared/codec"
"github.com/pokt-network/pocket/internal/shared/converters"
"github.com/pokt-network/pocket/internal/shared/crypto"
typesUtil "github.com/pokt-network/pocket/internal/utility/types"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh/terminal"
)
Expand Down
2 changes: 1 addition & 1 deletion app/client/cli/utils_test.go → cmd/p1/cli/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"testing"

"github.com/pokt-network/pocket/shared/crypto"
"github.com/pokt-network/pocket/internal/shared/crypto"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion app/client/main.go → cmd/p1/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os/signal"
"syscall"

"github.com/pokt-network/pocket/app/client/cli"
"github.com/pokt-network/pocket/cmd/p1/cli"
)

func main() {
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions app/pocket/main.go → cmd/pocket/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"flag"
"log"

"github.com/pokt-network/pocket/app"
"github.com/pokt-network/pocket/runtime"
"github.com/pokt-network/pocket/shared"
app "github.com/pokt-network/pocket/cmd"
"github.com/pokt-network/pocket/internal/runtime"
"github.com/pokt-network/pocket/internal/shared"
)

func main() {
Expand Down
24 changes: 14 additions & 10 deletions docs/development/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,22 +152,26 @@ $ make client_start && make client_connect

```bash
Pocket
├── app # Entrypoint to running the Pocket node and clients
| ├── client # Entrypoint to running a local Pocket debug client
├── cmd # Entrypoint to running the Pocket node and clients
| ├── p1 # Entrypoint to running a local Pocket debug client
| ├── pocket # Entrypoint to running a local Pocket node
├── bin # [currently-unused] Destination for compiled pocket binaries
├── build # Build related source files including Docker, scripts, etc
| ├── config # Configuration files for to run nodes in development
| ├── deployments # Docker-compose to run different cluster of services for development
| ├── Docker* # Various Dockerfile(s)
├── consensus # Implementation of the Consensus module
├── core # [currently-unused]
├── internal # Private application and library code.
├── consensus # Implementation of the Consensus module
├── p2p # Implementation of the P2P module
├── persistence # Implementation of the Persistence module
├── shared # [to-be-refactored] Shared types, modules and utils
├── utility # Implementation of the Utility module
├── runtime # Implementation of the Runtime module
├── rpc # Implementation of the RPC module
├── logger # Implementation of the Logger module
├── telemetry # Implementation of the Telemetry module
├── docs # Links to V1 Protocol implementation documentation (excluding the protocol specification)
├── p2p # Implementation of the P2P module
├── persistence # Implementation of the Persistence module
├── shared # [to-be-refactored] Shared types, modules and utils
├── utility # Implementation of the Utility module
├── Makefile # [to-be-deleted] The source of targets used to develop, build and test
├── scripts # Scripts to perform various build, install, analysis, etc operations.These scripts keep the root level Makefile small and simple.
├── Makefile # The source of targets used to develop, build and test
```

### Linters
Expand Down
2 changes: 1 addition & 1 deletion consensus/block.go → internal/consensus/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"
"unsafe"

typesCons "github.com/pokt-network/pocket/consensus/types"
typesCons "github.com/pokt-network/pocket/internal/consensus/types"
)

func (m *consensusModule) commitBlock(block *typesCons.Block) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"time"

"github.com/benbjohnson/clock"
"github.com/pokt-network/pocket/consensus"
typesCons "github.com/pokt-network/pocket/consensus/types"
"github.com/pokt-network/pocket/shared/modules"
"github.com/pokt-network/pocket/internal/consensus"
typesCons "github.com/pokt-network/pocket/internal/consensus/types"
"github.com/pokt-network/pocket/internal/shared/modules"
"github.com/stretchr/testify/require"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

"github.com/benbjohnson/clock"

"github.com/pokt-network/pocket/consensus"
typesCons "github.com/pokt-network/pocket/consensus/types"
"github.com/pokt-network/pocket/shared/modules"
"github.com/pokt-network/pocket/internal/consensus"
typesCons "github.com/pokt-network/pocket/internal/consensus/types"
"github.com/pokt-network/pocket/internal/shared/modules"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/types/known/anypb"
)
Expand Down Expand Up @@ -164,7 +164,7 @@ func TestPacemakerCatchupSameStepDifferentRounds(t *testing.T) {

// Set all nodes to the same STEP and HEIGHT BUT different ROUNDS
for _, pocketNode := range pocketNodes {
//update height, step, leaderid, and utility context via setters exposed with the debug interface
// update height, step, leaderid, and utility context via setters exposed with the debug interface
consensusModImpl := GetConsensusModImpl(pocketNode)
consensusModImpl.MethodByName("SetHeight").Call([]reflect.Value{reflect.ValueOf(testHeight)})
consensusModImpl.MethodByName("SetStep").Call([]reflect.Value{reflect.ValueOf(testStep)})
Expand All @@ -185,7 +185,7 @@ func TestPacemakerCatchupSameStepDifferentRounds(t *testing.T) {
prepareProposal := &typesCons.HotstuffMessage{
Type: consensus.Propose,
Height: testHeight,
Step: consensus.Prepare, //typesCons.HotstuffStep(testStep),
Step: consensus.Prepare, // typesCons.HotstuffStep(testStep),
Round: leaderRound,
Block: block,
Justification: nil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ import (

"github.com/benbjohnson/clock"
"github.com/golang/mock/gomock"
"github.com/pokt-network/pocket/consensus"
typesCons "github.com/pokt-network/pocket/consensus/types"
"github.com/pokt-network/pocket/runtime"
"github.com/pokt-network/pocket/runtime/test_artifacts"
"github.com/pokt-network/pocket/shared"
"github.com/pokt-network/pocket/shared/codec"
cryptoPocket "github.com/pokt-network/pocket/shared/crypto"
"github.com/pokt-network/pocket/shared/messaging"
"github.com/pokt-network/pocket/shared/modules"
modulesMock "github.com/pokt-network/pocket/shared/modules/mocks"
"github.com/pokt-network/pocket/internal/consensus"
typesCons "github.com/pokt-network/pocket/internal/consensus/types"
"github.com/pokt-network/pocket/internal/runtime"
"github.com/pokt-network/pocket/internal/runtime/test_artifacts"
"github.com/pokt-network/pocket/internal/shared"
"github.com/pokt-network/pocket/internal/shared/codec"
cryptoPocket "github.com/pokt-network/pocket/internal/shared/crypto"
"github.com/pokt-network/pocket/internal/shared/messaging"
"github.com/pokt-network/pocket/internal/shared/modules"
modulesMock "github.com/pokt-network/pocket/internal/shared/modules/mocks"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/types/known/anypb"
)
Expand Down Expand Up @@ -226,7 +226,6 @@ func WaitForNetworkConsensusMessages(
numMessages int,
millis time.Duration,
) (messages []*anypb.Any, err error) {

includeFilter := func(m *anypb.Any) bool {
msg, err := codec.GetCodec().FromAny(m)
require.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions consensus/debugging.go → internal/consensus/debugging.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package consensus
import (
"log"

typesCons "github.com/pokt-network/pocket/consensus/types"
"github.com/pokt-network/pocket/shared/messaging"
typesCons "github.com/pokt-network/pocket/internal/consensus/types"
"github.com/pokt-network/pocket/internal/shared/messaging"
)

func (m *consensusModule) HandleDebugMessage(debugMessage *messaging.DebugMessage) error {
Expand Down
File renamed without changes.
10 changes: 4 additions & 6 deletions consensus/helpers.go → internal/consensus/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"encoding/base64"
"log"

typesCons "github.com/pokt-network/pocket/consensus/types"
"github.com/pokt-network/pocket/shared/codec"
cryptoPocket "github.com/pokt-network/pocket/shared/crypto"
typesCons "github.com/pokt-network/pocket/internal/consensus/types"
"github.com/pokt-network/pocket/internal/shared/codec"
cryptoPocket "github.com/pokt-network/pocket/internal/shared/crypto"
"google.golang.org/protobuf/proto"
)

Expand All @@ -28,9 +28,7 @@ const (
HotstuffMessageContentType = "consensus.HotstuffMessage"
)

var (
HotstuffSteps = [...]typesCons.HotstuffStep{NewRound, Prepare, PreCommit, Commit, Decide}
)
var HotstuffSteps = [...]typesCons.HotstuffStep{NewRound, Prepare, PreCommit, Commit, Decide}

// ** Hotstuff Helpers ** //

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package consensus

import (
typesCons "github.com/pokt-network/pocket/consensus/types"
typesCons "github.com/pokt-network/pocket/internal/consensus/types"
)

// DISCUSS: Should these functions return an error?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package consensus
import (
"unsafe"

consensusTelemetry "github.com/pokt-network/pocket/consensus/telemetry"
typesCons "github.com/pokt-network/pocket/consensus/types"
"github.com/pokt-network/pocket/shared/codec"
consensusTelemetry "github.com/pokt-network/pocket/internal/consensus/telemetry"
typesCons "github.com/pokt-network/pocket/internal/consensus/types"
"github.com/pokt-network/pocket/internal/shared/codec"
)

// CONSOLIDATE: Last/Prev & AppHash/StateHash/BlockHash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package consensus
import (
"fmt"

consensusTelemetry "github.com/pokt-network/pocket/consensus/telemetry"
"github.com/pokt-network/pocket/consensus/types"
typesCons "github.com/pokt-network/pocket/consensus/types"
consensusTelemetry "github.com/pokt-network/pocket/internal/consensus/telemetry"
"github.com/pokt-network/pocket/internal/consensus/types"
typesCons "github.com/pokt-network/pocket/internal/consensus/types"
)

// CONSOLIDATE: Terminology of `appHash` and `stateHash`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package leader_election
import (
"log"

typesCons "github.com/pokt-network/pocket/consensus/types"
"github.com/pokt-network/pocket/shared/modules"
typesCons "github.com/pokt-network/pocket/internal/consensus/types"
"github.com/pokt-network/pocket/internal/shared/modules"
)

const (
Expand Down
Loading