nmarshall commited on
Commit
98f9b39
·
1 Parent(s): 5efab84

qvm: signed pellet seed and endpoint

Browse files
docs/ASSET_PIPELINE_TODO.md CHANGED
@@ -547,3 +547,6 @@ Research progress: RE-621 [report](research/QVM_ROTATE_POINT.md); remaining nati
547
 
548
 
549
  Research progress: RE-622 [report](research/QVM_PELLET_ROTATION.md); remaining native/content/runtime/platform scope stays open.
 
 
 
 
547
 
548
 
549
  Research progress: RE-622 [report](research/QVM_PELLET_ROTATION.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.
docs/FINDINGS.md CHANGED
@@ -902,3 +902,6 @@ Bounded qagame paths recover bomb-plant/inactivity correction requests, direct f
902
 
903
 
904
  **RE-622 — Pellet muzzle width and indexed point rotation:** 295018 computes width=16384×sin(degrees×radians)/cos(...), then rotates unitY around the initialized unitZ axis in18-degree pellet steps. [Evidence](research/QVM_PELLET_ROTATION.md).
 
 
 
 
902
 
903
 
904
  **RE-622 — Pellet muzzle width and indexed point rotation:** 295018 computes width=16384×sin(degrees×radians)/cos(...), then rotates unitY around the initialized unitZ axis in18-degree pellet steps. [Evidence](research/QVM_PELLET_ROTATION.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).
docs/PROVISIONAL_TODO.md CHANGED
@@ -867,3 +867,6 @@ Research progress: RE-621 [report](research/QVM_ROTATE_POINT.md); remaining nati
867
 
868
 
869
  Research progress: RE-622 [report](research/QVM_PELLET_ROTATION.md); remaining native/content/runtime/platform scope stays open.
 
 
 
 
867
 
868
 
869
  Research progress: RE-622 [report](research/QVM_PELLET_ROTATION.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.
docs/RESEARCH_LEDGER.md CHANGED
@@ -792,3 +792,8 @@ Actual293732 now calls recovered290493 with its local forward/global muzzle, the
792
  ## 2026-10-20 — RE-622 Pellet muzzle width and indexed point rotation (separate task commit)
793
 
794
  295018 computes width=16384×sin(degrees×radians)/cos(...), then rotates unitY around the initialized unitZ axis in18-degree pellet steps. 24 ID/direction/origin/index fixtures check independent f32 width/muzzle, rotation geometry, actual children and seed preservation. Default frame/rotation reports remain unchanged. Full suite: 980 tests pass. Report regenerates byte-identically (547356 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
 
 
 
 
 
 
792
  ## 2026-10-20 — RE-622 Pellet muzzle width and indexed point rotation (separate task commit)
793
 
794
  295018 computes width=16384×sin(degrees×radians)/cos(...), then rotates unitY around the initialized unitZ axis in18-degree pellet steps. 24 ID/direction/origin/index fixtures check independent f32 width/muzzle, rotation geometry, actual children and seed preservation. Default frame/rotation reports remain unchanged. Full suite: 980 tests pass. Report regenerates byte-identically (547356 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
795
+
796
+
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.
docs/REVERSE_ENGINEERING_TODO.md CHANGED
@@ -910,3 +910,6 @@ Purpose: turn the supplied installation into an evidence-backed specification of
910
 
911
 
912
  - [x] RE-622 Pellet muzzle width and indexed point rotation ([report](research/QVM_PELLET_ROTATION.md)).
 
 
 
 
910
 
911
 
912
  - [x] RE-622 Pellet muzzle width and indexed point rotation ([report](research/QVM_PELLET_ROTATION.md)).
913
+
914
+
915
+ - [x] RE-623 Signed pellet seed perturbation and endpoint construction ([report](research/QVM_PELLET_ENDPOINT.md)).
docs/research/QVM_PELLET_ENDPOINT.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Signed pellet seed perturbation and endpoint construction
2
+
3
+ RE-623. Reproduce with `python3 scripts/analyze_qvm_pellet_endpoint.py`; check with `python3 scripts/test_qvm_pellet_endpoint.py`. The [machine report](qvm-pellet-endpoint.json) retains source identity and bounded fixtures.
4
+
5
+ Actual295573–295804 applies xor shifts5/21 and arithmetic-right-shift27 to local1120. The global36717 helper instead uses unsigned-right-shift27; exhaustive byte-seed evidence demonstrates these are not interchangeable. Low16 bits map to a centered angle and two identical native sine calls implement an absolute value. The resulting factor scales the rotated local80/84 offsets by width. Endpoint local64 is caller origin+16384×normalized direction, then perpendicular×offset80 and cross×offset84 in source f32 order. The global21044 seed stays unchanged. Thirty-six fixtures independently check every endpoint word, seed, amplitude, offset and native argument. Zero argument seed remainszero but produces a finite endpoint, unlike the global rejection sampler zero-state loop. Index1/19 remain explicit resumed-loop fixtures. No trace/hit/contact/damage or full20-pellet outcome is inferred.
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
@@ -468,3 +468,6 @@ The extension collector adds five focused tests for native tail calls, command-r
468
 
469
 
470
  [RE-622: Pellet muzzle width and indexed point rotation](QVM_PELLET_ROTATION.md). Reproduce with `python3 scripts/analyze_qvm_pellet_rotation.py`; check with `python3 scripts/test_qvm_pellet_rotation.py`.
 
 
 
 
468
 
469
 
470
  [RE-622: Pellet muzzle width and indexed point rotation](QVM_PELLET_ROTATION.md). Reproduce with `python3 scripts/analyze_qvm_pellet_rotation.py`; check with `python3 scripts/test_qvm_pellet_rotation.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`.
docs/research/qvm-pellet-endpoint.json ADDED
The diff for this file is too large to render. See raw diff
 
scripts/analyze_qvm_pellet_endpoint.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """295018 signed argument-seed update, sine scaling and pellet endpoint."""
3
+ import itertools
4
+ from pathlib import Path
5
+ from qvm_research_support import source,execute
6
+ from qvm_shot_math_support import TRIG
7
+ from analyze_qvm_pellet_rotation import pellet_rotation,setup
8
+ from analyze_qvm_shot_frame import LOCAL
9
+ from analyze_qvm_acceleration import word
10
+ from analyze_qvm_slide_prefix import vec
11
+ from analyze_qvm import write_json
12
+
13
+ def pellet_endpoint(ins,m,args=None,index=0):
14
+ global_seed=m[21044]&0xffffffff;m,p=pellet_rotation(ins,m,args,index);r={'rotation_stage':p,'status':p['status'],'execution':None}
15
+ if p['status']!='pellet-seed-pending':return m,r
16
+ initial={'seed':m[LOCAL+1120]&0xffffffff,'origin':vec(m,m[LOCAL+1112]),'normalized':vec(m,LOCAL+36),'perpendicular':vec(m,LOCAL+48),'cross':vec(m,LOCAL+416),'rotated':vec(m,LOCAL+80),'width':m[LOCAL+952]&0xffffffff,'global_seed':global_seed}
17
+ m,_,e=execute(ins,295573,295805,m,(0,0,0),LOCAL,TRIG);r.update({'initial':initial,'execution':e,'seed_after':m[LOCAL+1120]&0xffffffff,'absolute_sine':m[LOCAL+688]&0xffffffff,'scaled_offsets':vec(m,LOCAL+80)[:2],'endpoint':vec(m,LOCAL+64),'global_seed_after':m[21044]&0xffffffff,'status':'trace-pending'})
18
+ return m,r
19
+
20
+ def main():
21
+ q,raw,h,ins=source();rows=[];audit=[]
22
+ for rng,direction,index in itertools.product([0,1,91,255,0x12345678,0xffffffff],[(1,0,0),(.6,-.25,.8)],[0,1,19]):
23
+ m,a=setup(raw,h,direction=direction);m[21044]=0x12345678;a[20]=rng;rows.append(pellet_endpoint(ins,m,a,index)[1])
24
+ for seed in range(256):
25
+ m,_,e=execute(ins,295573,295612,{LOCAL+1120:seed},(0,0,0),LOCAL);audit.append({'initial':seed,'after':m[LOCAL+1120]&0xffffffff,'trace_sha256':e['trace_sha256']})
26
+ write_json(Path('docs/research/qvm-pellet-endpoint.json'),{'source':q['source'],'sha256':q['sha256'],'seed_audit':audit,'probes':rows,'limits':'Actual295573–295804 after recovered frame/muzzle/rotation. Signed RSHI differs from global RNG; native sine supplied. Indices1/19 are explicit loop-local resume fixtures without earlier contacts. Stops before291641, no trace/hit/damage.'})
27
+ if __name__=='__main__':main()
scripts/test_qvm_pellet_endpoint.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json,math,unittest
2
+ from pathlib import Path
3
+ from test_qvm_ground import word,n,f
4
+ from test_qvm_server_shot_setup import random_oracle
5
+
6
+ def signed_seed(seed):
7
+ x=(seed^(seed<<5))&0xffffffff;x=(x^(x<<21))&0xffffffff;signed=x-(1<<32) if x&0x80000000 else x;return (x^(signed>>27))&0xffffffff
8
+
9
+ def expected(p):
10
+ a=p['initial'];seed=signed_seed(a['seed']);angle=f(f(f(float(seed&65535)*n(931135488))-.5)*2);sine=f(math.sin(angle));amplitude=f(-sine) if sine<0 else sine;scale=f(n(a['width'])*amplitude);offsets=[f(n(v)*scale) for v in a['rotated'][:2]];out=[word(f(f(f(n(o)+f(n(v)*16384))+f(n(side)*offsets[0]))+f(n(cross)*offsets[1]))) for o,v,side,cross in zip(a['origin'],a['normalized'],a['perpendicular'],a['cross'])];return seed,word(amplitude),list(map(word,offsets)),out,word(angle)
11
+ class PelletEndpointTests(unittest.TestCase):
12
+ @classmethod
13
+ def setUpClass(cls):cls.r=json.loads(Path('docs/research/qvm-pellet-endpoint.json').read_text())
14
+ def test_full_f32_seed_amplitude_and_endpoint_oracle(self):
15
+ self.assertEqual(len(self.r['probes']),36)
16
+ for p in self.r['probes']:
17
+ seed,amplitude,offsets,out,angle=expected(p);self.assertEqual((p['seed_after'],p['absolute_sine'],p['scaled_offsets'],p['endpoint']),(seed,amplitude,offsets,out));self.assertEqual([c['args']['8']&0xffffffff for c in p['execution']['calls']],[angle,angle])
18
+ def test_exhaustive_byte_seed_audit_uses_signed_shift(self):
19
+ self.assertEqual(len(self.r['seed_audit']),256)
20
+ for p in self.r['seed_audit']:self.assertEqual(p['after'],signed_seed(p['initial']))
21
+ self.assertTrue(any(p['after']!=random_oracle(p['initial'])[0] for p in self.r['seed_audit']))
22
+ def test_only_argument_seed_mutates(self):
23
+ for p in self.r['probes']:self.assertEqual(p['global_seed_after'],p['initial']['global_seed']);self.assertEqual([c['target'] for c in p['execution']['calls']],[-104,-104])
24
+ def test_zero_seed_has_finite_endpoint_without_rejection(self):
25
+ for p in self.r['probes']:
26
+ if p['initial']['seed']==0:self.assertEqual(p['seed_after'],0);self.assertGreater(n(p['absolute_sine']),0);self.assertEqual(p['status'],'trace-pending')
27
+ if __name__=='__main__':unittest.main()