Skip to content

Commit 672a8a7

Browse files
authored
Merge branch 'main' into feat/fix-node-restart
2 parents dc29c63 + adf60e0 commit 672a8a7

9 files changed

Lines changed: 69 additions & 31 deletions

File tree

apps/evm/single/docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ services:
5858
condition: service_started
5959
local-da:
6060
condition: service_started
61+
ports:
62+
- "7676:7676" # p2p
63+
- "7331:7331" # rpc
6164
volumes:
6265
- evm-single-data:/root/.evm-single/
6366
restart: always

apps/grpc/single/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Start the Rollkit node with:
7272
- `--da.address`: Data availability layer address
7373
- `--da.auth-token`: Authentication token for DA layer
7474
- `--da.namespace`: Namespace for DA layer (optional)
75-
- `--p2p.listen-address`: P2P listen address (default: `/ip4/0.0.0.0/tcp/26656`)
75+
- `--p2p.listen-address`: P2P listen address (default: `/ip4/0.0.0.0/tcp/7676`)
7676
- `--block-time`: Time between blocks (default: `1s`)
7777

7878
## Example: Running with Local DA

client/crates/types/README.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# rollkit-types
1+
# ev-types
22

3-
Proto-generated types for Rollkit.
3+
Proto-generated types for Ev-node.
44

55
## Features
66

@@ -13,7 +13,7 @@ Proto-generated types for Rollkit.
1313

1414
```toml
1515
[dependencies]
16-
rollkit-types = "0.1"
16+
ev-types = "0.0.1"
1717
```
1818

1919
### Types only (without gRPC)
@@ -22,12 +22,12 @@ If you only need the message types without gRPC client/server code:
2222

2323
```toml
2424
[dependencies]
25-
rollkit-types = { version = "0.1", default-features = false }
25+
ev-types = { version = "0.0.1", default-features = false }
2626
```
2727

2828
This is useful when:
2929

30-
- You only need to serialize/deserialize Rollkit messages
30+
- You only need to serialize/deserialize Ev-node messages
3131
- You're using a different RPC framework
3232
- You want to minimize dependencies
3333
- You're building for environments where gRPC is not needed
@@ -36,33 +36,41 @@ This is useful when:
3636

3737
This crate generates two versions of the protobuf code:
3838

39-
1. **`rollkit.v1.messages.rs`** - Contains only the message types (structs/enums) with no gRPC dependencies
40-
2. **`rollkit.v1.services.rs`** - Contains everything including gRPC client/server code
39+
1. **`evnode.v1.messages.rs`** - Contains only the message types (structs/enums) with no gRPC dependencies
40+
2. **`evnode.v1.services.rs`** - Contains everything including gRPC client/server code
4141

4242
Both files are pre-generated and checked into the repository, so users don't need `protoc` installed or need to regenerate based on their feature selection.
4343

4444
## Building
4545

46-
The proto files are automatically generated during the build process:
46+
The crate uses pre-generated proto files that are checked into version control. This ensures that the crate can be built from crates.io without requiring access to the original `.proto` files.
4747

4848
```bash
4949
cargo build
5050
```
5151

52+
The build script will:
53+
1. Check if pre-generated files exist (`src/proto/evnode.v1.*.rs`)
54+
2. If they exist, use them (this is the default behavior)
55+
3. If they don't exist, attempt to generate them from source proto files
56+
5257
## Proto Generation
5358

5459
The generated code is committed to the repository. If you modify the proto files, you need to regenerate:
5560

5661
```bash
57-
# From the repository root
58-
make rust-proto-gen
62+
# Force regeneration by setting the environment variable
63+
EV_TYPES_FORCE_PROTO_GEN=1 cargo build
5964

60-
# Or directly
61-
cd client/crates/rollkit-types
62-
cargo build
65+
# Or from the repository root (if a make target exists)
66+
make rust-proto-gen
6367
```
6468

65-
**Important**: The build process generates both `rollkit.v1.messages.rs` and `rollkit.v1.services.rs`. Both files should be committed to ensure users can use the crate without needing to regenerate based on their feature selection.
69+
**Important**:
70+
- The build process generates both `evnode.v1.messages.rs` and `evnode.v1.services.rs`
71+
- Both files should be committed to ensure users can use the crate without needing to regenerate
72+
- When publishing to crates.io, the pre-generated files are included in the package
73+
- Users installing from crates.io will use the pre-generated files automatically
6674

6775
## Version Consistency
6876

client/crates/types/build.rs

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,39 @@ use walkdir::WalkDir;
44
fn main() -> Result<(), Box<dyn std::error::Error>> {
55
let manifest_dir_str = env::var("CARGO_MANIFEST_DIR")?;
66
let manifest_dir = Path::new(&manifest_dir_str);
7+
8+
// Create output directories
9+
let proto_dir = manifest_dir.join("src/proto");
10+
fs::create_dir_all(&proto_dir)?;
11+
12+
// Check if generated files already exist
13+
let messages_file = proto_dir.join("evnode.v1.messages.rs");
14+
let services_file = proto_dir.join("evnode.v1.services.rs");
15+
16+
// Check for environment variable to force regeneration
17+
let force_regen = env::var("EV_TYPES_FORCE_PROTO_GEN").is_ok();
18+
19+
// If files exist and we're not forcing regeneration, skip generation
20+
if !force_regen && messages_file.exists() && services_file.exists() {
21+
println!("cargo:warning=Using pre-generated proto files. Set EV_TYPES_FORCE_PROTO_GEN=1 to regenerate.");
22+
return Ok(());
23+
}
24+
725
// Make the include dir absolute and resolved (no "..", symlinks, etc.)
8-
let proto_root = manifest_dir.join("../../../proto").canonicalize()?;
26+
let proto_root = match manifest_dir.join("../../../proto").canonicalize() {
27+
Ok(path) => path,
28+
Err(e) => {
29+
// If proto files don't exist but generated files do, that's ok
30+
if messages_file.exists() && services_file.exists() {
31+
println!("cargo:warning=Proto source files not found at ../../../proto, using pre-generated files");
32+
return Ok(());
33+
}
34+
// Otherwise, this is a real error
35+
return Err(
36+
format!("Proto files not found and no pre-generated files available: {e}").into(),
37+
);
38+
}
39+
};
940

1041
// Collect the .proto files
1142
let proto_files: Vec<_> = WalkDir::new(&proto_root)
@@ -16,10 +47,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
1647
})
1748
.collect();
1849

19-
// Create output directories
20-
let proto_dir = manifest_dir.join("src/proto");
21-
fs::create_dir_all(&proto_dir)?;
22-
2350
// Always generate both versions and keep them checked in
2451
// This way users don't need to regenerate based on features
2552

pkg/p2p/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ type P2PConfig struct {
5353

5454
| Parameter | Description | Default | Example |
5555
|-----------|-------------|---------|---------|
56-
| ListenAddress | The address where the node listens for incoming P2P connections | `/ip4/0.0.0.0/tcp/26656` | `/ip4/0.0.0.0/tcp/26656` |
57-
| Seeds | Comma-separated list of seed nodes (bootstrap nodes) | "" | `/ip4/1.2.3.4/tcp/26656/p2p/12D3KooWA8EXV3KjBxEU...,/ip4/5.6.7.8/tcp/26656/p2p/12D3KooWJN9ByvD...` |
56+
| ListenAddress | The address where the node listens for incoming P2P connections | `/ip4/0.0.0.0/tcp/7676` | `/ip4/0.0.0.0/tcp/7676` |
57+
| Seeds | Comma-separated list of seed nodes (bootstrap nodes) | "" | `/ip4/1.2.3.4/tcp/7676/p2p/12D3KooWA8EXV3KjBxEU...,/ip4/5.6.7.8/tcp/7676/p2p/12D3KooWJN9ByvD...` |
5858
| BlockedPeers | Comma-separated list of peer IDs to block | "" | `12D3KooWA8EXV3KjBxEU...,12D3KooWJN9ByvD...` |
5959
| AllowedPeers | Comma-separated list of peer IDs to explicitly allow | "" | `12D3KooWA8EXV3KjBxEU...,12D3KooWJN9ByvD...` |
6060

@@ -202,8 +202,8 @@ These metrics can be exposed via Prometheus for monitoring and alerting.
202202
conf := config.Config{
203203
RootDir: "/path/to/root",
204204
P2P: config.P2PConfig{
205-
ListenAddress: "/ip4/0.0.0.0/tcp/26656",
206-
Seeds: "/ip4/1.2.3.4/tcp/26656/p2p/12D3KooWXYZ...,/ip4/5.6.7.8/tcp/26656/p2p/12D3KooWABC...",
205+
ListenAddress: "/ip4/0.0.0.0/tcp/7676",
206+
Seeds: "/ip4/1.2.3.4/tcp/7676/p2p/12D3KooWXYZ...,/ip4/5.6.7.8/tcp/7676/p2p/12D3KooWABC...",
207207
},
208208
}
209209

pkg/rpc/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func main() {
3636
myStore := store.NewKVStore(...)
3737

3838
// Start the RPC server
39-
log.Fatal(server.StartServer(myStore, "localhost:8080"))
39+
log.Fatal(server.StartServer(myStore, "localhost:7331"))
4040
}
4141
```
4242

@@ -54,7 +54,7 @@ import (
5454

5555
func main() {
5656
// Create a client
57-
storeClient := client.NewStoreClient("http://localhost:8080")
57+
storeClient := client.NewStoreClient("http://localhost:7331")
5858

5959
// Use the client to interact with the store
6060
ctx := context.Background()

pkg/sync/sync_service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,9 @@ func getPeers(seeds string, logger logging.EventLogger) []peer.ID {
385385
if seeds == "" {
386386
return peerIDs
387387
}
388-
sl := strings.Split(seeds, ",")
388+
sl := strings.SplitSeq(seeds, ",")
389389

390-
for _, seed := range sl {
390+
for seed := range sl {
391391
maddr, err := multiaddr.NewMultiaddr(seed)
392392
if err != nil {
393393
logger.Error("failed to parse peer", "address", seed, "error", err)

test/docker-e2e/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ require (
8686
github.com/dgraph-io/badger/v4 v4.2.0 // indirect
8787
github.com/dgraph-io/ristretto v0.1.1 // indirect
8888
github.com/distribution/reference v0.6.0 // indirect
89-
github.com/docker/docker v28.2.2+incompatible // indirect
89+
github.com/docker/docker v28.3.3+incompatible // indirect
9090
github.com/docker/go-connections v0.5.0 // indirect
9191
github.com/docker/go-units v0.5.0 // indirect
9292
github.com/dustin/go-humanize v1.0.1 // indirect

test/docker-e2e/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WA
227227
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
228228
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
229229
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
230-
github.com/docker/docker v28.2.2+incompatible h1:CjwRSksz8Yo4+RmQ339Dp/D2tGO5JxwYeqtMOEe0LDw=
231-
github.com/docker/docker v28.2.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
230+
github.com/docker/docker v28.3.3+incompatible h1:Dypm25kh4rmk49v1eiVbsAtpAsYURjYkaKubwuBdxEI=
231+
github.com/docker/docker v28.3.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
232232
github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c=
233233
github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc=
234234
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=

0 commit comments

Comments
 (0)