mirror of
https://github.com/block/buzz.git
synced 2026-11-09 10:51:42 +00:00
fix(workflows): execute immutable signed revisions
Co-authored-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz> Signed-off-by: Logan Johnson <loganj@squareup.com>
This commit is contained in:
@@ -326,16 +326,9 @@ pub async fn trigger_workflow(
|
||||
// Resolve the current signed definition at trigger time. The relay binds
|
||||
// authorization and execution to this exact revision and rejects a stale
|
||||
// result if an update races this command.
|
||||
let prior = query_relay(
|
||||
&state,
|
||||
&[serde_json::json!({
|
||||
"kinds": [30620],
|
||||
"#d": [workflow_id.clone()],
|
||||
"limit": 1
|
||||
})],
|
||||
)
|
||||
.await?;
|
||||
let definition_event_id = current_workflow_revision(&prior)?;
|
||||
let revision: nostr::Event =
|
||||
get_relay_json(&state, &format!("/workflows/{workflow_id}/revision")).await?;
|
||||
let definition_event_id = revision.id.to_hex();
|
||||
let builder = events::build_workflow_trigger(&workflow_id, &definition_event_id)?;
|
||||
let result = submit_event(builder, &state).await?;
|
||||
trigger_wire_from_message(workflow_id, &result.message)
|
||||
|
||||
Reference in New Issue
Block a user