Skip to content

Commit 4889e51

Browse files
committed
chore: initial commit
0 parents  commit 4889e51

Some content is hidden

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

43 files changed

+27509
-0
lines changed

.cursor/general.mdc

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
description: Expert Engineer
3+
globs: *.rs, *.ts, *.js
4+
alwaysApply: false
5+
---
6+
You're an expert engineer proficient in Rust, Typescript, and thoughtboi for AI agent ideas
7+
8+
Your software principles are:
9+
1. Write professional code using best practices in any language.
10+
2. Write concise code foremost. Always analyze if something can be removed/reworked to reduce lines of code.
11+
3. Write tests in separate tests file to declutter workspace.
12+
4. Always prioritize performance, readable code.
13+
5. Always write relevant documentation that informs any future reader. Keep it up to date.
14+
15+
For blueprints, always check if something exists on the config. If it doesn't, do not assume it is on the config. Instead add it to a `Context` struct or another helper struct and read new config parameters from environment variables.
16+
```
17+
#[non_exhaustive]
18+
#[derive(Debug, Clone, Default)]
19+
pub struct GadgetConfiguration {
20+
/// HTTP RPC endpoint for host restaking network (Tangle / Ethereum (Eigenlayer or Symbiotic)).
21+
pub http_rpc_endpoint: String,
22+
/// WS RPC endpoint for host restaking network (Tangle / Ethereum (Eigenlayer or Symbiotic)).
23+
pub ws_rpc_endpoint: String,
24+
/// The keystore URI for the gadget
25+
pub keystore_uri: String,
26+
/// Data directory exclusively for this gadget
27+
///
28+
/// This will be `None` if the blueprint manager was not provided a base directory.
29+
pub data_dir: Option<PathBuf>,
30+
/// The list of bootnodes to connect to
31+
#[cfg(feature = "networking")]
32+
pub bootnodes: Vec<Multiaddr>,
33+
/// The port to bind the network to
34+
#[cfg(feature = "networking")]
35+
pub network_bind_port: u16,
36+
/// The type of protocol the gadget is executing on.
37+
pub protocol: Protocol,
38+
/// Protocol-specific settings
39+
pub protocol_settings: ProtocolSettings,
40+
/// Whether the gadget is in test mode
41+
pub test_mode: bool,
42+
/// Whether to enable mDNS
43+
#[cfg(feature = "networking")]
44+
pub enable_mdns: bool,
45+
/// Whether to enable Kademlia
46+
#[cfg(feature = "networking")]
47+
pub enable_kademlia: bool,
48+
/// The target number of peers to connect to
49+
#[cfg(feature = "networking")]
50+
pub target_peer_count: u32,
51+
}
52+
```

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "cargo" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "daily"
12+
open-pull-requests-limit: 5

.github/workflows/ci.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: rust-validation-${{ github.head_ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
fmt:
16+
name: Rustfmt
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout Code
20+
uses: actions/checkout@v4
21+
22+
- uses: dtolnay/rust-toolchain@nightly
23+
with:
24+
toolchain: nightly-2024-10-13
25+
components: rustfmt
26+
27+
- name: Check Formatting
28+
run: cargo fmt -- --check
29+
30+
lint:
31+
timeout-minutes: 120
32+
name: Clippy
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: checkout code
36+
uses: actions/checkout@v4
37+
38+
- name: Install Foundry
39+
uses: foundry-rs/foundry-toolchain@v1
40+
with:
41+
version: nightly
42+
43+
- name: Verify Forge installation
44+
run: forge --version
45+
46+
- name: Install Solidity Dependencies
47+
run: forge soldeer update -d
48+
49+
- uses: dtolnay/rust-toolchain@nightly
50+
with:
51+
toolchain: nightly-2024-10-13
52+
components: clippy
53+
54+
- uses: swatinem/rust-cache@v2
55+
with:
56+
cache-on-failure: "true"
57+
58+
- name: Forge build
59+
run: forge update && forge build
60+
61+
- uses: taiki-e/github-actions/free-device-space@main
62+
63+
- name: Run Clippy
64+
run: cargo clippy --tests --examples -- -D warnings
65+
66+
test:
67+
timeout-minutes: 90
68+
name: Unit tests
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: checkout code
72+
uses: actions/checkout@v4
73+
74+
- name: Install Foundry
75+
uses: foundry-rs/foundry-toolchain@v1
76+
with:
77+
version: nightly
78+
79+
- name: Verify Forge installation
80+
run: forge --version
81+
82+
- name: Install Solidity Dependencies
83+
run: forge soldeer update -d
84+
85+
- uses: dtolnay/rust-toolchain@nightly
86+
with:
87+
toolchain: nightly-2024-10-13
88+
components: clippy
89+
90+
- uses: swatinem/rust-cache@v2
91+
with:
92+
cache-on-failure: "true"
93+
94+
- uses: taiki-e/install-action@v2
95+
with:
96+
tool: nextest
97+
98+
- name: Forge build
99+
run: forge update && forge build
100+
101+
- uses: taiki-e/github-actions/free-device-space@main
102+
103+
- name: tests
104+
run: cargo nextest run

.github/workflows/foundry.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Foundry CI
2+
3+
on: workflow_dispatch
4+
5+
env:
6+
FOUNDRY_PROFILE: ci
7+
8+
jobs:
9+
foundry-check:
10+
strategy:
11+
matrix:
12+
os: [ubuntu-latest]
13+
fail-fast: true
14+
15+
name: Foundry project
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
submodules: recursive
21+
22+
- name: Install Foundry
23+
uses: foundry-rs/foundry-toolchain@v1
24+
with:
25+
version: nightly
26+
27+
- name: Run Forge build
28+
run: |
29+
forge --version
30+
forge build --sizes
31+
id: build
32+
33+
- name: Run Forge tests
34+
run: |
35+
forge test -vvv
36+
id: test

0 commit comments

Comments
 (0)