Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node: commit proto and matching test fixes #1769 #1824

Merged
merged 3 commits into from
Oct 31, 2022
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ jobs:
# The go-ethereum and celo-blockchain packages both implement secp256k1 using the exact same header, but that causes duplicate symbols.
- name: Run golang tests
run: cd node && go test -v -race -ldflags '-extldflags "-Wl,--allow-multiple-definition" ' ./...
- name: Ensure generated proto matches
run: |
rm -rf node/pkg/proto
docker build --target go-export -f Dockerfile.proto -o type=local,dest=node .
git diff --name-only --exit-code && echo "✅ Generated proto matches committed proto" || (echo "❌ Generated proto differs from committed proto, run \`rm -rf node/pkg/proto && docker build --target go-export -f Dockerfile.proto -o type=local,dest=node .\` and commit the result" >&2 && exit 1)

# Run Rust lints and tests
rust-lint-and-tests:
Expand Down
23 changes: 17 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,29 @@ own features on top of, without requiring any changes in Wormhole itself.

Please open a GitHub issue outlining your use case, and we can help you build it!

# Pre-Commit checks
## Pre-Commit checks

Run `./scripts/lint.sh -d format` and `./scripts/lint.sh lint`.

# Commit Naming Convention
## Commit Naming Convention

When making commits on Wormhole, it's advised to prefix the commit with the component name.

Example Component Names (generally the root folder of the change in the Wormhole repo):

- node
- ethereum
- sdk
- solana

Example Full Commit Text:
- sdk/js-proto*: 0.0.4 version bump

- sdk/js-proto\*: 0.0.4 version bump
- node: docs for running a spy against mainnet
- node: Fix formatting with go 1.19

Example Full Commits:

- https://github.com/wormhole-foundation/wormhole/commit/5cc2c071572daab876db2fd82e9d16dc4c34aa11
- https://github.com/wormhole-foundation/wormhole/commit/eeb1682fba9530a8cd8755b53639ba3daefeda36

Expand All @@ -91,9 +94,17 @@ Resources for writing good commit messages:
- https://cbea.ms/git-commit/
- https://reflectoring.io/meaningful-commit-messages/

## IDE Integration
## Comment Conventions

### Go

Go code should follow the [Go Doc Comments](https://go.dev/doc/comment) standard.

### TypeScript

TypeScript code should follow the [TSDoc](https://tsdoc.org/) standard.

### Golang formatting
## Golang formatting

You must format your code with `goimports` before submitting.
You can install it with `go install golang.org/x/tools/cmd/goimports@latest` and run it with `goimports -d ./`.
Expand All @@ -112,7 +123,7 @@ You can enable it in VSCode with the following in your `settings.json`.
},
```

# Testing
## Testing

We believe automated tests ensure the integrity of all Wormhole components. Anyone can verify or extend them transparently and they fit nicely with our software development lifecycle. This ensures Wormhole components operate as expected in both expected and failure cases.

Expand Down
14 changes: 8 additions & 6 deletions DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ IntelliJ's [remote development backend](https://www.jetbrains.com/remote-develop

## Tips and tricks

### Generate protos (Go / TypeScript)

As of [#1352](https://github.com/wormhole-foundation/wormhole/pull/1352), the tsproto generated ts files are provided in two npm packages for [node](./sdk/js-proto-node/) and [web](./sdk/js-proto-web/)

As of [#1824](https://github.com/wormhole-foundation/wormhole/pull/1824), changes to the proto files must match the generated go files.

To re-generate these files run `rm -rf node/pkg/proto && docker build --target go-export -f Dockerfile.proto -o type=local,dest=node .` from the root of the repo.

### Call gRPC services

tools/bin/grpcurl -protoset <(tools/bin/buf build -o -) -plaintext localhost:7072 spy.v1.SpyRPCService/SubscribeSignedVAA
Expand Down Expand Up @@ -171,12 +179,6 @@ Launch the devnet with flags supplying your database info to forward events to y

tilt up -- --num=1 --gcpProject=your-project-id --bigTableKeyPath=./your-service-account-key.json

### bridge UI

Run the bridge UI in devnet by supplying the `--bridge_ui` flag:

tilt up -- --bridge_ui

### Algorand

Node logs:
Expand Down
26 changes: 6 additions & 20 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,6 @@ if not ci:
def k8s_yaml_with_ns(objects):
return k8s_yaml(namespace_inject(objects, namespace))

# protos

proto_deps = ["./proto", "buf.yaml", "buf.gen.yaml"]

local_resource(
name = "proto-gen",
deps = proto_deps,
cmd = "tilt docker build -- --target go-export -f Dockerfile.proto -o type=local,dest=node .",
env = {"DOCKER_BUILDKIT": "1"},
labels = ["protobuf"],
allow_parallel = True,
trigger_mode = trigger_mode,
)

local_resource(
name = "const-gen",
deps = ["scripts", "clients", "ethereum/.env.test"],
Expand Down Expand Up @@ -263,7 +249,7 @@ def build_node_yaml():

k8s_yaml_with_ns(build_node_yaml())

guardian_resource_deps = ["proto-gen", "eth-devnet"]
guardian_resource_deps = ["eth-devnet"]
if evm2:
guardian_resource_deps = guardian_resource_deps + ["eth-devnet2"]
if solana:
Expand Down Expand Up @@ -351,7 +337,7 @@ k8s_yaml_with_ns("devnet/spy.yaml")

k8s_resource(
"spy",
resource_deps = ["proto-gen", "guardian"],
resource_deps = ["guardian"],
port_forwards = [
port_forward(6061, container_port = 6060, name = "Debug/Status Server [:6061]", host = webHost),
port_forward(7072, name = "Spy gRPC [:7072]", host = webHost),
Expand Down Expand Up @@ -448,7 +434,7 @@ if spy_relayer:

k8s_resource(
"spy-listener",
resource_deps = ["proto-gen", "guardian", "redis", "spy"],
resource_deps = ["guardian", "redis", "spy"],
port_forwards = [
port_forward(6062, container_port = 6060, name = "Debug/Status Server [:6062]", host = webHost),
port_forward(4201, name = "REST [:4201]", host = webHost),
Expand All @@ -462,7 +448,7 @@ if spy_relayer:

k8s_resource(
"spy-relayer",
resource_deps = ["proto-gen", "guardian", "redis"],
resource_deps = ["guardian", "redis"],
port_forwards = [
port_forward(8083, name = "Prometheus [:8083]", host = webHost),
],
Expand All @@ -474,7 +460,7 @@ if spy_relayer:

k8s_resource(
"spy-wallet-monitor",
resource_deps = ["proto-gen", "guardian", "redis"],
resource_deps = ["guardian", "redis"],
port_forwards = [
port_forward(8084, name = "Prometheus [:8084]", host = webHost),
],
Expand Down Expand Up @@ -573,7 +559,7 @@ if explorer:
)
k8s_resource(
"cloud-functions",
resource_deps = ["proto-gen", "bigtable-emulator", "pubsub-emulator"],
resource_deps = ["bigtable-emulator", "pubsub-emulator"],
port_forwards = [port_forward(8090, name = "Cloud Functions [:8090]", host = webHost)],
labels = ["explorer"],
trigger_mode = trigger_mode,
Expand Down
1 change: 0 additions & 1 deletion node/pkg/.gitignore

This file was deleted.

Loading