@@ -511,6 +511,10 @@ async fn process_orders_keep_alive(
511511 // even if the responder advanced after propagating the keep-alive. This should reduce
512512 // false InvalidOrIncomplete classifications and unnecessary bans.
513513 // Backward-compatibility: legacy peers ignore `expected_roots` optional field.
514+ // TODO(tests/serde-interop):
515+ // - Old -> new: new node tolerates missing `expected_roots` (#[serde(default)]).
516+ // - New -> old: legacy peer ignores `expected_roots` without failing.
517+ // - New -> new: exact path works when history is present (serve/apply Delta landing on the expected to-root).
514518 let current_req = OrdermatchRequest :: SyncPubkeyOrderbookState {
515519 pubkey : from_pubkey. clone ( ) ,
516520 trie_roots : from_roots_by_pair,
@@ -1187,6 +1191,7 @@ fn process_sync_pubkey_orderbook_state(
11871191 if let Some ( exp) = expected_roots. as_ref ( ) {
11881192 if exp. len ( ) != trie_roots. len ( ) || trie_roots. keys ( ) . any ( |pair| !exp. contains_key ( pair) ) {
11891193 // TODO(rate-limit/ban): accept at most one SyncPubkeyOrderbookState per peer we sent a KeepAlive to.
1194+ // Note: this is considered as an unavailable error on the requester side, not InvalidOrIncomplete. But this is fine for now.
11901195 return ERR ! (
11911196 "Rejecting SyncPubkeyOrderbookState for pubkey {}: expected_roots keys mismatch vs trie_roots (expected_roots: {}, trie_roots: {})" ,
11921197 pubkey,
@@ -1231,13 +1236,9 @@ fn process_sync_pubkey_orderbook_state(
12311236 // dedup (~60s) so alternate-source retries are effective within the history window.
12321237
12331238 let delta_result = match pubkey_state. order_pairs_trie_state_history . get ( & pair) {
1234- Some ( history) => DeltaOrFullTrie :: from_history (
1235- history,
1236- from_root,
1237- * target_root,
1238- & orderbook. memory_db ,
1239- order_getter,
1240- ) ,
1239+ Some ( history) => {
1240+ DeltaOrFullTrie :: from_history ( history, from_root, * target_root, & orderbook. memory_db , order_getter)
1241+ } ,
12411242 None => get_full_trie ( target_root, & orderbook. memory_db , order_getter) . map ( DeltaOrFullTrie :: FullTrie ) ,
12421243 } ;
12431244
0 commit comments