Skip to content

Commit

Permalink
refactor(ci): remove redundant version checks in vorpal.yaml
Browse files Browse the repository at this point in the history
Removed unnecessary version checks for cargo, rustc, nickel, and protoc in the GitHub Actions workflow file to streamline the CI process.

feat(worker): add async signature decoding

Introduced an async function `decode_signature` to handle the decoding of source data signatures in a non-blocking manner. Updated the `run` function to utilize this new async decoding method, improving error handling and code readability.
  • Loading branch information
erikreinert committed Sep 13, 2024
1 parent 9cd1133 commit c430d82
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/vorpal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ jobs:
run: ./script/debian.sh "dev"

- run: ./script/dev.sh
- run: ./script/dev.sh cargo --version
- run: ./script/dev.sh rustc --version
- run: ./script/dev.sh nickel --version
- run: ./script/dev.sh protoc --version

- uses: actions/cache/save@v4
with:
Expand Down
11 changes: 9 additions & 2 deletions worker/src/package/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ async fn send_error(tx: &Sender<Result<BuildResponse, Status>>, message: String)
anyhow::bail!(message);
}

async fn decode_signature(source_data_signature: String) -> Result<Vec<u8>, String> {
tokio::task::spawn_blocking(move || hex::decode(source_data_signature))
.await
.map_err(|e| format!("failed to join decode task: {:?}", e))?
.map_err(|e| format!("failed to decode signature: {:?}", e))
}

pub async fn run(
request: Request<Streaming<BuildRequest>>,
tx: &Sender<Result<BuildResponse, Status>>,
Expand Down Expand Up @@ -164,9 +171,9 @@ pub async fn run(

let verifying_key = VerifyingKey::<Sha256>::new(public_key);

let signature_decode = match hex::decode(source_data_signature.clone()) {
let signature_decode = match decode_signature(source_data_signature.clone()).await {
Ok(signature) => signature,
Err(e) => return send_error(tx, format!("failed to decode signature: {:?}", e)).await,
Err(e) => return send_error(tx, e).await,
};

let signature =
Expand Down

0 comments on commit c430d82

Please sign in to comment.