-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from 589labs/develop
Initial Core
- Loading branch information
Showing
60 changed files
with
18,925 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
echo 'Running all pre-commit checks:' | ||
cargo fmt | ||
cargo test --no-default-features --features core,models,utils | ||
cargo test --all-features | ||
cargo clippy --fix --allow-staged | ||
cargo doc --no-deps | ||
#cargo audit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
## Expected Behavior | ||
<!--- Tell us what should happen --> | ||
|
||
## Actual Behavior | ||
<!--- Tell us what happens instead of the expected behavior --> | ||
|
||
## Steps to Reproduce the Problem | ||
<!--- Provide the steps that resulted in the unexpected behavior --> | ||
1. | ||
1. | ||
1. | ||
|
||
## Minimal Reproducable Example | ||
<!--- Provide a minimal reproducible example to test against --> | ||
```rust | ||
|
||
``` | ||
|
||
## Specifications | ||
<!--- Provide details on the platform, version, flags --> | ||
- Version: | ||
- Platform: | ||
- Flags: | ||
|
||
## Detailed Description | ||
<!--- Provide a detailed description of the issue --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
## High Level Overview of Change | ||
|
||
<!-- | ||
Please include a summary/list of the changes. | ||
If too broad, please consider splitting into multiple PRs. | ||
If a relevant Asana task, please link it here. | ||
--> | ||
|
||
### Context of Change | ||
|
||
<!-- | ||
Please include the context of a change. | ||
If a bug fix, when was the bug introduced? What was the behavior? | ||
If a new feature, why was this architecture chosen? What were the alternatives? | ||
If a refactor, how is this better than the previous implementation? | ||
If there is a design document for this feature, please link it here. | ||
--> | ||
|
||
### Type of Change | ||
|
||
<!-- | ||
Please check relevant options, delete irrelevant ones. | ||
--> | ||
|
||
- [ ] Bug fix (non-breaking change which fixes an issue) | ||
- [ ] New feature (non-breaking change which adds functionality) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
- [ ] Refactor (non-breaking change that only restructures code) | ||
- [ ] Tests (You added tests for code that already exists, or your new feature included in this PR) | ||
- [ ] Documentation Updates | ||
- [ ] Release | ||
|
||
## Before / After | ||
|
||
<!-- | ||
If just refactoring / back-end changes, this can be just an in-English description of the change at a technical level. | ||
If a UI change, screenshots should be included. | ||
--> | ||
|
||
## Test Plan | ||
|
||
<!-- | ||
Please describe the tests that you ran to verify your changes and provide instructions so that others can reproduce. | ||
--> | ||
|
||
<!-- | ||
## Future Tasks | ||
For future tasks related to PR. | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
name: Audit | ||
|
||
jobs: | ||
audit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions-rs/audit-check@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
name: Quality | ||
|
||
jobs: | ||
clippy_check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- run: rustup component add clippy | ||
- uses: actions-rs/clippy-check@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: --all-features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
name: Unit | ||
|
||
jobs: | ||
build_and_test: | ||
name: xrpl-rust | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --release --all-features | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --release --no-default-features --features core,models | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --all-features | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --no-default-features --features core,models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [[Incomplete]] | ||
- Support for no_std environments | ||
## [[Unreleased]] | ||
### Modified | ||
- Use the core hex library | ||
### Added | ||
- Initial Implementation |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @sephynox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# Contributing | ||
|
||
## Setup Your Development Environment | ||
|
||
If you want to contribute code to `xrpl-rust`, the following sections describe | ||
how to set up your developer environment. | ||
|
||
### Setup the Rust/Cargo Environment | ||
|
||
Getting started with Rust and `xrpl-rust` is easy. To install `rust` and | ||
`cargo` follow these steps: | ||
|
||
* Install [`rust`](https://doc.rust-lang.org/cargo/getting-started/installation.html): | ||
|
||
curl https://sh.rustup.rs -sSf | sh | ||
|
||
* Update rust using `rustup` and install a few development dependencies: | ||
|
||
// Rustup | ||
rustup update | ||
rustup component add rustfmt | ||
rustup component add clippy-preview | ||
|
||
// Cargo | ||
cargo install cargo-audit | ||
|
||
### Git `pre-commit` Hooks | ||
|
||
To run linting and other checks, `xrpl-rust` uses | ||
[`pre-commit`](https://pre-commit.com/). | ||
|
||
> This should already be setup thanks to | ||
[`cargo-husky`](https://github.com/rhysd/cargo-husky) | ||
|
||
### Run the Formatter | ||
|
||
To run the linter: | ||
|
||
```bash | ||
cargo fmt | ||
``` | ||
|
||
> Note that the formatter will automatically run via pre-commit hook | ||
### Run the Linter | ||
|
||
To run the linter: | ||
|
||
```bash | ||
cargo clippy | ||
``` | ||
|
||
> Note that the linter will automatically run via pre-commit hook | ||
### Running Tests | ||
|
||
To run tests: | ||
|
||
```bash | ||
# Test the core feature for no_std | ||
cargo test --no-default-features --features core,models,utils | ||
# Test all features enabled | ||
cargo test --all-features | ||
``` | ||
|
||
> Note that the tests will automatically run via pre-commit hook | ||
### Generate Documentation | ||
|
||
You can see the complete reference documentation at | ||
[`xrpl-rust` docs](https://docs.rs/xrpl). | ||
|
||
You can also generate them locally using `cargo`: | ||
|
||
```bash | ||
cargo doc | ||
``` | ||
|
||
### Audit Crates | ||
|
||
To test dependencies for known security advisories, run: | ||
|
||
```bash | ||
cargo audit | ||
``` | ||
|
||
### Submitting Bugs | ||
|
||
Bug reports are welcome. Please create an issue using the default issue | ||
template. Fill in *all* information including a minimal reproducible | ||
code example. Every function in the library comes with such an example | ||
and can adapted to look like the following for an issue report: | ||
|
||
```rust | ||
// Required Dependencies | ||
use xrpl::core::keypairs::derive_keypair; | ||
use xrpl::core::keypairs::exceptions::XRPLKeypairsException; | ||
|
||
// Provided Variables | ||
let seed: &str = "sn259rEFXrQrWyx3Q7XneWcwV6dfL"; | ||
let validator: bool = false; | ||
|
||
// Expected Result | ||
let tuple: (String, String) = ( | ||
"ED60292139838CB86E719134F848F055057CA5BDA61F5A529729F1697502D53E1C".into(), | ||
"ED009F66528611A0D400946A01FA01F8AF4FF4C1D0C744AE3F193317DCA77598F1".into(), | ||
); | ||
|
||
// Operation | ||
match derive_keypair(seed, validator) { | ||
Ok(seed) => assert_eq!(tuple, seed), | ||
Err(e) => match e { | ||
XRPLKeypairsException::InvalidSignature => panic!("Fails unexpectedly"), | ||
_ => (), | ||
}, | ||
}; | ||
``` | ||
> This format makes it easy for maintainers to replicate and test against. | ||
## Release Process | ||
|
||
### Editing the Code | ||
|
||
* Your changes should have unit and/or integration tests. | ||
* New functionality should include a minimal reproducible sample. | ||
* Your changes should pass the linter. | ||
* Your code should pass all the actions on GitHub. | ||
* Open a PR against `main` and ensure that all CI passes. | ||
* Get a full code review from one of the maintainers. | ||
* Merge your changes. | ||
|
||
### Release | ||
|
||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
[package] | ||
name = "xrpl-rust" | ||
version = "0.1.1" | ||
edition = "2018" | ||
authors = ["Tanveer Wahid <tan@wahid.email>"] | ||
description = "A 100% Rust library to interact with the XRPL" | ||
readme = "README.md" | ||
license = "ISC" | ||
repository = "https://github.com/589labs/xrpl-rust" | ||
|
||
keywords = ["xrpl", "no_std"] | ||
categories = ["no-std"] | ||
|
||
[package.metadata.release] | ||
no-dev-version = true | ||
tag-name = "{{version}}" | ||
|
||
[lib] | ||
name = "xrpl" | ||
crate-type = ["lib"] | ||
|
||
[dependencies] | ||
lazy_static = "1.4.0" | ||
sha2 = "0.9.8" | ||
rand_hc = "0.3.1" | ||
ripemd160 = "0.9.1" | ||
ed25519-dalek = "1.0.1" | ||
indexmap = { version = "1.7.0", features = ["serde"] } | ||
strum = { version = "0.22.0", default-features = false } | ||
strum_macros = { version = "0.22.0", default-features = false } | ||
regex = { version = "1.5.4", default-features = false } | ||
num-bigint = { version = "0.4.2", default-features = false } | ||
rust_decimal = { version = "1.17.0", default-features = false, features = ["serde"] } | ||
chrono = { version = "0.4.19", default-features = false, features = ["alloc", "clock"] } | ||
hex = { version = "0.4.3", default-features = false, features = ["alloc"] } | ||
bs58 = { version = "0.4.0", default-features = false, features = ["check", "alloc"] } | ||
serde = { version = "1.0.130", default-features = false, features = ["derive"] } | ||
serde_json = { version = "1.0.68", default-features = false, features = ["alloc"] } | ||
rand = { version = "0.8.4", default-features = false, features = ["getrandom"] } | ||
secp256k1 = { version = "0.20.3", default-features = false, features = ["alloc"] } | ||
|
||
[dev-dependencies] | ||
criterion = "0.3.5" | ||
cargo-husky = { version = "1.5.0", default-features = false, features = ["user-hooks"] } | ||
|
||
[[bench]] | ||
name = "benchmarks" | ||
harness = false | ||
|
||
[features] | ||
default = ["std", "core", "models", "utils"] | ||
models = ["core"] | ||
core = ["utils"] | ||
utils = [] | ||
std = [ | ||
"rand/std", | ||
"regex/std", | ||
"chrono/std", | ||
"num-bigint/std", | ||
"rand/std_rng", | ||
"hex/std", | ||
"rust_decimal/std", | ||
"bs58/std", | ||
"serde/std", | ||
"indexmap/std", | ||
"secp256k1/std" | ||
] |
Oops, something went wrong.