commit cb70f2fa1af77941ba0fe0605248a62bd9f900ee
parent 769d49b9959394cbbfb7ef1c556d99fa2c75eb04
Author: anon <anon@example.com>
Date: Sun, 25 Oct 2026 18:57:49 +0000
Normalize complete self-cast target identities before admission
Self-only native casts can transmit a zero or nonactor supplied identity even
though native admission resolves the caster. Normalize both recipient words
before the server checks actor type, preserving all other shared cast gates.
Cover seven identity forms across 82 self-only programs plus invalid friendly
and hostile recipients. All 614 focused checks pass normally and under race;
vet/build and two headed native WASM clients pass unselected, explicit-self,
NPC-selected and replay checks. Remove owned fixtures and retain one preview.
Diffstat:
7 files changed, 76 insertions(+), 20 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -827,11 +827,11 @@ introduction and starting-item gameplay remain open below.
overrides, negative companions, morphs, shields, procs and special delivery
before admission. Resolve Fists of Uncertainty's stat455 criterion producer;
positive numeric effects alone do not establish a supported player buff.
-- [ ] Reconcile self-only casting with no selected target. The native client
- sends Action19 with recipient [0,0] for Elementary Life Booster, but the
- server rejects its recipient type before the self selector can take effect.
- Confirm the original admission rule and cover no selection, self selection
- and another selected actor through the shared cast path and native client.
+- [x] Reconcile self-only casting with no selected target. Normalize both
+ recipient identity words before target admission, matching original metadata
+ and cast admission. Cover seven identity forms across 82 self-only programs,
+ invalid friendly/hostile recipients, cold persistence and native unselected,
+ explicit-self and NPC-selected casts. See [skill nanos](docs/nano-skill-buffs.md).
- [ ] Research Blood Circle27803 and special Iron Circle42052 delivery.
Their flags and zero casting cost/timing do not qualify as ordinary casts;
Blood Circle also omits strain. Retain complete original contracts in
diff --git a/docs/nano-combat-buffs.md b/docs/nano-combat-buffs.md
@@ -128,9 +128,9 @@ between both clients. These outcomes check the implemented flat-addition policy;
they do not independently establish the original server's random damage formula.
Cold replay restored exactly five active effects in both clients: damage6 on
-the first player and damage5, SMG24/Burst15 and HP7 on the second. The native
-no-selection self-cast rejection is tracked separately in TODO; successful casts
-here used explicit self or friendly selection.
+the first player and damage5, SMG24/Burst15 and HP7 on the second. These captures
+used explicit self or friendly selection; separate [identity checks](nano-skill-buffs.md)
+cover native no-selection self casting and full recipient normalization.
After shortening only those owned effects in the stopped database to90 seconds,
both clients replayed them correctly. Waiting110 seconds after the second
diff --git a/docs/nano-skill-buffs.md b/docs/nano-skill-buffs.md
@@ -241,6 +241,19 @@ selectors remains rejected. The exact flag value0x14000 is admitted for the
four original MA programs; flag0x4000 alone does not define self-only behavior.
Existing recipient, range, NCU and action gates still apply after redirection.
+The native caller `10022180` serializes the original supplied identity even
+after admission normalizes its local copy. Thus the server must replace both
+identity words before checking the recipient type: the real client's unselected
+Action19 carries `[0,0]`, while an actor-ID-only test may carry `[50000,0]`.
+Admission assembly at `1006482b..10064836` copies both caster words before cost,
+requirements and object lookup. Retained evidence is
+`ev_7ac60bd06ac9d13cb35093493166042827fb23300b04dd2723cca9e01905fdab`
+and caller evidence is
+`ev_112140abba9fb4c4639142a60b91104500dd77c6631ad4e5df4c2ee5885f5b84`.
+The bounded audit and complete retained records are in
+`local/self-cast-identity-research/native/`. This does not broaden selected-target
+programs or infer new recipient classes from numeric identity types.
+
Skill53012 dispatches directly to `100bd600`; Modify53045's wrapper `100bd4d0`
reaches the same handler. Both use stat key0 and signed amount key39, add through
`10074730`, and remove through `10074b00`, leaving trained values unchanged.
@@ -258,14 +271,32 @@ exported and closed.
Public-operation tests cover every new crystal and program, every authored
threshold/profession, exact complete modifiers, costs, NCU, duration,
-cancellation and database reopen. All 33 self-only programs redirect four
-invalid or unrelated supplied targets to the caster. Separate tests exercise
+cancellation and database reopen. Separate tests exercise
all selector1/2 combinations, reject incomplete Skill contracts without granting
Take the Shot's otherwise supported Aimed Shot subset, and retain targeted
recipient validation. Controlled rolls cover all eight critical programs in
ordinary attacks, Fast Attack and Fling. Expiry/death and failed insertion,
COMMIT, cancellation and expiry preserve complete contributions atomically.
+Identity regression coverage includes all 33 self-only critical/skill programs
+and 49 self-only programs from the combat catalog. Seven identity forms cover
+`[0,0]`, actor type with ID0, unknown actor, creature, another player, explicit
+self and item type with a colliding player ID. Each commits only to the caster
+and retains the effect/cost across database reopen. Friendly and hostile casts
+still reject zero and item identities. All 614 focused tests/subtests passed
+in86.003 seconds and under the race detector in176.143 seconds; build and vet passed.
+
+Two headed GPU WASM clients verified unselected Elementary Life Booster,
+Elementary Damage Booster and Lesser Suppressor. Literal Action19 `[0,0]`
+requests produced the correct HP7, all-eight damage1 and SMG24/Burst15 effects
+only on their respective casters. Friendly Augmentation without a selection
+was rejected by the native client before transmission. Explicit-self
+Augmentation stacked to damage3; Life with a Leet selected still refreshed only
+the caster. Reload replayed each contribution once in owner and observer.
+There were no client/worker errors. Captures and executable assertions are in
+`local/self-cast-identity-smoke/`; test fixtures are removed and the single
+preview remains available on HTTPS8443.
+
Two headed Chromium clients on the GPU verified original crystal uploads
for Subconscious Guidance, UVC, Mark of Risk, Take the Shot and Swiss Cheese.
High skills, professions, level 200 and the 52-NCU equipment were explicit GM
diff --git a/server/nano_buffs_test.go b/server/nano_buffs_test.go
@@ -102,7 +102,7 @@ func TestNanoBuffFriendlyTargetAndObserverReceiveRecipientEffect(t *testing.T) {
}
func TestNanoBuffRejectsInvalidAdmission(t *testing.T) {
- for _, scenario := range []string{"MM", "BM", "nano", "unlearned", "no target", "NPC", "cross side", "range", "loading recipient"} {
+ for _, scenario := range []string{"MM", "BM", "nano", "unlearned", "no target", "empty identity", "item identity", "NPC", "cross side", "range", "loading recipient"} {
t.Run(scenario, func(t *testing.T) {
world, _ := newNanoBuffWorld(t)
player, client := world.characters[1], world.clients[1]
@@ -111,6 +111,7 @@ func TestNanoBuffRejectsInvalidAdmission(t *testing.T) {
world.characters[2] = &recipient
world.clients[2] = &worldClient{id: 2, conn: &combatTestConn{}, ready: true, target: true}
target := uint32(2)
+ targetType := uint32(50000)
switch scenario {
case "MM":
player.stats.NanoAiding.MatterMetamorphosis = 38
@@ -122,6 +123,10 @@ func TestNanoBuffRejectsInvalidAdmission(t *testing.T) {
player.inventory.LearnedNanos = nil
case "no target":
target = 0
+ case "empty identity":
+ targetType, target = 0, 0
+ case "item identity":
+ targetType = 51018
case "NPC":
target = 1000000
case "cross side":
@@ -133,7 +138,7 @@ func TestNanoBuffRejectsInvalidAdmission(t *testing.T) {
}
before := player.nano
- err := world.handleNanoCast(client, characterActionPacket(1, [5]uint32{19, 50000, target, 53019, 27169})[20:])
+ err := world.handleNanoCast(client, characterActionPacket(1, [5]uint32{19, targetType, target, 53019, 27169})[20:])
if err != nil || client.nanoCast != nil || player.nano != before || len(player.activeNanos) != 0 || len(recipient.activeNanos) != 0 {
t.Fatal("invalid buff spent nano or applied an effect", err)
diff --git a/server/nano_casting.go b/server/nano_casting.go
@@ -132,12 +132,14 @@ func (server *server) handleNanoCast(client *worldClient, body []byte) error {
// Validate the learned program, shared action gates and its authored requirements.
program := binary.BigEndian.Uint32(body[32:36])
+ targetType := binary.BigEndian.Uint32(body[20:24])
target := server.characters[binary.BigEndian.Uint32(body[24:28])]
if statBuffNano(program) && selfOnlyNano(program) {
- // Native admission 100646a0 redirects these selectors to the caster.
+ // Native admission 100646a0 replaces both identity words with the caster.
+ targetType = 50000
target = player
}
- accepted := binary.BigEndian.Uint32(body[20:24]) == 50000 && binary.BigEndian.Uint32(body[28:32]) == 53019 &&
+ accepted := targetType == 50000 && binary.BigEndian.Uint32(body[28:32]) == 53019 &&
slices.Contains(player.inventory.LearnedNanos, program) && player.nanoRequirementsMet(program) && player.nano >= nanoCost(program) &&
!player.sitting && !player.driving() && client.forward == 0 && !client.strafing && !client.turning && client.equipment == nil &&
(player.fighting == 0 || now.Before(player.rechargeUntil)) && server.nanoTarget_locked(player, target, client, program, now)
diff --git a/server/nano_casting_test.go b/server/nano_casting_test.go
@@ -66,7 +66,7 @@ func TestWinterBiteTimesOneResultAndRecharge(t *testing.T) {
}
func TestWinterBiteRejectsInvalidAdmission(t *testing.T) {
- for _, scenario := range []string{"unlearned", "profession", "psychology", "creation", "nano", "sitting", "forward", "strafe", "turn", "equipment", "weapon attack", "hidden", "dead target", "player target", "wrong zone", "range", "range vertical", "wrong program", "wrong resource", "foreign owner", "loading", "not ready", "stale", "dead caster"} {
+ for _, scenario := range []string{"unlearned", "profession", "psychology", "creation", "nano", "sitting", "forward", "strafe", "turn", "equipment", "weapon attack", "hidden", "dead target", "player target", "empty identity", "item identity", "wrong zone", "range", "range vertical", "wrong program", "wrong resource", "foreign owner", "loading", "not ready", "stale", "dead caster"} {
t.Run(scenario, func(t *testing.T) {
world, _ := newNanoCastingWorld(t)
player, client, npc := world.characters[1], world.clients[1], world.characters[1000000]
@@ -101,6 +101,10 @@ func TestWinterBiteRejectsInvalidAdmission(t *testing.T) {
npc.health = 0
case "player target":
npc.npc = false
+ case "empty identity":
+ fields[1], fields[2] = 0, 0
+ case "item identity":
+ fields[1] = 51018
case "wrong zone":
npc.playfield = 705
case "range":
diff --git a/server/self_nano_test.go b/server/self_nano_test.go
@@ -119,13 +119,20 @@ func TestSelfAndCriticalNanosUploadCastRestoreAndCancelCompleteContracts(t *test
}
func TestSelfOnlyNanosRedirectEverySuppliedTargetToTheCaster(t *testing.T) {
- for _, fixture := range selfAndCriticalNanoFixtures(t) {
+ fixtures := selfAndCriticalNanoFixtures(t)
+ for _, fixture := range combatNanoFixtures(t) {
+ if fixture.Target == 2 {
+ fixtures = append(fixtures, selfAndCriticalNanoFixture{Program: fixture.Program, Profession: fixture.Profession,
+ NCU: fixture.NCU, NanoCost: fixture.Debit, SelfOnly: true})
+ }
+ }
+ for _, fixture := range fixtures {
if !fixture.SelfOnly {
continue
}
- for _, supplied := range []uint32{0, 999, 1000000, 2} {
- t.Run(fmt.Sprintf("%d/%d", fixture.Program, supplied), func(t *testing.T) {
- world, _ := newSelfNanoWorld(t)
+ for _, supplied := range [][2]uint32{{0, 0}, {50000, 0}, {50000, 999}, {50000, 1000000}, {50000, 2}, {50000, 1}, {51018, 2}} {
+ t.Run(fmt.Sprintf("%d/%d/%d", fixture.Program, supplied[0], supplied[1]), func(t *testing.T) {
+ world, _ := newCombatNanoWorld(t, combatNanoFixture{Profession: fixture.Profession})
player := world.characters[1]
player.level, player.profession = 200, uint16(fixture.Profession)
player.inventory.LearnedNanos = []uint32{fixture.Program}
@@ -133,7 +140,14 @@ func TestSelfOnlyNanosRedirectEverySuppliedTargetToTheCaster(t *testing.T) {
world.characters[2] = other
world.clients[2] = &worldClient{id: 2, conn: &combatTestConn{}, target: true, ready: true}
- castTestBuff(t, world, 1, supplied, fixture.Program)
+ client := world.clients[1]
+ if err := world.handleNanoCast(client, characterActionPacket(1, [5]uint32{19, supplied[0], supplied[1], 53019, fixture.Program})[20:]); err != nil {
+ t.Fatal(err)
+ }
+ if client.nanoCast == nil || client.nanoCast.target != 1 {
+ t.Fatal("self-only cast did not normalize the complete recipient identity")
+ }
+ world.advanceNanos(client.nanoCast.readyAt.Add(time.Nanosecond))
cold := newTestInventoryServer(t).characters[1]
if len(player.activeNanos) != 1 || len(cold.activeNanos) != 1 || player.usedNCU() != fixture.NCU ||