Repository: ergoplatform/sigma-rust (language: rust)

Issue:
Run `cargo audit` on CI
https://docs.rs/crate/cargo-audit/0.15.0


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
index 5e3600464..20d820625 100644
--- a/.github/workflows/android.yml
+++ b/.github/workflows/android.yml
@@ -12,7 +12,7 @@ on:
 
 jobs:
   android:
-    name: run Android tests
+    name: Android tests
     runs-on: macos-latest
     steps:
       - name: checkout
diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml
new file mode 100644
index 000000000..6f265fe8d
--- /dev/null
+++ b/.github/workflows/audit.yml
@@ -0,0 +1,17 @@
+name: Security audit 
+
+on:
+  push:
+    paths: 
+      - '**/Cargo.toml'
+      - '**/Cargo.lock'
+
+jobs:
+  cargo_audit:
+    name: cargo audit
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v1
+      - uses: actions-rs/audit-check@v1
+        with:
+          token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c80609799..fbf0d1ffe 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -11,39 +11,6 @@ on:
       - synchronize
 
 jobs:
-  rustfmt:
-    name: rustfmt
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v2
-      - uses: actions-rs/toolchain@v1
-        with:
-          toolchain: stable
-          components: rustfmt
-          override: true
-      # Ensure all code has been formatted with rustfmt
-      - name: Check formatting
-        uses: actions-rs/cargo@v1
-        with:
-          command: fmt
-          args: --all -- --check --color always
-
-  clippy:
-    name: clippy
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v2
-      - uses: actions-rs/toolchain@v1
-        with:
-          toolchain: stable
-          components: clippy
-          override: true
-      # Ensure all code has been formatted with rustfmt
-      - name: Check with Clippy
-        uses: actions-rs/clippy-check@v1
-        with:
-          token: ${{ secrets.GITHUB_TOKEN }}
-          args: --all-features -- -D warnings
 
   build_wo_default_features:
     name: Build without default features
@@ -61,7 +28,7 @@ jobs:
           args: --no-default-features --manifest-path ergo-lib/Cargo.toml
 
   test:
-    name: Test on ${{ matrix.os }}
+    name: Tests on ${{ matrix.os }}
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
@@ -106,24 +73,3 @@ jobs:
           github-token: ${{ secrets.GITHUB_TOKEN }}
           path-to-lcov: ./lcov.info
         
-  doc-links:
-    name: Intra-documentation links
-    runs-on: ubuntu-latest
-
-    steps:
-      - uses: actions/checkout@v2
-      - uses: actions-rs/toolchain@v1
-        with:
-          toolchain: stable
-          override: true
-      - name: cargo fetch
-        uses: actions-rs/cargo@v1
-        with:
-          command: fetch
-      # Ensure intra-documentation links all resolve correctly
-      # Requires #![deny(broken_intra_doc_links)] in crate.
-      - name: Check intra-doc links
-        uses: actions-rs/cargo@v1
-        with:
-          command: doc
-          args: --document-private-items
diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml
new file mode 100644
index 000000000..df28b0c1e
--- /dev/null
+++ b/.github/workflows/formatting.yml
@@ -0,0 +1,29 @@
+name: Formatting
+
+on:
+  push:
+    branches:
+      - master
+      - develop
+  pull_request:
+    types:
+      - opened
+      - synchronize
+
+jobs:
+
+  rustfmt:
+    name: rustfmt
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions-rs/toolchain@v1
+        with:
+          toolchain: stable
+          components: rustfmt
+          override: true
+      - name: Check formatting
+        uses: actions-rs/cargo@v1
+        with:
+          command: fmt
+          args: --all -- --check --color always
diff --git a/.github/workflows/intra_doc.yml b/.github/workflows/intra_doc.yml
new file mode 100644
index 000000000..76c9afac8
--- /dev/null
+++ b/.github/workflows/intra_doc.yml
@@ -0,0 +1,33 @@
+name: Documentation
+
+on:
+  push:
+    branches:
+      - master
+      - develop
+  pull_request:
+    types:
+      - opened
+      - synchronize
+
+jobs:
+  doc-links:
+    name: Check intra-documentation links
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions-rs/toolchain@v1
+        with:
+          toolchain: stable
+          override: true
+      - name: cargo fetch
+        uses: actions-rs/cargo@v1
+        with:
+          command: fetch
+      # Ensure intra-documentation links all resolve correctly
+      # Requires #![deny(broken_intra_doc_links)] in crate.
+      - name: Check intra-doc links
+        uses: actions-rs/cargo@v1
+        with:
+          command: doc
+          args: --document-private-items
diff --git a/.github/workflows/lints.yml b/.github/workflows/lints.yml
new file mode 100644
index 000000000..965e150e7
--- /dev/null
+++ b/.github/workflows/lints.yml
@@ -0,0 +1,29 @@
+name: Linter
+
+on:
+  push:
+    branches:
+      - master
+      - develop
+  pull_request:
+    types:
+      - opened
+      - synchronize
+
+jobs:
+  clippy:
+    name: clippy (linter)
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions-rs/toolchain@v1
+        with:
+          toolchain: stable
+          components: clippy
+          override: true
+      - name: Check with Clippy
+        uses: actions-rs/clippy-check@v1
+        with:
+          token: ${{ secrets.GITHUB_TOKEN }}
+          args: --all-features -- -D warnings
+
diff --git a/.github/workflows/scheduled_audit.yml b/.github/workflows/scheduled_audit.yml
new file mode 100644
index 000000000..e63d813fb
--- /dev/null
+++ b/.github/workflows/scheduled_audit.yml
@@ -0,0 +1,14 @@
+name: Scheduled security audit 
+
+on:
+  schedule:
+    - cron: '0 0 * * *'
+
+jobs:
+  cargo_audit:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v1
+      - uses: actions-rs/audit-check@v1
+        with:
+          token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/bindings/ergo-lib-jni/Cargo.toml b/bindings/ergo-lib-jni/Cargo.toml
index 66db463d5..b7f8afdb0 100644
--- a/bindings/ergo-lib-jni/Cargo.toml
+++ b/bindings/ergo-lib-jni/Cargo.toml
@@ -13,8 +13,7 @@ crate-type = ["staticlib", "cdylib"]
 path = "src/main/rust/lib.rs"
 
 [dependencies]
-jni = "0.17.0"
-failure = "0.1"
+jni = "0.19.0"
 log = "0.4"
 ergo-lib = {version = "^0.13.0", path = "../../ergo-lib"}
 ergo-lib-c-core = {version = "^0.13.0", path = "../ergo-lib-c-core"}
diff --git a/bindings/ergo-lib-jni/src/main/rust/exception.rs b/bindings/ergo-lib-jni/src/main/rust/exception.rs
index b54acc8d8..a3f4ac7f1 100644
--- a/bindings/ergo-lib-jni/src/main/rust/exception.rs
+++ b/bindings/ergo-lib-jni/src/main/rust/exception.rs
@@ -12,12 +12,11 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-use failure::Error;
 use jni::JNIEnv;
 use std::any::Any;
 use std::thread;
 
-type ExceptionResult<T> = thread::Result<Result<T, Error>>;
+type ExceptionResult<T> = thread::Result<Result<T, jni::errors::Error>>;
 
 // Returns value or "throws" exception. `error_val` is returned, because exception will be thrown
 // at the Java side. So this function should be used only for the `panic::catch_unwind` result.
@@ -57,18 +56,12 @@ fn throw(env: &JNIEnv, description: &str) {
     let exception = match env.find_class("java/lang/RuntimeException") {
         Ok(val) => val,
         Err(e) => {
-            error!(
-                "Unable to find 'RuntimeException' class: {}",
-                e.description()
-            );
+            error!("Unable to find 'RuntimeException' class: {:?}", e);
             return;
         }
     };
     if let Err(e) = env.throw_new(exception, description) {
-        error!(
-            "Unable to find 'RuntimeException' class: {}",
-            e.description()
-        );
+        error!("Unable to find 'RuntimeException' class: {:?}", e);
     }
 }
 


Test patch:
diff --git a/.github/workflows/js_tests.yml b/.github/workflows/js_tests.yml
index 455285120..01cb605c1 100644
--- a/.github/workflows/js_tests.yml
+++ b/.github/workflows/js_tests.yml
@@ -12,7 +12,7 @@ on:
 
 jobs:
   js_tests:
-    name: run JS tests
+    name: run JS tests and publish alpha versions
     runs-on: ubuntu-latest
     env:
       HAS_NPM_TOKEN: ${{ secrets.NPM_TOKEN != '' }}
diff --git a/.github/workflows/wasm_test.yml b/.github/workflows/wasm_test.yml
index 73d45ac86..ec5d8e8dc 100644
--- a/.github/workflows/wasm_test.yml
+++ b/.github/workflows/wasm_test.yml
@@ -12,7 +12,7 @@ on:
 
 jobs:
   wasm_tests:
-    name: run WASM tests
+    name: WASM tests
     runs-on: ubuntu-latest
     defaults:
       run: