Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions crates/tx-cache/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,17 +419,16 @@ pub struct TxKey {

/// The query object keys for the bundle GET endpoint.
///
/// Cursor for the `block_number_index` GSI: paginates bundles for a given
/// target block in score-descending order.
/// Cursor for paginating bundles for the caller's permissioned target block
/// in score-descending order. The target block is server-derived from the
/// caller's slot permission and is not part of this cursor.
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct BundleKey {
/// The bundle id.
pub id: Uuid,
/// The bundle score.
pub score: u64,
/// The bundle's target block number.
pub target_block_number: u64,
}

/// The query object keys for the order GET endpoint.
Expand Down Expand Up @@ -589,9 +588,9 @@ mod tests {

let cache_response = CacheResponse::paginated(
BundleList { bundles: vec![dummy_bundle_with_id(uuid)] },
BundleKey { id: uuid, score: 100, target_block_number: 42 },
BundleKey { id: uuid, score: 100 },
);
let expected_json = r#"{"bundles":[{"id":"5932d4bb-58d9-41a9-851d-8dd7f04ccc33","bundle":{"txs":[],"blockNumber":"0x0","replacementUuid":"5932d4bb-58d9-41a9-851d-8dd7f04ccc33"}}],"nextCursor":{"id":"5932d4bb-58d9-41a9-851d-8dd7f04ccc33","score":100,"targetBlockNumber":42}}"#;
let expected_json = r#"{"bundles":[{"id":"5932d4bb-58d9-41a9-851d-8dd7f04ccc33","bundle":{"txs":[],"blockNumber":"0x0","replacementUuid":"5932d4bb-58d9-41a9-851d-8dd7f04ccc33"}}],"nextCursor":{"id":"5932d4bb-58d9-41a9-851d-8dd7f04ccc33","score":100}}"#;
let serialized = serde_json::to_string(&cache_response).unwrap();
assert_eq!(serialized, expected_json);
let deserialized =
Expand Down