Skip to content

Commit 1fb0b5d

Browse files
prestwichclaude
andcommitted
chore: bump ajj 0.3.4 → 0.7.0
ResponsePayload changed from enum (Success/Failure) to newtype struct wrapping Result. Update all call sites and adapt subscription notification code to use the new permit-based API. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 62f3e6d commit 1fb0b5d

6 files changed

Lines changed: 19 additions & 15 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ signet-rpc = { version = "0.16.0", path = "crates/rpc" }
5656
init4-bin-base = { version = "0.19.0", features = ["alloy"] }
5757

5858
# ajj
59-
ajj = { version = "0.3.4" }
59+
ajj = { version = "0.7.0" }
6060

6161
# trevm
6262
trevm = { version = "0.34.0", features = ["full_env_cfg"] }

crates/rpc/src/debug/endpoints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ where
9090
tracing::debug!(tx_index = idx, tx_hash = ?tx.hash(), "Traced transaction");
9191
}
9292

93-
ResponsePayload::Success(frames)
93+
ResponsePayload(Ok(frames))
9494
}
9595
.instrument(span);
9696

@@ -163,7 +163,7 @@ where
163163

164164
let res = response_tri!(crate::debug::tracer::trace(trevm, &opts, tx_info)).0;
165165

166-
ResponsePayload::Success(res)
166+
ResponsePayload(Ok(res))
167167
}
168168
.instrument(span);
169169

crates/rpc/src/eth/endpoints.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ where
474474

475475
let execution_result = response_tri!(trevm.call().map_err(EvmErrored::into_error)).0;
476476

477-
ResponsePayload::Success(execution_result)
477+
ResponsePayload(Ok(execution_result))
478478
}
479479
.instrument(span);
480480

@@ -498,14 +498,14 @@ where
498498
normalize_gas_stateless(&mut params.0, max_gas);
499499

500500
await_handler!(@response_option hctx.spawn_with_ctx(|hctx| async move {
501-
let res = match run_call(hctx, params, ctx).await {
502-
ResponsePayload::Success(res) => res,
503-
ResponsePayload::Failure(err) => return ResponsePayload::Failure(err),
501+
let res = match run_call(hctx, params, ctx).await.0 {
502+
Ok(res) => res,
503+
Err(err) => return ResponsePayload(Err(err)),
504504
};
505505

506506
match res {
507507
ExecutionResult::Success { output, .. } => {
508-
ResponsePayload::Success(output.data().clone())
508+
ResponsePayload(Ok(output.data().clone()))
509509
}
510510
ExecutionResult::Revert { output, .. } => {
511511
ResponsePayload::internal_error_with_message_and_obj(
@@ -577,7 +577,7 @@ where
577577
let (estimate, _) = response_tri!(trevm.estimate_gas().map_err(EvmErrored::into_error));
578578

579579
match estimate {
580-
EstimationResult::Success { limit, .. } => ResponsePayload::Success(U64::from(limit)),
580+
EstimationResult::Success { limit, .. } => ResponsePayload(Ok(U64::from(limit))),
581581
EstimationResult::Revert { reason, .. } => {
582582
ResponsePayload::internal_error_with_message_and_obj(
583583
"execution reverted".into(),

crates/rpc/src/inspect/endpoints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ where
3030
);
3131
};
3232

33-
ResponsePayload::Success(output)
33+
ResponsePayload(Ok(output))
3434
};
3535

3636
await_handler!(@response_option hctx.spawn_blocking(task))

crates/rpc/src/interest/subs.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ impl SubscriptionTask {
211211
) {
212212
let SubscriptionTask { id, filter, token, mut notifs } = self;
213213

214-
let Some(sender) = ajj_ctx.notifications() else { return };
214+
if !ajj_ctx.notifications_enabled() {
215+
return;
216+
};
215217

216218
// Buffer for notifications to be sent to the client
217219
let mut notif_buffer = filter.empty_sub_buffer();
@@ -230,7 +232,9 @@ impl SubscriptionTask {
230232
if !notif_buffer.is_empty() {
231233
// NB: we reserve half the capacity to avoid blocking other
232234
// usage. This is a heuristic and can be adjusted as needed.
233-
sender.reserve_many(min(sender.max_capacity() / 2, notif_buffer.len())).await
235+
ajj_ctx
236+
.permit_many(min(ajj_ctx.notification_capacity() / 2, notif_buffer.len()))
237+
.await
234238
} else {
235239
// If the notification buffer is empty, just never return
236240
pending().await
@@ -263,7 +267,7 @@ impl SubscriptionTask {
263267
permits = permit_fut => {
264268
let _guard = span.enter();
265269
// channel closed
266-
let Ok(permits) = permits else {
270+
let Some(permits) = permits else {
267271
trace!("channel to client closed");
268272
break
269273
};
@@ -291,7 +295,7 @@ impl SubscriptionTask {
291295
trace!(?item, "failed to serialize notification");
292296
continue
293297
};
294-
permit.send(brv);
298+
let _ = permit.send(brv);
295299
}
296300
}
297301
notif_res = notifs.recv() => {

crates/rpc/src/signet/endpoints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ where
6262

6363
response_tri!(trevm.drive_bundle(&mut driver).map_err(|e| e.into_error()));
6464

65-
ResponsePayload::Success(driver.into_response())
65+
ResponsePayload(Ok(driver.into_response()))
6666
};
6767

6868
let task = async move {

0 commit comments

Comments
 (0)