Skip to content

Commit f27d1cd

Browse files
committed
✨ feat: bootstrap aelf rust sdk alpha workspace
0 parents  commit f27d1cd

107 files changed

Lines changed: 20083 additions & 0 deletions

File tree

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
pull_request:
8+
9+
jobs:
10+
msrv:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: dtolnay/rust-toolchain@1.85.0
15+
- uses: Swatinem/rust-cache@v2
16+
- name: msrv
17+
run: cargo check --workspace --all-targets --all-features --locked
18+
19+
test:
20+
runs-on: ubuntu-latest
21+
needs: msrv
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: dtolnay/rust-toolchain@stable
25+
- uses: Swatinem/rust-cache@v2
26+
- name: install cargo-audit
27+
run: cargo install cargo-audit --locked
28+
- name: fmt
29+
run: cargo fmt --all -- --check
30+
- name: clippy
31+
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
32+
- name: audit
33+
run: cargo audit
34+
- name: examples
35+
run: cargo check --workspace --examples
36+
- name: test
37+
run: cargo test --workspace --all-targets

.github/workflows/publish.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dry_run:
7+
description: "Run cargo publish in dry-run mode"
8+
required: true
9+
default: true
10+
type: boolean
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
publish:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: dtolnay/rust-toolchain@stable
21+
- uses: Swatinem/rust-cache@v2
22+
- name: verify workspace publish
23+
if: inputs.dry_run
24+
run: cargo publish --workspace --dry-run --locked
25+
- name: publish workspace crates
26+
if: ${{ !inputs.dry_run }}
27+
env:
28+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
29+
run: cargo publish --workspace --locked --token "$CARGO_REGISTRY_TOKEN"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target
2+
.DS_Store

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Changelog
2+
3+
All notable changes to `aelf-sdk.rust` will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.1.0-alpha.0] - 2026-03-10
9+
10+
### Added
11+
12+
- Workspace-based Rust SDK layout with `aelf-sdk`, `aelf-client`, `aelf-contract`, `aelf-crypto`, `aelf-keystore`, and `aelf-proto`
13+
- Typed wrappers for Zero, Token, Election, Vote, CrossChain, and AEDPoS contracts
14+
- Dynamic contract calls backed by on-chain descriptor loading
15+
- JS-compatible keystore import/export with fixture compatibility
16+
- Public-node examples and verification flows for readonly calls and raw transactions
17+
- Provider mock support and offline network-layer regression tests
18+
- A manual GitHub Actions publish workflow for crates.io dry-runs and releases
19+
20+
### Changed
21+
22+
- Sensitive key material now uses zeroization and redacted `Debug` output
23+
- `HttpProvider` now retries transient `5xx` and transport failures with configurable exponential backoff
24+
- Dynamic contract descriptor cache now uses a bounded 64-entry LRU cache
25+
- Public DTOs and contract APIs now include rustdoc coverage
26+
- The workspace now declares Rust `1.85` as its MSRV and CI enforces it with a dedicated toolchain job
27+
28+
### Fixed
29+
30+
- Public-node compatibility for `send_transaction`, `create_raw_transaction`, and dynamic JSON address/hash normalization
31+
- Null-safe deserialization for transaction result payloads returned by public nodes
32+
- JS / C# keystore compatibility edge cases, including `dkLen` alias handling
33+
- `wiremock` is pinned to the latest pre-`let-chain` release so test-only dependencies do not inflate the SDK MSRV

CONTRIBUTING.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Contributing
2+
3+
## Development Setup
4+
5+
1. Install Rust `1.85` or newer.
6+
2. Clone the repository and fetch submodules if your workflow requires them.
7+
3. Build the workspace:
8+
9+
```bash
10+
cargo check --workspace
11+
```
12+
13+
## Required Checks
14+
15+
Run these commands before opening a PR:
16+
17+
```bash
18+
cargo fmt --all
19+
cargo +1.85.0 check --workspace --all-targets --all-features --locked
20+
cargo clippy --workspace --all-targets --all-features -- -D warnings
21+
cargo audit
22+
cargo check --workspace --examples
23+
cargo test --workspace
24+
```
25+
26+
Optional local-node validation:
27+
28+
```bash
29+
cargo test -p aelf-sdk --test local_node -- --ignored
30+
```
31+
32+
## Repository Layout
33+
34+
- `crates/aelf-sdk`: public facade crate
35+
- `crates/aelf-client`: HTTP client, DTOs, transaction builder
36+
- `crates/aelf-contract`: typed and dynamic contract bindings
37+
- `crates/aelf-crypto`: wallet, signing, address utilities
38+
- `crates/aelf-keystore`: JS-compatible keystore support
39+
- `crates/aelf-proto`: generated protobuf bindings
40+
- `examples/`: runnable examples wired into `aelf-sdk`
41+
42+
## Pull Requests
43+
44+
- Keep changes scoped to one problem or feature.
45+
- Add or update tests for every behavior change.
46+
- Document public API additions with rustdoc.
47+
- Update `README.md`, `README.zh.md`, or `CHANGELOG.md` when user-facing behavior changes.
48+
- Keep the documented MSRV at Rust `1.85` and preserve the hard `cargo +1.85.0 check --workspace --all-targets --all-features --locked` CI gate.
49+
50+
## Commit Style
51+
52+
Use Conventional Commit / `git-cz` style messages in English and keep the matching emoji prefix used by the repository workflow.

0 commit comments

Comments
 (0)