@@ -9,24 +9,28 @@ Rollkit is a sovereign rollup framework built in Go that allows developers to bu
99## Build and Development Commands
1010
1111### Building
12+
1213- ` make build ` - Builds the Testapp CLI to ` ./build/testapp `
1314- ` make install ` - Installs Testapp CLI to your Go bin directory
1415- ` make build-all ` - Builds all Rollkit binaries
1516- ` make docker-build ` - Builds Docker image tagged as ` rollkit:local-dev `
1617
1718### Testing
19+
1820- ` make test ` - Runs unit tests for all go.mod files
1921- ` make test-integration ` - Runs integration tests (15m timeout)
2022- ` make test-e2e ` - Runs end-to-end tests (requires building binaries first)
2123- ` make test-cover ` - Generates code coverage report
2224- ` make test-all ` - Runs all tests including Docker E2E tests
2325
2426### Linting and Code Quality
27+
2528- ` make lint ` - Runs all linters (golangci-lint, markdownlint, hadolint, yamllint, goreleaser check, actionlint)
2629- ` make lint-fix ` - Auto-fixes linting issues where possible
2730- ` make vet ` - Runs go vet
2831
2932### Development Utilities
33+
3034- ` make deps ` - Downloads dependencies and runs go mod tidy for all modules
3135- ` make proto-gen ` - Generates protobuf files (requires Docker)
3236- ` make mock-gen ` - Generates mocks using mockery
@@ -35,37 +39,44 @@ Rollkit is a sovereign rollup framework built in Go that allows developers to bu
3539## Code Architecture
3640
3741### Core Package Structure
42+
3843The project uses a zero-dependency core package pattern:
44+
3945- ** core/** - Contains only interfaces and types, no external dependencies
4046- ** block/** - Block management, creation, validation, and synchronization
4147- ** p2p/** - Networking layer built on libp2p
4248- ** sequencing/** - Modular sequencer implementations
4349- ** testapp/** - Reference implementation for testing
4450
4551### Key Interfaces
52+
4653- ** Executor** (core/executor.go) - Handles state transitions
4754- ** Sequencer** (core/sequencer.go) - Orders transactions
4855- ** DA** (core/da.go) - Data availability layer abstraction
4956
5057### Modular Design
58+
5159- Each component has an interface in the core package
5260- Implementations are in separate packages
5361- Components are wired together via dependency injection
5462- Multiple go.mod files enable modular builds
5563
5664### P2P Architecture
65+
5766- Built on libp2p with GossipSub and Kademlia DHT
5867- Nodes advertise capabilities (full/light, DA layers)
5968- Automatic peer discovery with rendezvous points
6069
6170## Testing Patterns
6271
6372### Test Organization
73+
6474- Unit tests: ` *_test.go ` files alongside code
6575- Integration tests: ` test/integration/ `
6676- E2E tests: ` test/e2e/ `
6777
6878### Running Specific Tests
79+
6980``` bash
7081# Run a single test
7182go test -run TestSpecificFunction ./package/...
@@ -78,44 +89,51 @@ go test -race ./package/...
7889```
7990
8091### Mock Generation
92+
8193- Mocks are defined in ` .mockery.yaml `
8294- Generate with ` make mock-gen `
8395- Mocks are placed in ` mocks/ ` directories
8496
8597## Code Style Guidelines
8698
8799### Go Conventions
100+
88101- Follow standard Go formatting (enforced by golangci-lint)
89102- Use meaningful variable names
90103- Keep functions small and focused
91104- Document exported types and functions
92105- Use context.Context for cancellation
93106
94107### Error Handling
108+
95109- Wrap errors with context using ` fmt.Errorf `
96110- Return errors early
97111- Use custom error types for domain-specific errors
98112
99113### Logging
114+
100115- Use structured logging (look for existing patterns)
101116- Include relevant context in log messages
102117- Use appropriate log levels
103118
104119## Common Development Tasks
105120
106121### Adding a New DA Layer
122+
1071231 . Implement the ` DA ` interface from ` core/da.go `
1081242 . Add configuration in the appropriate config package
1091253 . Wire it up in the initialization code
1101264 . Add tests following existing patterns
111127
112128### Modifying Protobuf Definitions
129+
1131301 . Edit ` .proto ` files in ` types/pb/ `
1141312 . Run ` make proto-gen ` to regenerate Go code
1151323 . Update any affected code
1161334 . Run tests to ensure compatibility
117134
118135### Adding New Tests
136+
1191371 . Place unit tests next to the code being tested
1201382 . Use table-driven tests where appropriate
1211393 . Mock external dependencies using mockery
@@ -150,4 +168,4 @@ go test -race ./package/...
150168- All tests must pass (` make test-all ` )
151169- Follow the existing code patterns
152170- Update tests when changing functionality
153- - Keep commits focused and atomic
171+ - Keep commits focused and atomic
0 commit comments