diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..fe4e450 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,40 @@ +name: Build + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + toolchain: [ nightly, stable, 1.77.0 ] + name: [ linux, windows, macos ] + include: + - name: linux + os: ubuntu-latest + - name: windows + os: windows-latest + - name: macos + os: macos-latest + steps: + - uses: ilammy/setup-nasm@v1 + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + + - name: Build all targets + run: cargo build --all-targets diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..9b07948 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,26 @@ +name: Check format + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + format: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: rustfmt + + - name: Format + run: cargo fmt -- --check diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..8a88b10 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,28 @@ +name: Check lint + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + lint: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: clippy + + - name: Lint + run: cargo clippy --all-targets -- -D warnings diff --git a/.github/workflows/checks.yml b/.github/workflows/test.yml similarity index 62% rename from .github/workflows/checks.yml rename to .github/workflows/test.yml index 428e48d..4d316ce 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Code checks +name: Run tests on: push: @@ -10,40 +10,15 @@ env: CARGO_TERM_COLOR: always jobs: - lint: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - components: clippy - - name: Lint - run: cargo clippy --all-targets -- -D warnings - - format: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - uses: actions/checkout@v4 - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - components: rustfmt - - name: Format - run: cargo fmt --all -- --check - test_and_coverage: runs-on: ubuntu-latest - steps: - name: Checkout repository uses: actions/checkout@v4 with: submodules: true - - name: Setup rust toolchain + - name: Setup Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: components: llvm-tools-preview diff --git a/Cargo.lock b/Cargo.lock index cc8a1b4..b0762f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -346,7 +346,7 @@ dependencies = [ [[package]] name = "bp-derive" -version = "0.11.0-beta.9" +version = "0.11.0-beta.9.1" dependencies = [ "amplify", "bp-consensus", @@ -360,7 +360,7 @@ dependencies = [ [[package]] name = "bp-electrum" -version = "0.11.0-beta.9.2" +version = "0.11.0-beta.9.3" dependencies = [ "amplify", "bp-std", @@ -391,7 +391,7 @@ dependencies = [ [[package]] name = "bp-invoice" -version = "0.11.0-beta.9" +version = "0.11.0-beta.9.1" dependencies = [ "amplify", "bech32", @@ -417,7 +417,7 @@ dependencies = [ [[package]] name = "bp-std" -version = "0.11.0-beta.9" +version = "0.11.0-beta.9.1" dependencies = [ "amplify", "bp-consensus", @@ -434,7 +434,7 @@ dependencies = [ [[package]] name = "bp-wallet" -version = "0.11.0-beta.9" +version = "0.11.0-beta.9.1" dependencies = [ "amplify", "bp-electrum", @@ -660,7 +660,7 @@ dependencies = [ [[package]] name = "descriptors" -version = "0.11.0-beta.9" +version = "0.11.0-beta.9.1" dependencies = [ "amplify", "bp-derive", @@ -1197,7 +1197,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -1455,7 +1455,7 @@ dependencies = [ [[package]] name = "psbt" -version = "0.11.0-beta.9" +version = "0.11.0-beta.9.1" dependencies = [ "amplify", "base64", @@ -1622,7 +1622,7 @@ dependencies = [ [[package]] name = "rgb-invoice" -version = "0.11.0-beta.9" +version = "0.11.0-beta.9.1" dependencies = [ "amplify", "baid64", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "rgb-std" -version = "0.11.0-beta.9" +version = "0.11.0-beta.9.1" dependencies = [ "aluvm", "amplify", diff --git a/Cargo.toml b/Cargo.toml index 93d0179..313fd58 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ authors = [ "Nicola Busanello ", ] edition = "2021" -rust-version = "1.75.0" +rust-version = "1.77.0" repository = "https://github.com/RGB-WG/rgb-tests" homepage = "https://github.com/RGB-WG/rgb-tests" license = "Apache-2.0" diff --git a/README.md b/README.md index 6636604..6648b86 100644 --- a/README.md +++ b/README.md @@ -110,15 +110,20 @@ The GitHub organizations of submodule repositories are: A helper to change the revision for all submodules is available in the form of the `sub-rev-change.sh` script. -As an example, it can be used to update all submodules to the `master` branch +As an example, it can be used to point all submodules to the `master` branch with: ```sh -./sub-rev-change.sh --branch master +./submodules-rev.sh change --branch master ``` See the help for more details on its usage: ```sh -./sub-rev-change.sh --help +./submodules-rev.sh help +``` + +To check which revision is checked-out for each submodule run: +```sh +./submodules-rev.sh status ``` ### PRs showing bugs diff --git a/bp-electrum-client b/bp-electrum-client index 459f0a0..a660268 160000 --- a/bp-electrum-client +++ b/bp-electrum-client @@ -1 +1 @@ -Subproject commit 459f0a0bd54201fdf3893e65b21813348ad5c821 +Subproject commit a66026874b948479b14aa5f01629c677ae005abc diff --git a/bp-std b/bp-std index 9fedc14..f81848a 160000 --- a/bp-std +++ b/bp-std @@ -1 +1 @@ -Subproject commit 9fedc1415c1781e20a7517196ffd7be24cb6fec2 +Subproject commit f81848a0751e073c92881c2d6c9c06c87e7a58bd diff --git a/bp-wallet b/bp-wallet index 139d936..429c853 160000 --- a/bp-wallet +++ b/bp-wallet @@ -1 +1 @@ -Subproject commit 139d9363d95c7e7a9c9594ef987e40a20bcf90a6 +Subproject commit 429c853ad424d0d4e08b6b496b35fe8a4b64a321 diff --git a/rgb-std b/rgb-std index 2cadb29..b374468 160000 --- a/rgb-std +++ b/rgb-std @@ -1 +1 @@ -Subproject commit 2cadb29fb4789d7398168bb83a4f834de5909956 +Subproject commit b3744689e7ff2603b7093afdea09db50d032c5ca diff --git a/sub-rev-change.sh b/submodules-rev.sh similarity index 79% rename from sub-rev-change.sh rename to submodules-rev.sh index 0c4cc37..39376c8 100755 --- a/sub-rev-change.sh +++ b/submodules-rev.sh @@ -42,22 +42,58 @@ _war() { # CLI handling help() { - echo "$0 [-h] [-f] [-r ] (-b) " + echo "$0 " + echo "" + echo "commands:" + echo " status show all submodule revs" + echo " change change submodule revs" + echo " help show this help message" +} + +change_help() { + echo "$0 change [-h] [-f] [-r ] (-b) " echo "" echo "options:" - echo " -h --help show this help message" echo " -b --branch change to the specified branch" echo " -f --fetch fetch provided remote (or all if none specified)" echo " -r --remote remote to be used" echo " -t --tag change to the specified tag" } +status() { + git submodule foreach --quiet \ + 'echo "" $(git rev-list -n1 HEAD) $sm_path $(git describe --all | sed "s,^\(tags\|remotes\|heads\)/,(,;s/$/)/")' +} + +if [ -z "$1" ]; then + help + _die "please provide a command" +fi + +case $1 in + help) + help + exit 0 + ;; + status) + status + exit 0 + ;; + change) + shift + ;; + *) + help + _die "unsupported command \"$1\"" + ;; +esac + while [ -n "$1" ]; do case $1 in -h | --help) - help - exit 0 - ;; + change_help + exit 0 + ;; -b | --branch) BRANCH="$2" shift @@ -74,8 +110,8 @@ while [ -n "$1" ]; do shift ;; *) - help - _die "unsupported argument \"$1\"" + change_help + _die "unsupported option \"$1\"" ;; esac shift @@ -83,6 +119,7 @@ done # check a branch or tag have been specified if [ -z "$BRANCH" ] && [ -z "$TAG" ]; then + change_help _die "please specify a branch or a tag to switch to" fi if [ -n "$BRANCH" ] && [ -n "$TAG" ]; then diff --git a/tests/fixtures/bc:0bc3024ce6404cd7aea387debde687d9e8731228e16b04b4eefda7283069f1c3.yaml b/tests/fixtures/bc_0bc3024ce6404cd7aea387debde687d9e8731228e16b04b4eefda7283069f1c3.yaml similarity index 100% rename from tests/fixtures/bc:0bc3024ce6404cd7aea387debde687d9e8731228e16b04b4eefda7283069f1c3.yaml rename to tests/fixtures/bc_0bc3024ce6404cd7aea387debde687d9e8731228e16b04b4eefda7283069f1c3.yaml diff --git a/tests/fixtures/bc:3652d9fea802cb051f671455cbd7472e3bce2c440a4e54fa4321107037dfaff0.yaml b/tests/fixtures/bc_3652d9fea802cb051f671455cbd7472e3bce2c440a4e54fa4321107037dfaff0.yaml similarity index 100% rename from tests/fixtures/bc:3652d9fea802cb051f671455cbd7472e3bce2c440a4e54fa4321107037dfaff0.yaml rename to tests/fixtures/bc_3652d9fea802cb051f671455cbd7472e3bce2c440a4e54fa4321107037dfaff0.yaml diff --git a/tests/fixtures/bc:a5c3085efe8dfdba0fa0e11d81bf90cdcac27c0af496c4de1a2fd9659948ffce.yaml b/tests/fixtures/bc_a5c3085efe8dfdba0fa0e11d81bf90cdcac27c0af496c4de1a2fd9659948ffce.yaml similarity index 100% rename from tests/fixtures/bc:a5c3085efe8dfdba0fa0e11d81bf90cdcac27c0af496c4de1a2fd9659948ffce.yaml rename to tests/fixtures/bc_a5c3085efe8dfdba0fa0e11d81bf90cdcac27c0af496c4de1a2fd9659948ffce.yaml diff --git a/tests/fixtures/bc:c269055b7750a234087c11acd7a408172cb84d8fc6af0ded42d8a8cbea6712e9.yaml b/tests/fixtures/bc_c269055b7750a234087c11acd7a408172cb84d8fc6af0ded42d8a8cbea6712e9.yaml similarity index 100% rename from tests/fixtures/bc:c269055b7750a234087c11acd7a408172cb84d8fc6af0ded42d8a8cbea6712e9.yaml rename to tests/fixtures/bc_c269055b7750a234087c11acd7a408172cb84d8fc6af0ded42d8a8cbea6712e9.yaml diff --git a/tests/fixtures/bc:d077ea7e3a55a215893a18e82cb03fda0f50619893e4aee0ba70b014e6d63248.yaml b/tests/fixtures/bc_d077ea7e3a55a215893a18e82cb03fda0f50619893e4aee0ba70b014e6d63248.yaml similarity index 100% rename from tests/fixtures/bc:d077ea7e3a55a215893a18e82cb03fda0f50619893e4aee0ba70b014e6d63248.yaml rename to tests/fixtures/bc_d077ea7e3a55a215893a18e82cb03fda0f50619893e4aee0ba70b014e6d63248.yaml diff --git a/tests/fixtures/bc:d84c37b6c6616184c454c815d970505bed9b3a3723a4445dd1289dc708bc80b3.yaml b/tests/fixtures/bc_d84c37b6c6616184c454c815d970505bed9b3a3723a4445dd1289dc708bc80b3.yaml similarity index 100% rename from tests/fixtures/bc:d84c37b6c6616184c454c815d970505bed9b3a3723a4445dd1289dc708bc80b3.yaml rename to tests/fixtures/bc_d84c37b6c6616184c454c815d970505bed9b3a3723a4445dd1289dc708bc80b3.yaml diff --git a/tests/transfers.rs b/tests/transfers.rs index a71d300..daff23b 100644 --- a/tests/transfers.rs +++ b/tests/transfers.rs @@ -478,7 +478,7 @@ fn rbf_transfer() { } #[test] -#[ignore = "fix needed"] +#[ignore = "fix needed"] // https://github.com/RGB-WG/rgb-core/issues/283 fn same_transfer_twice_no_update_witnesses() { initialize(); @@ -545,7 +545,7 @@ fn same_transfer_twice_no_update_witnesses() { } #[test] -#[ignore = "fix needed"] +#[ignore = "fix needed"] // https://github.com/RGB-WG/rgb-core/issues/283 fn same_transfer_twice_update_witnesses() { initialize(); @@ -1045,7 +1045,7 @@ fn receive_from_unbroadcasted_transfer_to_blinded() { consignment: &'cons IndexedConsignment<'cons, TRANSFER>, fallback: &'a AnyResolver, } - impl<'a, 'cons, const TRANSFER: bool> ResolveWitness for OffchainResolver<'a, 'cons, TRANSFER> { + impl ResolveWitness for OffchainResolver<'_, '_, TRANSFER> { fn resolve_pub_witness( &self, witness_id: XWitnessId, diff --git a/tests/utils/helpers.rs b/tests/utils/helpers.rs index fc1eb44..734818f 100644 --- a/tests/utils/helpers.rs +++ b/tests/utils/helpers.rs @@ -26,7 +26,7 @@ enum Filter<'w> { WalletTentative(&'w RgbWallet>), } -impl<'w> AssignmentsFilter for Filter<'w> { +impl AssignmentsFilter for Filter<'_> { fn should_include(&self, outpoint: impl Into, id: Option) -> bool { match self { Filter::Wallet(wallet) => wallet @@ -41,7 +41,7 @@ impl<'w> AssignmentsFilter for Filter<'w> { } } } -impl<'w> Filter<'w> { +impl Filter<'_> { fn comment(&self, outpoint: XOutpoint) -> &'static str { let outpoint = outpoint .into_bp() @@ -499,8 +499,8 @@ fn _get_wallet( println!("wallet dir: {wallet_dir:?}"); let xpub_account = match wallet_account { - WalletAccount::Private(ref xpriv_account) => &xpriv_account.to_xpub_account(), - WalletAccount::Public(ref xpub_account) => xpub_account, + WalletAccount::Private(ref xpriv_account) => xpriv_account.to_xpub_account(), + WalletAccount::Public(ref xpub_account) => xpub_account.clone(), }; const OPRET_KEYCHAINS: [Keychain; 3] = [ Keychain::INNER, diff --git a/tests/validation.rs b/tests/validation.rs index 12128ba..6049d92 100644 --- a/tests/validation.rs +++ b/tests/validation.rs @@ -192,8 +192,9 @@ fn validate_consignment_generate() { for tx in txes { let txid = tx.txid().to_string(); let witness_id = XWitnessId::from_str(&txid).unwrap(); + let normalized_witness_id = witness_id.to_string().replace(":", "_"); let yaml = serde_yaml::to_string(&tx).unwrap(); - let yaml_path = format!("tests/fixtures/{witness_id}.yaml"); + let yaml_path = format!("tests/fixtures/{normalized_witness_id}.yaml"); std::fs::write(&yaml_path, yaml).unwrap(); println!("written tx: {witness_id}"); } @@ -208,7 +209,8 @@ fn get_consignment_from_yaml(fname: &str) -> Transfer { } fn get_tx(witness_id: &str) -> (Tx, XWitnessId) { - let yaml_path = format!("tests/fixtures/{witness_id}.yaml"); + let normalized_witness_id = witness_id.replace(":", "_"); + let yaml_path = format!("tests/fixtures/{normalized_witness_id}.yaml"); let file = std::fs::File::open(yaml_path).unwrap(); let tx: Tx = serde_yaml::from_reader(file).unwrap(); let xwitness_id = XWitnessId::from_str(witness_id).unwrap();