Skip to content

Commit 510138c

Browse files
authored
Merge branch 'main' into minhd-vu/witness
2 parents 928f266 + 530c5ab commit 510138c

File tree

113 files changed

+9405
-972
lines changed

Some content is hidden

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

113 files changed

+9405
-972
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
name: Lint
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: actions/checkout@v4
25+
- uses: actions/checkout@v5
2626
- uses: actions/setup-go@v5
2727
with:
2828
go-version: ${{ env.GO_VERSION }}
@@ -32,12 +32,19 @@ jobs:
3232
run: go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
3333
- name: Run all the linter tools against code
3434
run: make lint
35+
36+
typos:
37+
runs-on: ubuntu-latest
38+
timeout-minutes: 5
39+
steps:
40+
- uses: actions/checkout@v5
41+
- uses: crate-ci/typos@a4c3e43aea0a9e9b9e6578d2731ebd9a27e8f6cd # v1.35.5
3542

3643
gen-doc:
3744
name: Check gen-doc generated files
3845
runs-on: ubuntu-latest
3946
steps:
40-
- uses: actions/checkout@v4
47+
- uses: actions/checkout@v5
4148

4249
- name: gen-doc
4350
run: make gen-doc
@@ -58,7 +65,7 @@ jobs:
5865
name: Check gen-proto generated files
5966
runs-on: ubuntu-latest
6067
steps:
61-
- uses: actions/checkout@v4
68+
- uses: actions/checkout@v5
6269

6370
- name: gen-proto
6471
run: make gen-proto
@@ -79,7 +86,7 @@ jobs:
7986
name: Check gen-go-bindings generated files
8087
runs-on: ubuntu-latest
8188
steps:
82-
- uses: actions/checkout@v4
89+
- uses: actions/checkout@v5
8390

8491
- name: gen-go-bindings
8592
run: make gen-go-bindings
@@ -100,7 +107,7 @@ jobs:
100107
name: Check gen-load-test-modes generated files
101108
runs-on: ubuntu-latest
102109
steps:
103-
- uses: actions/checkout@v4
110+
- uses: actions/checkout@v5
104111

105112
- name: gen-load-test-modes
106113
run: make gen-load-test-modes
@@ -121,7 +128,7 @@ jobs:
121128
name: Check gen-json-rpc-types generated files
122129
runs-on: ubuntu-latest
123130
steps:
124-
- uses: actions/checkout@v4
131+
- uses: actions/checkout@v5
125132

126133
- name: gen-json-rpc-types
127134
run: make gen-json-rpc-types
@@ -142,7 +149,7 @@ jobs:
142149
name: Test
143150
runs-on: ubuntu-latest
144151
steps:
145-
- uses: actions/checkout@v4
152+
- uses: actions/checkout@v5
146153
- uses: actions/setup-go@v5
147154
with:
148155
go-version: ${{ env.GO_VERSION }}
@@ -156,7 +163,7 @@ jobs:
156163
matrix:
157164
tool: [geth, anvil]
158165
steps:
159-
- uses: actions/checkout@v4
166+
- uses: actions/checkout@v5
160167
- uses: actions/setup-go@v5
161168
with:
162169
go-version: ${{ env.GO_VERSION }}
@@ -183,7 +190,7 @@ jobs:
183190
name: Install go package
184191
runs-on: ubuntu-latest
185192
steps:
186-
- uses: actions/checkout@v4
193+
- uses: actions/checkout@v5
187194
- uses: actions/setup-go@v5
188195
with:
189196
go-version: ${{ env.GO_VERSION }}

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout sources
20-
uses: actions/checkout@v4
20+
uses: actions/checkout@v5
2121

2222
- name: Install go
2323
uses: actions/setup-go@v5
@@ -40,7 +40,7 @@ jobs:
4040
run: echo "tag=$(git describe --tags --exact-match HEAD)" >> $GITHUB_ENV
4141

4242
- name: Publish binaries
43-
uses: svenstaro/upload-release-action@ebd922b779f285dafcac6410a0710daee9c12b82 # 2.10.0
43+
uses: svenstaro/upload-release-action@81c65b7cd4de9b2570615ce3aad67a41de5b1a13 # 2.11.2
4444
with:
4545
repo_token: ${{ secrets.GITHUB_TOKEN }}
4646
tag: ${{ env.tag }}

CLAUDE.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
polygon-cli is a Swiss Army knife of blockchain tools for building, testing, and running blockchain applications. It's a collection of utilities primarily focused on Polygon/Ethereum ecosystems.
8+
9+
## Architecture Overview
10+
11+
The project follows a command-based architecture using Cobra framework:
12+
13+
- **Main Entry**: `main.go` simply calls `cmd.Execute()`
14+
- **Command Structure**: Each command is organized in its own package under `cmd/` (e.g., `cmd/loadtest/`, `cmd/monitor/`)
15+
- **Bindings**: Go bindings for smart contracts are in `bindings/` (generated from Solidity contracts in `contracts/`)
16+
- **Utilities**: Common utilities are in `util/` package
17+
18+
Key architectural patterns:
19+
- Commands are self-contained with their own usage documentation (`.md` files)
20+
- Heavy use of code generation for documentation, protobuf, contract bindings, and RPC types
21+
- Docker-based generation workflows to ensure consistency
22+
23+
## Common Development Commands
24+
25+
### Building and Installation
26+
```bash
27+
# Build the binary
28+
make build
29+
30+
# Install to ~/go/bin/
31+
make install
32+
33+
# Cross-compile for different platforms
34+
make cross # With CGO
35+
make simplecross # Without CGO
36+
```
37+
38+
### Testing
39+
```bash
40+
# Run all tests with coverage
41+
make test
42+
43+
# Run specific test
44+
go test -v ./cmd/loadtest/...
45+
46+
# Run load test against local node
47+
make geth # Start local geth node
48+
make geth-loadtest # Fund account and run load test
49+
```
50+
51+
### Code Quality
52+
```bash
53+
# Run all linters (includes tidy, vet, golangci-lint)
54+
make lint
55+
56+
# Individual linter commands
57+
make tidy # Clean up go.mod
58+
make fmt # Format code
59+
make vet # Run go vet and shadow
60+
make golangci-lint # Run golangci-lint
61+
```
62+
63+
### Code Generation
64+
```bash
65+
# Generate everything (docs, proto, bindings, etc.)
66+
make gen
67+
68+
# Individual generation commands
69+
make gen-doc # Generate CLI documentation
70+
make gen-proto # Generate protobuf stubs
71+
make gen-go-bindings # Generate contract bindings
72+
make gen-load-test-modes # Generate loadtest mode strings
73+
make gen-json-rpc-types # Generate JSON RPC types
74+
```
75+
76+
### Contract Development
77+
```bash
78+
# Work with smart contracts
79+
cd contracts/
80+
make build # Build contracts with Foundry
81+
make gen-go-bindings # Generate Go bindings
82+
```
83+
84+
## Adding New Features
85+
86+
When adding a new command:
87+
1. Create a new package under `cmd/your-command/`
88+
2. Add the command to `cmd/root.go` in the `NewPolycliCommand()` function
89+
3. Create a usage documentation file (e.g., `yourCommandUsage.md`)
90+
4. Run `make gen-doc` to update the main documentation
91+
5. If adding a new loadtest mode, run `make gen-load-test-modes` after using stringer
92+
93+
## CI/CD Considerations
94+
95+
The CI pipeline (`/.github/workflows/ci.yml`) runs:
96+
- Linting (golangci-lint, shadow)
97+
- Tests
98+
- Generation checks (ensures all generated files are up-to-date)
99+
- Load tests against both geth and anvil
100+
101+
Always run `make gen` before committing if you've changed anything that affects code generation.
102+
103+
## Key Dependencies
104+
105+
- Go 1.23+ required
106+
- Foundry (for smart contract compilation)
107+
- Docker (for generation tasks)
108+
- Additional tools: jq, bc, protoc (for development)
109+
110+
## Environment Configuration
111+
112+
The tool supports configuration via:
113+
- CLI flags (highest priority)
114+
- Environment variables
115+
- Config file (`~/.polygon-cli.yaml`)
116+
- Viper is used for configuration management
117+
118+
## Logging
119+
120+
- Use zerolog for structured, performant logging throughout the project
121+
122+
## Development Guidelines
123+
- Use conventional commit messages
124+
125+
## Development Memories
126+
- Use `make build` to build polycli

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Note: Do not modify this section! It is auto-generated by `cobra` using `make ge
4343

4444
- [polycli cdk](doc/polycli_cdk.md) - Utilities for interacting with CDK networks
4545

46+
- [polycli contract](doc/polycli_contract.md) - Interact with smart contracts and fetch contract information from the blockchain
47+
4648
- [polycli dbbench](doc/polycli_dbbench.md) - Perform a level/pebble db benchmark
4749

4850
- [polycli dockerlogger](doc/polycli_dockerlogger.md) - Monitor and filter Docker container logs
@@ -71,6 +73,8 @@ Note: Do not modify this section! It is auto-generated by `cobra` using `make ge
7173

7274
- [polycli monitor](doc/polycli_monitor.md) - Monitor blocks using a JSON-RPC endpoint.
7375

76+
- [polycli monitorv2](doc/polycli_monitorv2.md) - Monitor v2 command stub
77+
7478
- [polycli nodekey](doc/polycli_nodekey.md) - Generate node keys for different blockchain clients and protocols.
7579

7680
- [polycli p2p](doc/polycli_p2p.md) - Set of commands related to devp2p.

bindings/uniswapv3/IUniswapV3Pool.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindings/uniswapv3/NFTDescriptor.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindings/uniswapv3/NonfungiblePositionManager.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindings/uniswapv3/NonfungibleTokenPositionDescriptor.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindings/uniswapv3/ProxyAdmin.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindings/uniswapv3/QuoterV2.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)