Skip to content

Commit 3cf08e4

Browse files
Initial dig-protocol crate
Standalone L2 protocol crate extending Chia's wire protocol with DIG opcodes 200-219. Re-exports chia-protocol, chia-sdk-client, chia-ssl, chia-traits under a single dependency. Public API: - DigMessage: raw-u8 opcode wire framing (bypasses ProtocolMessageTypes enum validation) - DigMessageType: typed discriminants for 200-219 range - RegisterPeer/RegisterAck: DIG introducer wire types (218/219) - RequestPeersIntroducer/RespondPeersIntroducer: Chia-standard (63/64) Features native-tls and rustls forward to chia-sdk-client; TLS-dependent re-exports (Client, ClientState, Connector) gate on either. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent cd8de1f commit 3cf08e4

9 files changed

Lines changed: 3573 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Publish to crates.io
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version to publish (e.g., v0.1.0)'
11+
required: true
12+
type: string
13+
14+
env:
15+
CARGO_TERM_COLOR: always
16+
17+
jobs:
18+
test:
19+
name: Test Suite
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Install Rust toolchain
26+
uses: dtolnay/rust-toolchain@stable
27+
with:
28+
toolchain: stable
29+
30+
- name: Cache dependencies
31+
uses: Swatinem/rust-cache@v2
32+
33+
- name: Check formatting
34+
run: cargo fmt --all -- --check
35+
36+
- name: Check clippy
37+
run: cargo clippy --all-targets --all-features -- -D warnings
38+
39+
- name: Run tests
40+
run: cargo test --all-features -- --test-threads=1
41+
42+
- name: Check documentation
43+
run: cargo doc --no-deps --all-features
44+
45+
publish:
46+
name: Publish to crates.io
47+
runs-on: ubuntu-latest
48+
needs: test
49+
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v4
53+
54+
- name: Install Rust toolchain
55+
uses: dtolnay/rust-toolchain@stable
56+
with:
57+
toolchain: stable
58+
59+
- name: Cache dependencies
60+
uses: Swatinem/rust-cache@v2
61+
62+
- name: Verify package can be built
63+
run: cargo build --release
64+
65+
- name: Verify package can be packaged
66+
run: cargo package --allow-dirty
67+
68+
- name: Check if CARGO_REGISTRY_TOKEN is available
69+
run: |
70+
if [ -z "${{ secrets.CARGO_REGISTRY_TOKEN }}" ]; then
71+
echo "CARGO_REGISTRY_TOKEN secret is not set in repository settings"
72+
exit 1
73+
fi
74+
75+
- name: Publish to crates.io
76+
run: cargo publish --allow-dirty --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
77+
env:
78+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
79+
80+
create-release:
81+
name: Create GitHub Release
82+
runs-on: ubuntu-latest
83+
needs: publish
84+
if: startsWith(github.ref, 'refs/tags/v')
85+
steps:
86+
- name: Checkout code
87+
uses: actions/checkout@v4
88+
89+
- name: Extract version from tag
90+
id: extract_version
91+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
92+
93+
- name: Create GitHub Release
94+
uses: actions/create-release@v1
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
97+
with:
98+
tag_name: ${{ github.ref }}
99+
release_name: "dig-gossip v${{ steps.extract_version.outputs.VERSION }}"
100+
body: |
101+
## dig-gossip v${{ steps.extract_version.outputs.VERSION }}
102+
103+
DIG Network P2P gossip — peer discovery, connection management, and message routing with Plumtree, ERLAY, priority lanes, compact blocks, Dandelion++, and relay fallback.
104+
105+
### Installation
106+
```toml
107+
[dependencies]
108+
dig-gossip = "${{ steps.extract_version.outputs.VERSION }}"
109+
```
110+
111+
See the [README](https://github.com/DIG-Network/dig-gossip/blob/main/README.md) for usage instructions.
112+
draft: false
113+
prerelease: false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

0 commit comments

Comments
 (0)