diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..0708e29 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,26 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: 'bug' +assignees: '' + +--- + +**Describe the bug** + + +**To Reproduce** + + +**Expected behavior** + + +**Build environment** + - BDK tag/commit: + - OS+version: + - Rust/Cargo version: + - Rust/Cargo target: + +**Additional context** + diff --git a/.github/ISSUE_TEMPLATE/summer_project.md b/.github/ISSUE_TEMPLATE/summer_project.md new file mode 100644 index 0000000..a693283 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/summer_project.md @@ -0,0 +1,77 @@ +--- +name: Summer of Bitcoin Project +about: Template to suggest a new https://www.summerofbitcoin.org/ project. +title: '' +labels: 'summer-of-bitcoin' +assignees: '' + +--- + + + +**Description** + + +**Expected Outcomes** + + +**Resources** + + + + + + +**Skills Required** + + + + + + + +**Mentor(s)** + + +**Difficulty** + + +**Competency Test (optional)** + + + + + + + diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..3dbc5fd --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,30 @@ + + +### Description + + + +### Notes to the reviewers + + + +### Checklists + +#### All Submissions: + +* [ ] I've signed all my commits +* [ ] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) +* [ ] I ran `cargo fmt` and `cargo clippy` before committing + +#### New Features: + +* [ ] I've added tests for the new feature +* [ ] I've added docs for the new feature +* [ ] I've updated `CHANGELOG.md` + +#### Bugfixes: + +* [ ] This pull request breaks the existing API +* [ ] I've added tests to reproduce the issue which are now passing +* [ ] I'm linking the issue being fixed by this PR diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 0000000..6143cca --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,19 @@ +name: Audit + +on: + push: + paths: + - '**/Cargo.toml' + - '**/Cargo.lock' + schedule: + - cron: '0 0 * * 0' # Once per week + +jobs: + + security_audit: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/audit-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml new file mode 100644 index 0000000..40c5e97 --- /dev/null +++ b/.github/workflows/cont_integration.yml @@ -0,0 +1,61 @@ +on: [push, pull_request] + +name: CI + +jobs: + + build-test: + name: Build and test + runs-on: ubuntu-latest + strategy: + matrix: + rust: + - version: 1.60.0 # STABLE + clippy: true + - version: 1.56.1 # MSRV + steps: + - name: checkout + uses: actions/checkout@v2 + - name: Generate cache key + run: echo "${{ matrix.rust.version }} ${{ matrix.features }}" | tee .cache_key + - name: cache + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} + - name: Set default toolchain + run: rustup default ${{ matrix.rust.version }} + - name: Set profile + run: rustup set profile minimal + - name: Add clippy + if: ${{ matrix.rust.clippy }} + run: rustup component add clippy + - name: Update toolchain + run: rustup update + - name: Build + run: cargo build + - name: Clippy + if: ${{ matrix.rust.clippy }} + run: cargo clippy --all-targets -- -D warnings + - name: Test + run: cargo test + + fmt: + name: Rust fmt + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set default toolchain + run: rustup default nightly + - name: Set profile + run: rustup set profile minimal + - name: Add rustfmt + run: rustup component add rustfmt + - name: Update toolchain + run: rustup update + - name: Check fmt + run: cargo fmt --all -- --config format_code_in_doc_comments=true --check diff --git a/src/lib.rs b/src/lib.rs index 19ad4a6..95243cb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -586,7 +586,7 @@ impl TxBuilder { } } if !&self.data.is_empty() { - tx_builder.add_data(&self.data.as_slice()); + tx_builder.add_data(self.data.as_slice()); } tx_builder @@ -693,7 +693,7 @@ mod test { .drain_wallet() .drain_to(drain_to_address.clone()); //dbg!(&tx_builder); - assert_eq!(tx_builder.drain_wallet, true); + assert!(tx_builder.drain_wallet); assert_eq!(tx_builder.drain_to, Some(drain_to_address)); let psbt = tx_builder.finish(&test_wallet).unwrap(); @@ -712,7 +712,7 @@ mod test { .get(0) .unwrap() .value; - assert_eq!(input_value, 50_000 as u64); + assert_eq!(input_value, 50_000_u64); // confirm one output to correct address with all sats - fee assert_eq!(psbt.outputs.len(), 1); @@ -732,6 +732,6 @@ mod test { Address::from_str("tb1ql7w62elx9ucw4pj5lgw4l028hmuw80sndtntxt").unwrap() ); let output_value = psbt.unsigned_tx.output.get(0).cloned().unwrap().value; - assert_eq!(output_value, 49_890 as u64); // input - fee + assert_eq!(output_value, 49_890_u64); // input - fee } }