Skip to content

Commit ed7b9e3

Browse files
Merge branch 'refactor/consolidate-p2p-modules' into feat/basic-tls
* refactor/consolidate-p2p-modules: (72 commits) chore: update changelog chore: tidy type assertions chore: simplify log fix: module restart `WithHost` (again) chore: improve comments chore: add TECHDEBT comment fix: test helper & add TECHDEBT comment [Shared] `TxResult` consolidation (Merge After #673) (#676) [Dependencies] Update deps (#673) [Infra] Update reviewpad configuration (#675) chore: update changelog fix: re-evaluate options on p2p module `#Start()` chore: group imports chore: `RainTreeConfig#isValid()` returns multierr chore: remove `use_libp2p` from k8s config test: pass `*testing.T` to `getPeerstore` helper chore: improve error log messaging chore: remove unnecessary multierror usage chore: update/improve comments use pod IP for POCKET_P2P_HOSTNAME ...
2 parents 927a7cb + 55123e2 commit ed7b9e3

File tree

243 files changed

+6457
-4032
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+6457
-4032
lines changed

.github/ISSUE_TEMPLATE/issue.md

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ assignees: ""
7070
- [ ] **New tests or benchmarks**: `make ...`
7171
- [ ] **All tests**: `make test_all`
7272
- [ ] **LocalNet**: verify a `LocalNet` is still functioning correctly by following the instructions at [docs/development/README.md](https://github.com/pokt-network/pocket/tree/main/docs/development)
73+
- [ ] ***k8s LocalNet**: verify a `k8s LocalNet` is still functioning correctly by following the instructions [here](https://github.com/pokt-network/pocket/blob/main/build/localnet/README.md)
7374

7475
---
7576

.github/PULL_REQUEST_TEMPLATE.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ Please mark the relevant option(s):
3838

3939
## Testing
4040

41-
- [ ] `make develop_test`
42-
- [ ] [LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md) w/ all of the steps outlined in the `README`
41+
- [ ] `make develop_test`; if any code changes were made
42+
- [ ] [Docker Compose LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md); if any major functionality was changed or introduced
43+
- [ ] [k8s LocalNet](https://github.com/pokt-network/pocket/blob/main/build/localnet/README.md); if any infrastructure or configuration changes were made
4344

4445
<!-- REMOVE this comment block after following the instructions
4546
If you added additional tests or infrastructure, describe it here.

.github/workflows/changelog-verify.yml

+26-6
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,33 @@ jobs:
8585
const prNumber = context.payload.pull_request.number;
8686
const uniqueIdentifier = "<!-- validate_changelogs_review -->";
8787
88+
const perPage = 100;
89+
let page = 1;
90+
let hasMore = true;
91+
const matchingReviews = [];
92+
8893
// List all the reviews on the pull request
89-
const { data: reviews } = await github.rest.pulls.listReviews({
90-
owner: context.repo.owner,
91-
repo: context.repo.repo,
92-
pull_number: prNumber,
93-
});
94-
const matchingReviews = reviews.filter(review => review.body.includes(uniqueIdentifier) && review.state !== "DISMISSED");
94+
while (hasMore) {
95+
const { data: reviews } = await github.rest.pulls.listReviews({
96+
owner: context.repo.owner,
97+
repo: context.repo.repo,
98+
pull_number: prNumber,
99+
per_page: perPage,
100+
page: page,
101+
});
102+
103+
console.log(`Processing page ${page} with each page having ${perPage} reviews.`);
104+
console.log("reviews count", reviews.length);
105+
const filteredReviews = reviews.filter(
106+
(review) => review.body.includes(uniqueIdentifier) && review.state !== "DISMISSED"
107+
);
108+
console.log("filteredReviews count", filteredReviews.length);
109+
matchingReviews.push(...filteredReviews);
110+
111+
hasMore = reviews.length === perPage;
112+
page += 1;
113+
}
114+
95115
console.log(`Found ${matchingReviews.length} reviews.`);
96116
97117
// Dismiss all reviews containing the unique identifier

.github/workflows/cr.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: GPT Review
2+
3+
permissions:
4+
contents: read
5+
pull-requests: write
6+
7+
on:
8+
pull_request:
9+
types: [opened, reopened, synchronize]
10+
11+
jobs:
12+
review:
13+
if: ${{ contains(github.event.pull_request.labels.*.name, 'gpt review') }}
14+
runs-on: ubuntu-latest
15+
name: GPT Review
16+
steps:
17+
- uses: anc95/ChatGPT-CodeReview@main
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY_OLSHANSKY }}
21+
# Optional
22+
LANGUAGE: English
23+
MODEL: gpt-4
24+
# top_p: 1
25+
# temperature: 1

.github/workflows/main.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
runs-on: ubuntu-latest
100100
needs: test-multiple-go-versions
101101
# Until we have developer environments, we don't need the images built on other that main branches.
102-
if: github.ref == 'refs/heads/main'
102+
if: github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'push-image')
103103
strategy:
104104
matrix:
105105
# Build dev & prod images
@@ -138,7 +138,8 @@ jobs:
138138
push: true
139139
tags: ${{ steps.meta.outputs.tags }}
140140
labels: ${{ steps.meta.outputs.labels }}
141-
platforms: linux/amd64,linux/arm64
141+
# NB: Uncomment below if arm64 build is needed; arm64 builds are off by default because build times are significant.
142+
platforms: linux/amd64 #,linux/arm64
142143
file: build/Dockerfile.${{ matrix.osType }}.${{ matrix.imageType }}
143144
cache-from: type=gha
144145
cache-to: type=gha,mode=max

.gitignore

+8-1
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,11 @@ val2.json
8383
# Generated by Tilt (tilt.dev)
8484
localnet_config.yaml
8585

86-
.env
86+
.env
87+
88+
# Local files created during https://github.com/pokt-network/pocket/wiki creation
89+
tools/wiki
90+
91+
92+
# ignore highest precedence config file read by default
93+
/config.json

Makefile

+38-12
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ docker_check:
3434
fi; \
3535
}
3636

37+
# Internal helper target - check if kubectl is installed.
38+
kubectl_check:
39+
{ \
40+
if ( ! ( command -v kubectl >/dev/null )); then \
41+
echo "Seems like you don't have Kubectl installed. Make sure you review docs/development/README.md before continuing"; \
42+
exit 1; \
43+
fi; \
44+
}
45+
3746
.PHONY: prompt_user
3847
# Internal helper target - prompt the user before continuing
3948
prompt_user:
@@ -43,6 +52,14 @@ prompt_user:
4352
warn_destructive: ## Print WARNING to the user
4453
@echo "This is a destructive action that will affect docker resources outside the scope of this repo!"
4554

55+
.PHONY: protoc_check
56+
protoc_check: ## Checks if protoc is installed
57+
{ \
58+
if ! command -v protoc >/dev/null; then \
59+
echo "Follow instructions to install 'protoc': https://grpc.io/docs/protoc-installation/"; \
60+
fi; \
61+
}
62+
4663
.PHONY: go_vet
4764
go_vet: ## Run `go vet` on all files in the current project
4865
go vet ./...
@@ -57,30 +74,29 @@ go_staticcheck: ## Run `go staticcheck` on all files in the current project
5774
fi; \
5875
}
5976

77+
GODOC_PORT ?= 6060
6078
.PHONY: go_doc
61-
# INCOMPLETE: Generate documentation for the current project using `godo`
62-
go_doc:
79+
go_doc: # INCOMPLETE: [WIP] Generate documentation for the current project using `godo`
6380
{ \
6481
if command -v godoc >/dev/null; then \
65-
echo "Visit http://localhost:6060/pkg/github.com/pokt-network/pocket"; \
66-
godoc -http=localhost:6060 -goroot=${PWD}/..; \
82+
echo "Visit http://localhost:${GODOC_PORT}/pkg/github.com/pokt-network/pocket"; \
83+
godoc -http=localhost:${GODOC_PORT} -goroot=${PWD}/..; \
6784
else \
6885
echo "Install with 'go install golang.org/x/tools/cmd/godoc@latest'"; \
6986
fi; \
7087
}
7188

7289
.PHONY: go_protoc-go-inject-tag
73-
### Checks if protoc-go-inject-tag is installed
74-
go_protoc-go-inject-tag:
90+
go_protoc-go-inject-tag: ## Checks if protoc-go-inject-tag is installed
7591
{ \
7692
if ! command -v protoc-go-inject-tag >/dev/null; then \
7793
echo "Install with 'go install github.com/favadi/protoc-go-inject-tag@latest'"; \
7894
fi; \
7995
}
8096

97+
8198
.PHONY: go_oapi-codegen
82-
### Checks if oapi-codegen is installed
83-
go_oapi-codegen:
99+
go_oapi-codegen: ## Checks if oapi-codegen is installed
84100
{ \
85101
if ! command -v oapi-codegen >/dev/null; then \
86102
echo "Install with 'go install github.com/deepmap/oapi-codegen/cmd/[email protected]'"; \
@@ -110,6 +126,7 @@ install_cli_deps: ## Installs `protoc-gen-go`, `mockgen`, 'protoc-go-inject-tag'
110126

111127
.PHONY: develop_start
112128
develop_start: ## Run all of the make commands necessary to develop on the project
129+
make protoc_check && \
113130
make docker_loki_check && \
114131
make clean_mocks && \
115132
make protogen_clean && make protogen_local && \
@@ -272,9 +289,6 @@ protogen_local: go_protoc-go-inject-tag ## Generate go structures for all of the
272289
$(PROTOC_SHARED) -I=./runtime/genesis/proto --go_out=./runtime/genesis ./runtime/genesis/proto/*.proto
273290
protoc-go-inject-tag -input="./runtime/genesis/*.pb.go"
274291

275-
# Persistence
276-
$(PROTOC_SHARED) -I=./persistence/indexer/proto --go_out=./persistence/indexer ./persistence/indexer/proto/*.proto
277-
278292
# Utility
279293
$(PROTOC_SHARED) -I=./utility/types/proto --go_out=./utility/types ./utility/types/proto/*.proto
280294

@@ -326,6 +340,10 @@ generate_node_state_machine_diagram: ## (Re)generates the Node State Machine dia
326340
test_all: ## Run all go unit tests
327341
go test -p 1 -count=1 ./...
328342

343+
.PHONY: test_e2e
344+
test_e2e: kubectl_check ## Run all E2E tests
345+
go test ${VERBOSE_TEST} ./e2e/tests/... -tags=e2e
346+
329347
.PHONY: test_all_with_json_coverage
330348
test_all_with_json_coverage: generate_rpc_openapi ## Run all go unit tests, output results & coverage into json & coverage files
331349
go test -p 1 -json ./... -covermode=count -coverprofile=coverage.out | tee test_results.json | jq
@@ -367,9 +385,13 @@ test_hotstuff: ## Run all go unit tests related to hotstuff consensus
367385
go test ${VERBOSE_TEST} ./consensus/e2e_tests -run Hotstuff
368386

369387
.PHONY: test_pacemaker
370-
test_pacemaker: ## Run all go unit tests related to the hotstuff pacemaker
388+
test_pacemaker: ## Run all go unit tests related to hotstuff pacemaker
371389
go test ${VERBOSE_TEST} ./consensus/e2e_tests -run Pacemaker
372390

391+
.PHONY: test_statesync
392+
test_statesync: ## Run all go unit tests related to hotstuff statesync
393+
go test -v ${VERBOSE_TEST} -count=1 -run StateSync ./consensus/e2e_tests
394+
373395
.PHONY: test_vrf
374396
test_vrf: ## Run all go unit tests in the VRF library
375397
go test ${VERBOSE_TEST} ./consensus/leader_election/vrf
@@ -524,3 +546,7 @@ check_cross_module_imports: ## Lists cross-module imports
524546
.PHONY: send_local_tx
525547
send_local_tx: ## A hardcoded send tx to make LocalNet debugging easier
526548
go run -tags=debug app/client/*.go Account Send --non_interactive 00104055c00bed7c983a48aac7dc6335d7c607a7 00204737d2a165ebe4be3a7d5b0af905b0ea91d8 1000
549+
550+
.PHONY: query_chain_params
551+
query_chain_params: ## A hardcoded ChainParams query to make LocalNet debugging easier
552+
go run app/client/main.go Query AllChainParams

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ If you'd like to contribute to the Pocket V1 Protocol, start by:
6060

6161
- _Coming Soon: Telemetry Changelog_
6262

63+
### Project Management Resources
64+
- [V1 Roadmap](https://github.com/pokt-network/pocket/blob/main/docs/roadmap/README.md)
65+
- [V1 Project Board](https://github.com/orgs/pokt-network/projects/142/views/12)
66+
6367
## Support & Contact
6468

6569
<div>

app/client/cli/account.go

+5-11
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ package cli
22

33
import (
44
"fmt"
5-
"path/filepath"
6-
"strings"
75

8-
"github.com/pokt-network/pocket/app/client/keybase"
96
"github.com/pokt-network/pocket/shared/crypto"
107
"github.com/pokt-network/pocket/utility/types"
118
"github.com/spf13/cobra"
@@ -24,6 +21,7 @@ func NewAccountCommand() *cobra.Command {
2421
}
2522

2623
cmds := accountCommands()
24+
applySubcommandOptions(cmds, attachKeybaseFlagsToSubcommands())
2725
applySubcommandOptions(cmds, attachPwdFlagToSubcommands())
2826
cmd.AddCommand(cmds...)
2927

@@ -45,18 +43,14 @@ func accountCommands() []*cobra.Command {
4543
toAddr := crypto.AddressFromString(args[1])
4644
amount := args[2]
4745

48-
// Open the keybase at the specified path
49-
pocketDir := strings.TrimSuffix(dataDir, "/")
50-
keybasePath, err := filepath.Abs(pocketDir + keybaseSuffix)
51-
if err != nil {
52-
return err
53-
}
54-
kb, err := keybase.NewKeybase(keybasePath)
46+
kb, err := keybaseForCLI()
5547
if err != nil {
5648
return err
5749
}
5850

59-
pwd = readPassphrase(pwd)
51+
if !nonInteractive {
52+
pwd = readPassphrase(pwd)
53+
}
6054

6155
pk, err := kb.GetPrivKey(fromAddrHex, pwd)
6256
if err != nil {

0 commit comments

Comments
 (0)