qvm: event57 first trace chain
Browse files- docs/ASSET_PIPELINE_TODO.md +6 -0
- docs/FINDINGS.md +3 -0
- docs/PROVISIONAL_TODO.md +6 -0
- docs/RESEARCH_LEDGER.md +5 -0
- docs/REVERSE_ENGINEERING_TODO.md +7 -1
- docs/research/QVM_AIM_TRACE_BATCH.md +51 -0
- docs/research/QVM_ALLOCATION_SPREAD_BATCH.md +3 -0
- docs/research/QVM_EVENT57_TRACE_CHAIN.md +7 -0
- docs/research/README.md +6 -0
- docs/research/qvm-event57-trace-chain.json +0 -0
- scripts/analyze_qvm_event57_trace_chain.py +44 -0
- scripts/test_qvm_event57_trace_chain.py +26 -0
docs/ASSET_PIPELINE_TODO.md
CHANGED
|
@@ -550,3 +550,9 @@ Research progress: RE-622 [report](research/QVM_PELLET_ROTATION.md); remaining n
|
|
| 550 |
|
| 551 |
|
| 552 |
Research progress: RE-623 [report](research/QVM_PELLET_ENDPOINT.md); remaining native/content/runtime/platform scope stays open.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 550 |
|
| 551 |
|
| 552 |
Research progress: RE-623 [report](research/QVM_PELLET_ENDPOINT.md); remaining native/content/runtime/platform scope stays open.
|
| 553 |
+
|
| 554 |
+
|
| 555 |
+
The [RE-615–624 aim/trace batch](research/QVM_AIM_TRACE_BATCH.md) recovers complete bounded aim, trace preparation, point rotation and the event57 first-pellet trace boundary. Its next ten tasks prioritize trace results/rewind/restoration, contact/damage and full pellet aggregation. Original reference and the full Rust/Bevy/Solari macOS/Linux/native/content/network/rendering scope remain open.
|
| 556 |
+
|
| 557 |
+
|
| 558 |
+
Research progress: RE-624 [report](research/QVM_EVENT57_TRACE_CHAIN.md); remaining native/content/runtime/platform scope stays open.
|
docs/FINDINGS.md
CHANGED
|
@@ -905,3 +905,6 @@ Bounded qagame paths recover bomb-plant/inactivity correction requests, direct f
|
|
| 905 |
|
| 906 |
|
| 907 |
**RE-623 — Signed pellet seed perturbation and endpoint construction:** 295018 mutates its argument seed using signed>>27, scales rotated offsets by an absolute sine and constructs the pellet endpoint without touching global RNG. [Evidence](research/QVM_PELLET_ENDPOINT.md).
|
|
|
|
|
|
|
|
|
|
|
|
| 905 |
|
| 906 |
|
| 907 |
**RE-623 — Signed pellet seed perturbation and endpoint construction:** 295018 mutates its argument seed using signed>>27, scales rotated offsets by an absolute sine and constructs the pellet endpoint without touching global RNG. [Evidence](research/QVM_PELLET_ENDPOINT.md).
|
| 908 |
+
|
| 909 |
+
|
| 910 |
+
**RE-624 — Allocated event57 to first pellet native trace boundary:** Actual285840 now composes source allocation/event57/quantized direction/global RNG with295018 first-pellet preparation and the reached291641 trace boundary. [Evidence](research/QVM_EVENT57_TRACE_CHAIN.md).
|
docs/PROVISIONAL_TODO.md
CHANGED
|
@@ -870,3 +870,9 @@ Research progress: RE-622 [report](research/QVM_PELLET_ROTATION.md); remaining n
|
|
| 870 |
|
| 871 |
|
| 872 |
Research progress: RE-623 [report](research/QVM_PELLET_ENDPOINT.md); remaining native/content/runtime/platform scope stays open.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 870 |
|
| 871 |
|
| 872 |
Research progress: RE-623 [report](research/QVM_PELLET_ENDPOINT.md); remaining native/content/runtime/platform scope stays open.
|
| 873 |
+
|
| 874 |
+
|
| 875 |
+
The [RE-615–624 aim/trace batch](research/QVM_AIM_TRACE_BATCH.md) recovers complete bounded aim, trace preparation, point rotation and the event57 first-pellet trace boundary. Its next ten tasks prioritize trace results/rewind/restoration, contact/damage and full pellet aggregation. Original reference and the full Rust/Bevy/Solari macOS/Linux/native/content/network/rendering scope remain open.
|
| 876 |
+
|
| 877 |
+
|
| 878 |
+
Research progress: RE-624 [report](research/QVM_EVENT57_TRACE_CHAIN.md); remaining native/content/runtime/platform scope stays open.
|
docs/RESEARCH_LEDGER.md
CHANGED
|
@@ -797,3 +797,8 @@ Actual293732 now calls recovered290493 with its local forward/global muzzle, the
|
|
| 797 |
## 2026-10-20 — RE-623 Signed pellet seed perturbation and endpoint construction (separate task commit)
|
| 798 |
|
| 799 |
295018 mutates its argument seed using signed>>27, scales rotated offsets by an absolute sine and constructs the pellet endpoint without touching global RNG. 36 seed/direction/index fixtures match independent exact f32 endpoint oracles; all256 byte seeds are audited against a signed xor-shift model. Full suite: 984 tests pass. Report regenerates byte-identically (1004112 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 797 |
## 2026-10-20 — RE-623 Signed pellet seed perturbation and endpoint construction (separate task commit)
|
| 798 |
|
| 799 |
295018 mutates its argument seed using signed>>27, scales rotated offsets by an absolute sine and constructs the pellet endpoint without touching global RNG. 36 seed/direction/index fixtures match independent exact f32 endpoint oracles; all256 byte seeds are audited against a signed xor-shift model. Full suite: 984 tests pass. Report regenerates byte-identically (1004112 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
|
| 800 |
+
|
| 801 |
+
|
| 802 |
+
## 2026-10-20 — RE-624 Allocated event57 to first pellet native trace boundary (separate task commit)
|
| 803 |
+
|
| 804 |
+
Actual285840 now composes source allocation/event57/quantized direction/global RNG with295018 first-pellet preparation and the reached291641 trace boundary. 13 chains independently check all event-record words, quantization/global RNG, dynamic argument pointers, pellet endpoints and no fabricated hit/parent return. Full suite: 988 tests pass. Report regenerates byte-identically (1470270 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
|
docs/REVERSE_ENGINEERING_TODO.md
CHANGED
|
@@ -882,7 +882,7 @@ Purpose: turn the supplied installation into an evidence-backed specification of
|
|
| 882 |
- [x] RE-612 Shot body table copies and direction frame construction ([report](research/QVM_SHOT_FRAME.md)).
|
| 883 |
|
| 884 |
|
| 885 |
-
- [ ] RE-614
|
| 886 |
|
| 887 |
|
| 888 |
- [x] RE-613 Shared shot handler basis muzzle and pending aim handoff ([report](research/QVM_SHARED_SHOT_BASIS.md)).
|
|
@@ -913,3 +913,9 @@ Purpose: turn the supplied installation into an evidence-backed specification of
|
|
| 913 |
|
| 914 |
|
| 915 |
- [x] RE-623 Signed pellet seed perturbation and endpoint construction ([report](research/QVM_PELLET_ENDPOINT.md)).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 882 |
- [x] RE-612 Shot body table copies and direction frame construction ([report](research/QVM_SHOT_FRAME.md)).
|
| 883 |
|
| 884 |
|
| 885 |
+
- [ ] RE-614 Partially advanced by RE-615–624:complete290493 aim,293732 trace handoff and295018 first-pellet preparation are recovered. Trace results/rewind/restoration, full20-pellet contact/damage, query/linking, base/grenade lifecycle and original runtime reference remain open. Follow the [current next ten tasks](research/QVM_AIM_TRACE_BATCH.md#next-ten-concrete-tasks); retain wider native/content/network/rendering/platform work.
|
| 886 |
|
| 887 |
|
| 888 |
- [x] RE-613 Shared shot handler basis muzzle and pending aim handoff ([report](research/QVM_SHARED_SHOT_BASIS.md)).
|
|
|
|
| 913 |
|
| 914 |
|
| 915 |
- [x] RE-623 Signed pellet seed perturbation and endpoint construction ([report](research/QVM_PELLET_ENDPOINT.md)).
|
| 916 |
+
|
| 917 |
+
|
| 918 |
+
- [ ] RE-625 Recover trace result/rewind/restoration and contact/damage consumers, full20-pellet loop and aggregation, then query/base/grenade lifecycle and original reference/Rust platform integration. See the [next ten tasks](research/QVM_AIM_TRACE_BATCH.md#next-ten-concrete-tasks).
|
| 919 |
+
|
| 920 |
+
|
| 921 |
+
- [x] RE-624 Allocated event57 to first pellet native trace boundary ([report](research/QVM_EVENT57_TRACE_CHAIN.md)).
|
docs/research/QVM_AIM_TRACE_BATCH.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Aim, pellet preparation and trace boundaries: RE-615–624
|
| 2 |
+
|
| 3 |
+
Ten separately checked tasks extend the [allocation and shot-preparation batch](QVM_ALLOCATION_SPREAD_BATCH.md). The shared aim function is now recovered through its endpoint, and the event57 path reaches its first trace boundary with actual source allocation and pellet preparation. Neither path establishes a hit, damage, full shot return or playable Rust behavior.
|
| 4 |
+
|
| 5 |
+
| Task | Recovered scope | Evidence |
|
| 6 |
+
| --- | --- | --- |
|
| 7 |
+
| RE-615 | Airborne local44 adjustment and three aim trig pairs | [Aim trig](QVM_AIM_TRIG.md) |
|
| 8 |
+
| RE-616 | Conditional extra offsets and additional RNG draws | [Extra offsets](QVM_AIM_EXTRA_OFFSETS.md) |
|
| 9 |
+
| RE-617 | Endpoint writes and selected origin/forward aliases | [Endpoint](QVM_AIM_ENDPOINT.md) |
|
| 10 |
+
| RE-618 | Complete290493 source control flow with bounded rejection | [Whole aim](QVM_COMPLETE_AIM.md) |
|
| 11 |
+
| RE-619 |293732 basis→complete aim→291641 argument handoff | [Shared handler aim](QVM_SHARED_SHOT_AIM.md) |
|
| 12 |
+
| RE-620 |291641 prelude, candidate bound edits and first native trace request | [Trace request](QVM_SHOT_TRACE_REQUEST.md) |
|
| 13 |
+
| RE-621 | Complete61092 point rotation and alias ordering | [Rotation helper](QVM_ROTATE_POINT.md) |
|
| 14 |
+
| RE-622 |295018 muzzle/width and indexed18-degree pellet rotation | [Pellet rotation](QVM_PELLET_ROTATION.md) |
|
| 15 |
+
| RE-623 | Signed local seed, absolute-sine scale and pellet endpoint | [Pellet endpoint](QVM_PELLET_ENDPOINT.md) |
|
| 16 |
+
| RE-624 |285840 allocated event57→first295018 pellet→291641 boundary | [Event57 chain](QVM_EVENT57_TRACE_CHAIN.md) |
|
| 17 |
+
|
| 18 |
+
## Findings for the rewrite
|
| 19 |
+
|
| 20 |
+
The source applies the airborne multiplier before sampling and can consume an extra pair of RNG draws after trig. Weapon IDs, flags and strict timestamp comparisons select those draws. Seed consumption is part of parity: the shared aim rejection loop and optional jitter must not be replaced with a distribution that consumes a different sequence.
|
| 21 |
+
|
| 22 |
+
The complete aim driver now follows the original branches and calls within290493, including rejected candidates, extra offsets and endpoint writes. It agrees with the separately checked stages. Zero global RNG state exhausts the harness budget without changing output; the driver does not pretend the function returned. The endpoint uses supplied forward/right/up vectors in source f32 order without added normalization.
|
| 23 |
+
|
| 24 |
+
Shared293732 uses a first-match weapon lookup but290493 reads the current packed slot. Explicit mismatch fixtures retain this distinction without establishing those states as legal. Actual source caller pointers now carry the local forward and global muzzle into the complete aim function, then into a pending291641 trace call.
|
| 25 |
+
|
| 26 |
+
The trace prelude unlinks the shooter through a captured native request, can suspend at rewind144082 or configured setup144493, and widens eligible player bounds before requesting native−25. Self and three client-state gates skip widening. MinimumZ is preserved while other bound fields change. Restoration and relinking remain later source work; the rewrite must not leave these temporary edits as permanent state. No native trace response is supplied by this batch.
|
| 27 |
+
|
| 28 |
+
Rotation61092 has a complete finite unit-axis analysis. Its matrix matches independent Rodrigues geometry; its final point/output alias is unsafe for general in-place rotation because later components reread overwritten input. Actual295018 uses separate output. It rotates unitY around initialized unitZ by18×pelletIndex degrees, then scales using weapon width and a local seed-dependent absolute sine.
|
| 29 |
+
|
| 30 |
+
The pellet seed uses signed right shift27, unlike the global36717 RNG's unsigned shift. All256 byte seeds are audited. Zero pellet seed produces finite offsets instead of entering the shared aim rejection loop. The argument seed mutates while the global seed remains unchanged during this pellet stage.
|
| 31 |
+
|
| 32 |
+
The event57 chain now executes actual allocation/initialization, event construction,4096-scale direction quantization, global PRNG,295018 frame/width/rotation/local-seed/endpoint preparation and reached291641 prelude. It stops at unknown rewind or the captured first native trace request. It never resumes either waiting parent after that boundary. A zero direction stops before projection division. Caller event origin and recalculated global muzzle remain distinct source values.
|
| 33 |
+
|
| 34 |
+
## Validation and limits
|
| 35 |
+
|
| 36 |
+
The952-test baseline gains36 checks, ending at988 tests. Each task has source identity, deterministic regeneration and a machine report below2MiB. Independent f32, geometry, full-record and control-flow checks cover both ordinary inputs and explicit boundaries. Storage/filter, links and whitespace checks pass. No original assets, Rust runtime or shared VM evaluator change. Existing default research contracts remain unchanged where wrappers gained optional caller contexts.
|
| 37 |
+
|
| 38 |
+
Native trig/sqrt are finite supplied math models; original native library bit parity is unverified. Native unlink, registration, linking and trace requests are captured without engine effects. Synthetic mismatch/future-time/alias/unit-axis fixtures do not establish legal live input domains. No original executable/full VM, native collision/physics/rendering, successful hit/damage, full20-pellet result, networking or macOS/Linux Bevy/Solari gameplay runs here.
|
| 39 |
+
|
| 40 |
+
## Next ten concrete tasks
|
| 41 |
+
|
| 42 |
+
1. Recover291920–292298 trace-result classification and retry behavior, including reached144766 and211239 boundaries. Distinguish a supplied trace record from native collision evidence.
|
| 43 |
+
2. Recover291641's candidate restoration/relinking suffix through292544, including144413 and native−31/−32 order. Verify every widened record returns to its expected state on every reached exit.
|
| 44 |
+
3. Recover rewind144082 and configured144493 preparation plus their inverse contracts. Establish how client6176/716 and world snapshots affect the native trace request.
|
| 45 |
+
4. Compose293732 through the recovered trace return, then its actual contact292545 and bookkeeping279820 callsites. Preserve caller output records and explicit unresolved damage children.
|
| 46 |
+
5. Partition292545 by material/contact/weapon/state branches and recover its first reached damage/impact/event consumers with exact asset identities where present.
|
| 47 |
+
6. Recover295018's20-pellet loop: index progression, signed seed carry, trace/contact conditions and table writes. Existing indices1/19 fixtures resume preparation only; they are not completed earlier pellets.
|
| 48 |
+
7. Recover295018's four-target/fifteen-slot aggregation and279820 statistics, including the no-target path and exact counter/percentage conversion.
|
| 49 |
+
8. Recover entity query276433 and native link/unlink contracts; continue288903 after actual allocation through temp_bomb setup/lifetime callbacks.
|
| 50 |
+
9. Recover grenade223156 and reached trajectory/contact/bounce/explosion/damage paths, with entity clearing/freeing and allocator timing/capacity validated against original behavior.
|
| 51 |
+
10. Capture original executable/native/DLL reference traces and implement one verified Rust gameplay slice with cross-platform checks. Continue maps/models/textures/shaders/audio/network inventory and Bevy/Solari rendering adaptation for macOS/Linux; these bounded QVM analyses do not complete the game.
|
docs/research/QVM_ALLOCATION_SPREAD_BATCH.md
CHANGED
|
@@ -43,3 +43,6 @@ The919-test baseline gains33 independent checks, ending at952 tests. Each task i
|
|
| 43 |
8. Recover276433 entity query and native−31 linking contracts; apply recovered allocation to288903 after289113 and retain its base-selection assumptions.
|
| 44 |
9. Recover grenade223156 expiry/explosion and reached trajectory/contact/bounce consumers; establish which routine clears/spawns/frees source records and validates allocator timing/capacity.
|
| 45 |
10. Capture original reference traces and connect one validated firing path to the Rust runtime. Continue the wider native/DLL/network/content inventory and macOS/Linux Bevy/Solari gameplay/rendering work; static QVM fixtures do not establish platform support.
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
8. Recover276433 entity query and native−31 linking contracts; apply recovered allocation to288903 after289113 and retain its base-selection assumptions.
|
| 44 |
9. Recover grenade223156 expiry/explosion and reached trajectory/contact/bounce consumers; establish which routine clears/spawns/frees source records and validates allocator timing/capacity.
|
| 45 |
10. Capture original reference traces and connect one validated firing path to the Rust runtime. Continue the wider native/DLL/network/content inventory and macOS/Linux Bevy/Solari gameplay/rendering work; static QVM fixtures do not establish platform support.
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
Follow-up: the [RE-615–624 aim/trace batch](QVM_AIM_TRACE_BATCH.md) completes the bounded aim function and extends pellet preparation to the first trace boundary. Use its next ten tasks for current unresolved work.
|
docs/research/QVM_EVENT57_TRACE_CHAIN.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Allocated event57 to first pellet native trace boundary
|
| 2 |
+
|
| 3 |
+
RE-624. Reproduce with `python3 scripts/analyze_qvm_event57_trace_chain.py`; check with `python3 scripts/test_qvm_event57_trace_chain.py`. The [machine report](qvm-event57-trace-chain.json) retains source identity and bounded fixtures.
|
| 4 |
+
|
| 5 |
+
The source-order outer driver dispatches actual277695→277165/277125 and278138, patches event direction after4096-scale truncation, runs actual36717 and reaches source295018 with the allocated record pointers and low-byte seed. The generalized frame wrapper retains those actual arguments. Recovered frame, muzzle, width,61092 rotation, signed seed and endpoint calculations then reach the actual295822 call arguments for291641. The trace prelude runs until unknown rewind or captured native−25; the trace-result destination is not populated with a synthetic return and neither waiting parent resumes. Twelve nonzero direction/RNG/shooter-flag fixtures and one zero-direction fixture retain complete event records, native request evidence and pointer handoffs. Independent oracles reconstruct event records and first-pellet endpoints. Captured allocation/link/unlink/trace requests do not establish world effects. The batch overview records all ten tasks and the next ten remaining gaps; full trace/contact/damage,20-pellet outcome, original reference and Rust platform integration remain open.
|
| 6 |
+
|
| 7 |
+
No original executable/full QVM/native collision/physics/rendering executes. Native responses and legal input domains are supplied or unverified where stated; full runtime/macOS/Linux Rust/Bevy/Solari gameplay remains open.
|
docs/research/README.md
CHANGED
|
@@ -471,3 +471,9 @@ The extension collector adds five focused tests for native tail calls, command-r
|
|
| 471 |
|
| 472 |
|
| 473 |
[RE-623: Signed pellet seed perturbation and endpoint construction](QVM_PELLET_ENDPOINT.md). Reproduce with `python3 scripts/analyze_qvm_pellet_endpoint.py`; check with `python3 scripts/test_qvm_pellet_endpoint.py`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 471 |
|
| 472 |
|
| 473 |
[RE-623: Signed pellet seed perturbation and endpoint construction](QVM_PELLET_ENDPOINT.md). Reproduce with `python3 scripts/analyze_qvm_pellet_endpoint.py`; check with `python3 scripts/test_qvm_pellet_endpoint.py`.
|
| 474 |
+
|
| 475 |
+
|
| 476 |
+
[RE-615–624 aim/trace batch and current next ten tasks](QVM_AIM_TRACE_BATCH.md): complete bounded aim, trace prelude, rotation, signed pellet seeds and actual allocated event57 composition.
|
| 477 |
+
|
| 478 |
+
|
| 479 |
+
[RE-624: Allocated event57 to first pellet native trace boundary](QVM_EVENT57_TRACE_CHAIN.md). Reproduce with `python3 scripts/analyze_qvm_event57_trace_chain.py`; check with `python3 scripts/test_qvm_event57_trace_chain.py`.
|
docs/research/qvm-event57-trace-chain.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
scripts/analyze_qvm_event57_trace_chain.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Actual285840→allocated event57→295018 first pellet→291641 trace boundary."""
|
| 3 |
+
import itertools
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
from analyze_deferred_auth import trace_slice
|
| 6 |
+
from analyze_bsp_references import trace_fields
|
| 7 |
+
from qvm_research_support import source,constants
|
| 8 |
+
from qvm_server_fire_support import ENTITY,FORWARD,MUZZLE,state
|
| 9 |
+
from analyze_qvm_allocated_event import event,setup
|
| 10 |
+
from analyze_qvm_server_shot_setup import random_word,LOCAL as OUTER
|
| 11 |
+
from analyze_qvm_pellet_endpoint import pellet_endpoint
|
| 12 |
+
from analyze_qvm_shot_frame import LOCAL as SHOT
|
| 13 |
+
from analyze_qvm_shot_trace_request import first_trace
|
| 14 |
+
from analyze_qvm_temp_event import record
|
| 15 |
+
from analyze_qvm_acceleration import PS,word
|
| 16 |
+
from analyze_qvm import write_json
|
| 17 |
+
|
| 18 |
+
def chain(ins,m):
|
| 19 |
+
m=dict(m);initial=state(m);seed_before=m[21044]&0xffffffff;m[OUTER+52]=ENTITY;pc=285841;trace=[];calls=[];children=[];allocation=None;pellet=None;shot_args=None;trace_call=None;trace_report=None;call_execution=None;status=None
|
| 20 |
+
for _ in range(3):
|
| 21 |
+
t=trace_slice(ins,285841,285968,m,{},resume_at=pc,stop_targets=[p for p in [285849,285920,285968] if p!=pc],local_base=OUTER,capture_stack=True,limit=8192);m=t['memory'];pc=t['stop'];trace+=t['trace'];calls+=t['calls'];assert len(t['calls'])==1;c=t['calls'][0]
|
| 22 |
+
if c['target']==277695:
|
| 23 |
+
assert c['args'][8]==MUZZLE;m,e=event(ins,m,c['args'][12]);allocation=e;value=e['execution']['return']
|
| 24 |
+
elif c['target']==36717:m,e=random_word(ins,m);value=e['result']
|
| 25 |
+
elif c['target']==295018:
|
| 26 |
+
shot_args=c['args'];m,pellet=pellet_endpoint(ins,m,shot_args);status=pellet['status'];children.append({'call':c,'effect':{'status':status,'returned':False}})
|
| 27 |
+
if status=='trace-pending':
|
| 28 |
+
request=trace_slice(ins,295805,295823,m,{},local_base=SHOT,capture_stack=True,limit=128);assert len(request['calls'])==1;trace_call=request['calls'][0];assert trace_call['target']==291641;call_execution=trace_fields(request,False);m,trace_report=first_trace(ins,m,trace_call['args']);status=trace_report['status']
|
| 29 |
+
break
|
| 30 |
+
else:raise ValueError('Unrecovered event57 child '+str(c['target']))
|
| 31 |
+
assert ins[c['instruction']+1]['opcode']=='STORE4';m[OUTER+ins[c['instruction']-2]['operand']]=value;children.append({'call':c,'effect':{'report':'event','return':value} if c['target']==277695 else e})
|
| 32 |
+
else:raise ValueError('Missing shot-processing call')
|
| 33 |
+
return m,{'initial':initial,'initial_global_seed':seed_before,'final_global_seed':m[21044]&0xffffffff,'event':{k:v for k,v in allocation.items() if k!='allocation'},'event_record':record(m,allocation['execution']['return']),'outer_execution':{'calls':calls,'children':children,**trace_fields({'trace':trace},False)},'shot_arguments':shot_args,'pellet':pellet,'trace_call':trace_call,'trace_call_execution':call_execution,'trace':trace_report,'status':status,'outer_returned':False,'shot_returned':False,'native_collision_executed':False}
|
| 34 |
+
|
| 35 |
+
def main():
|
| 36 |
+
q,raw,h,ins=source();rows=[]
|
| 37 |
+
cases=list(itertools.product([(1,0,0),(.6,-.25,.8)],[0,1,0x12345678],[0,8]))+[((0,0,0),1,8)]
|
| 38 |
+
for forward,rng,flag in cases:
|
| 39 |
+
m=setup(raw,h);m.update(constants(raw,h,range(32856,33364,4)));m[ENTITY+192]=4;m[ENTITY+424]=flag;m[PS+312]=4;m[21044]=rng;m[34082500]=0;m[34992580]=0
|
| 40 |
+
for j,v in enumerate(forward):m[FORWARD+4*j]=word(v)
|
| 41 |
+
for o in range(0,56,4):m[SHOT+92+o]=0x12345678
|
| 42 |
+
before=[m[SHOT+92+o] for o in range(0,56,4)];m,r=chain(ins,m);r['trace_buffer_before']=before;r['trace_buffer_after']=[m[SHOT+92+o] for o in range(0,56,4)];rows.append(r)
|
| 43 |
+
write_json(Path('docs/research/qvm-event57-trace-chain.json'),{'source':q['source'],'sha256':q['sha256'],'probes':rows,'limits':'Actual285840 allocation/quantization/global PRNG→295018 first-pellet prefix→291641 prelude. Stops before unknown rewind or at captured native trace; zero direction stops before division. Neither parent resumes/returns, no native hit result,20-pellet/contact/damage/world parity or full firing tick.'})
|
| 44 |
+
if __name__=='__main__':main()
|
scripts/test_qvm_event57_trace_chain.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json,unittest
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
from test_qvm_temp_event import event_record
|
| 4 |
+
from test_qvm_server_shot_setup import random_oracle
|
| 5 |
+
from test_qvm_pellet_endpoint import expected
|
| 6 |
+
from test_qvm_ground import word,n,f
|
| 7 |
+
class Event57TraceChainTests(unittest.TestCase):
|
| 8 |
+
@classmethod
|
| 9 |
+
def setUpClass(cls):cls.r=json.loads(Path('docs/research/qvm-event57-trace-chain.json').read_text())
|
| 10 |
+
def test_independent_allocated_event_full_record(self):
|
| 11 |
+
self.assertEqual(len(self.r['probes']),13)
|
| 12 |
+
for p in self.r['probes']:
|
| 13 |
+
want=event_record(p['event']);seed,value=random_oracle(p['initial_global_seed'])
|
| 14 |
+
for j,v in enumerate(p['initial']['forward']):want[str(104+4*j)]=word(float(int(f(n(v)*4096))))
|
| 15 |
+
want.update({'184':value&255,'140':p['initial']['entity_id'],'192':4});self.assertEqual(p['event_record'],want);self.assertEqual(p['final_global_seed'],seed);self.assertEqual(p['event_record']['0'],64)
|
| 16 |
+
def test_actual_call_chain_and_argument_pointer_handoffs(self):
|
| 17 |
+
for p in self.r['probes']:
|
| 18 |
+
self.assertEqual([c['target'] for c in p['outer_execution']['calls']],[277695,36717,295018]);a=p['shot_arguments'];self.assertEqual(a,{'8':589824,'12':34147688+24,'16':34147688+104,'20':p['event_record']['184']});self.assertEqual(p['pellet']['rotation_stage']['frame']['input'],[p['event_record'][str(o)] for o in [104,108,112]])
|
| 19 |
+
def test_independent_first_pellet_and_trace_request_boundary(self):
|
| 20 |
+
for p in self.r['probes'][:-1]:
|
| 21 |
+
self.assertEqual(p['pellet']['endpoint'],expected(p['pellet'])[3]);self.assertEqual(p['trace_call']['target'],291641);self.assertEqual(p['trace_call']['args'],{'8':589824,'12':0x79500000+92,'16':36477712,'20':0x79500000+64,'24':1065353216,'28':0x79500000+148,'32':1});self.assertEqual(p['trace_buffer_before'],p['trace_buffer_after'])
|
| 22 |
+
if p['initial']['entity_weapon']==4 and p['status']=='native-trace-request-captured':self.assertEqual(p['trace']['requests'][-1]['end'],p['pellet']['endpoint']);self.assertEqual(p['trace']['requests'][-1]['arguments']['28'],7)
|
| 23 |
+
def test_no_unrecovered_parent_return_or_native_hit(self):
|
| 24 |
+
for p in self.r['probes']:self.assertFalse(p['outer_returned']);self.assertFalse(p['shot_returned']);self.assertFalse(p['native_collision_executed']);self.assertIn(p['status'],['rewind-child-pending','native-trace-request-captured','zero-direction-division-boundary'])
|
| 25 |
+
self.assertEqual(self.r['probes'][-1]['status'],'zero-direction-division-boundary');self.assertIsNone(self.r['probes'][-1]['trace_call'])
|
| 26 |
+
if __name__=='__main__':unittest.main()
|