0.7.47-1FE5
This commit is contained in:
@@ -658,7 +658,7 @@ fn build_success_dex_decode_replay_ledger(
|
||||
fn count_effective_decoded_events(decoded_events: &[crate::DexDecodedEventDto]) -> usize {
|
||||
let mut count = 0_usize;
|
||||
for event in decoded_events {
|
||||
if is_instruction_audit_event(event) {
|
||||
if is_replay_audit_only_event(event) {
|
||||
continue;
|
||||
}
|
||||
count += 1;
|
||||
@@ -666,8 +666,17 @@ fn count_effective_decoded_events(decoded_events: &[crate::DexDecodedEventDto])
|
||||
return count;
|
||||
}
|
||||
|
||||
fn is_instruction_audit_event(event: &crate::DexDecodedEventDto) -> bool {
|
||||
return event.event_kind.ends_with(".instruction_audit");
|
||||
fn is_replay_audit_only_event(event: &crate::DexDecodedEventDto) -> bool {
|
||||
if event.event_kind.ends_with(".instruction_audit") {
|
||||
return true;
|
||||
}
|
||||
if event.event_kind.ends_with("_audit") {
|
||||
return true;
|
||||
}
|
||||
if event.event_kind == crate::UPSTREAM_REGISTRY_INSTRUCTION_MATCH_EVENT_KIND {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
fn count_distinct_decoded_event_token_mints(decoded_events: &[crate::DexDecodedEventDto]) -> usize {
|
||||
@@ -759,6 +768,20 @@ mod tests {
|
||||
assert!(ledger.can_skip_decode());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ledger_treats_audit_suffix_events_as_audit_only() {
|
||||
let events = vec![
|
||||
make_decoded_event("openbook_v2.settle_funds_audit", Some("mint-a"), Some("mint-b")),
|
||||
make_decoded_event("openbook_v2.order_place_audit", None, None),
|
||||
];
|
||||
let ledger = super::build_success_dex_decode_replay_ledger(1, "sig", events.as_slice())
|
||||
.expect("ledger must build");
|
||||
assert_eq!(ledger.event_count, 2);
|
||||
assert_eq!(ledger.status_reason.as_deref(), Some("decode completed and certified for skip: event_count=2, effective_event_count=0, instruction_audit_count=2, distinct_token_mint_count=2"));
|
||||
assert!(!ledger.force_replay_required);
|
||||
assert!(ledger.can_skip_decode());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ledger_keeps_multiple_effective_events_unsafe() {
|
||||
let events = vec![
|
||||
|
||||
Reference in New Issue
Block a user