Merge branch 'parity-base' into parity/leftovers

This commit is contained in:
Ludovic Marie
2026-10-13 06:22:05 +02:00
64 changed files with 3749 additions and 886 deletions
+3 -1
View File
@@ -225,7 +225,9 @@ def chat(rng, n):
'chatScale': rng.choice([1.0, 1.0, 0.5, 0.0 + 0.75, 0.25]), 'chatWidth': rng.choice([1.0, 1.0, 0.5, 0.0, 0.3]),
'chatOpacity': rng.choice([1.0, 0.5, 0.0, 0.25]), 'textOpacity': rng.choice([0.5, 0.0, 1.0, 0.25]),
'chatLineSpacing': rng.choice([0.0, 0.0, 0.5, 1.0, 0.25]), 'chatHeightUnfocused': rng.choice([70 / 160, 1.0, 0.0, 0.5]),
'chatHeightFocused': 1.0}
'chatHeightFocused': rng.choice([1.0, 1.0, 0.5, 0.25]),
# The chat screen open: foreground, focused height, scrolled up or down.
'focused': rng.random() < 0.5, 'scroll': rng.choice([0, 0, 1, 3, 7, 20, -2, 1000])}
# Generators by kind: (rng, index) -> case. Cases are drawn round-robin.
+1 -6
View File
@@ -9,12 +9,7 @@
"python": "/opt/homebrew/bin/python3.13",
"rsync": "/opt/homebrew/bin/rsync",
"jobs": 14,
"exclude": {
"options": "Rust's f64::powf uses the platform libm, which rounds differently on macOS",
"chunk_generation": "one ocean ruined portal differs on macOS (platform float math)",
"world_border_render": "the wall's alpha differs by one ulp on macOS (platform float math)",
"mob_ai": "mob movement differs on macOS (platform float math in random positions)"
}
"exclude": {}
},
"thinkpad": {
"ssh": "thinkpad",
+36 -1
View File
@@ -163,6 +163,36 @@ class Server:
self.log.close()
def settle(server, ticks=600, timeout=600):
"""Waits until every force-loaded chunk is loaded, then for `ticks` game
ticks, so their fluids have finished flowing however slow the machine."""
deadline = time.time() + timeout
offsets = range(-80, 81, 16)
for poll in range(1_000_000):
start = len(server.lines)
for dx in offsets:
for dz in offsets:
server.console(f'execute unless loaded ~{dx} ~ ~{dz} run say unloaded')
server.console(f'say poll {poll}')
server.wait_for(rf'\[Server\] poll {poll}$', timeout=max(1, deadline - time.time()))
if not any(l.endswith('[Server] unloaded') for l in server.lines[start:]):
break
time.sleep(2)
def game_time():
start = len(server.lines)
server.console('time query gametime')
while time.time() < deadline:
for line in server.lines[start:]:
if m := re.search(r'The (?:game )?time is (\d+)', line):
return int(m.group(1))
time.sleep(0.2)
raise AssertionError(f'{server.log_path.name}: no game time in {timeout} s')
until = game_time() + ticks
while game_time() < until:
time.sleep(2)
def legacy_ping(port):
"""The reply to a 1.6 client's 0xFE 0x01 0xFA MC|PingHost query (LegacyQueryHandler)."""
host = 'localhost'
@@ -330,9 +360,14 @@ def main():
# Vanilla keeps no spawn chunks: force-load the area the client is
# sent and its neighbours (the console stands at the world spawn) so
# both servers load full chunks instead of finishing proto-chunks.
# Random ticks change blocks while the client is being sent its
# chunks, more of them the busier the machine: none, so both servers
# send the world as it was saved.
server.console('gamerule random_tick_speed 0')
server.wait_for(r'random_tick_speed', timeout=30)
server.console('forceload add ~-80 ~-80 ~80 ~80')
server.wait_for(r'chunks in the Overworld are now force loaded|forceloaded|force loaded', timeout=60)
time.sleep(20)
settle(server)
server.console('forceload remove all')
server.console('save-all flush')
server.wait_for(r'Saved the game', timeout=120)
+2 -1
View File
@@ -23,7 +23,8 @@ Case kinds (`tools/hud_parity_cases.py`), drawn round-robin:
overlays extractCameraOverlays (vignette, spyglass and scopeScale,
pumpkin, powder snow, portal, nausea) and extractSleepOverlay
chat ChatComponent: wrapping (StringSplitter, indents), fades,
tags, scale, width, height and spacing options
tags, scale, width, height and spacing options, focused
(the chat screen open: foreground, scrolled, scroll bar)
test_hud_parity.py [--count N] [--detail N] [--kind K]
"""
+28 -3
View File
@@ -186,6 +186,28 @@ def scenarios():
'mob minecraft:wandering_trader 0.5 -60 0.5 0 104 persistent',
'mob minecraft:trader_llama 3.5 -60 1.5 0 105 persistent leashto=0 strength=2',
'mob minecraft:trader_llama 3.5 -60 -1.5 0 106 persistent leashto=0 strength=4'])
# Copper golems sorting chests (TransportItemsBetweenContainers): from a copper chest to a chest,
# skipping a chest without the carried item, queueing at a chest another golem has open, a double
# chest, a blocked copper chest, a part-full chest, and idling with nothing to carry.
def chest(x, z, slots='-', kind='chest', facing='north', half='single', y=-60):
return f'chest {x} {y} {z} minecraft:{kind}[facing={facing},type={half},waterlogged=false] {slots}'
golem = 'mob minecraft:copper_golem {} -60 {} {} {} persistent cooldown=0'
add('golem_copper_to_chest', 600, [chest(4, 0, 'cobblestone*20,-,iron_ingot*5', 'copper_chest'),
chest(-4, 3), golem.format(0.5, 0.5, 0, 111)])
add('golem_skips_other_items', 700, [chest(4, 0, 'cobblestone*40', 'copper_chest'),
chest(-3, 0, 'dirt*3'), chest(-6, 5, 'cobblestone*10'),
golem.format(0.5, 0.5, 90, 112)])
add('golem_queue', 600, [chest(3, 0, 'oak_log*48,stick*7', 'copper_chest'), chest(-4, 0),
golem.format(0.5, 0.5, 0, 113), golem.format(0.5, 3.5, 180, 114)])
add('golem_double_chest', 600, [chest(4, 0, 'apple*30', 'exposed_copper_chest'),
chest(-4, 2, '-', 'chest', 'north', 'left'), chest(-5, 2, 'apple*2', 'chest', 'north', 'right'),
golem.format(0.5, 0.5, 0, 115)])
add('golem_blocked_chest', 400, [chest(3, 0, 'sand*5', 'copper_chest'), 'block 3 -59 0 minecraft:stone',
chest(-5, -2, 'gravel*9', 'oxidized_copper_chest'), chest(0, 6),
golem.format(0.5, 0.5, 0, 116)])
add('golem_part_full', 500, [chest(-3, 1, 'cobblestone*60,cobblestone*64,-,cobblestone*63'),
'mob minecraft:copper_golem 0.5 -60 0.5 0 117 persistent cooldown=0 hand=cobblestone*16'])
add('golem_idle', 400, ['player 4.5 -60 2.5', 'mob minecraft:copper_golem 0.5 -60 0.5 0 118 persistent'])
return s
@@ -205,7 +227,7 @@ def write_scenarios(path, chosen):
elif f[0] == 'mob':
f[2] = repr(float(f[2]) + ox)
f[4] = repr(float(f[4]) + oz)
elif f[0] in ('block', 'heart'):
elif f[0] in ('block', 'heart', 'chest'):
f[1] = str(int(f[1]) + ox)
f[3] = str(int(f[3]) + oz)
elif f[0] == 'fill':
@@ -240,6 +262,9 @@ def parse(path):
if parts[1] == 'heart':
cur.setdefault('hearts', {}).setdefault(t, []).append(line.split(' ', 2)[2])
continue
if parts[1] == 'chest':
cur.setdefault('chests', {}).setdefault(t, []).append(parts[2])
continue
mob = int(parts[1])
row = {}
if len(parts) > 2:
@@ -333,8 +358,8 @@ def compare(vanilla, rust, fields=None):
report.append(f'{name}: hearts differ at tick {t}: vanilla {v.get("hearts", {}).get(t)} | horizon {r.get("hearts", {}).get(t)}')
clean = False
break
# Sounds and watched block changes: first differing tick.
for kind in ('sounds', 'blocks'):
# Sounds, watched block changes and chest contents: first differing tick.
for kind in ('sounds', 'blocks', 'chests'):
va, ra = v.get(kind, {}), r.get(kind, {})
for t in sorted(set(va) | set(ra)):
if va.get(t, []) != ra.get(t, []):
+98
View File
@@ -0,0 +1,98 @@
#!/usr/bin/env python3
"""Compare the resource pack screen's selection with the vanilla client's.
Each case is a pack repository (packs required or not, added at the top or
the bottom, fixed in place or not, compatible, too old or too new), an
initial selection as options.txt stores it, and the actions the screen's
entries take on a click or key press: select (an incompatible pack only when
its confirmation is accepted), unselect, move up, move down. The Java oracle
(VanillaPackSelectionOracle) runs vanilla's PackRepository and
PackSelectionModel; examples/pack_selection_fixture runs
horizon_client::packs::SelectionModel, which the game's pack screen uses.
After every action both lists, in order, with each entry's canSelect,
canUnselect, canMoveUp and canMoveDown, and the selection committed at the
end must agree.
test_pack_selection_parity.py [--count N] [--detail N]
"""
import argparse
import json
import os
import random
import subprocess
import sys
try:
from . import lab, test_rust_parity as base, test_model_baking_parity as baking
except ImportError:
import lab
import test_rust_parity as base
import test_model_baking_parity as baking
PARITY = lab.ROOT / 'mods/horizon/src/test/java/dev/horizonlab/parity'
IDS = ['vanilla', 'programmer_art', 'file/Faithful.zip', 'file/alpha', 'file/Zeta pack', 'file/zeta', 'file/é',
'file/0', 'server', 'world', 'fabric', 'file/a.zip', 'file/A.zip', 'file/b']
def cases(count):
rng = random.Random(0x5041434B)
out = []
for _ in range(count):
ids = rng.sample(IDS, rng.randint(1, 9))
packs = [{'id': i, 'required': rng.random() < 0.2, 'position': rng.choice(['top', 'top', 'bottom']),
'fixed': rng.random() < 0.2, 'compat': rng.choice(['compatible'] * 4 + ['old', 'new'])} for i in ids]
selected = rng.sample(ids + ['file/missing'], rng.randint(0, len(ids)))
ops = [{'list': rng.choice(['selected', 'unselected']), 'index': rng.randint(-2, 8),
'op': rng.choice(['activate', 'activate', 'up', 'down']), 'confirm': rng.random() < 0.5}
for _ in range(rng.randint(0, 16))]
out.append({'packs': packs, 'selected': selected, 'ops': ops})
return out
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--count', type=int, default=4000)
parser.add_argument('--detail', type=int, default=3)
args = parser.parse_args()
lock, jars, _ = base.verify_artifacts()
libraries = baking.client_libraries()
build = lab.LOCAL / 'rust-pack-selection-parity'; build.mkdir(parents=True, exist_ok=True)
chosen = cases(args.count)
inputs = build / 'inputs.jsonl'; inputs.write_text(''.join(json.dumps(c) + '\n' for c in chosen))
classes = build / 'classes'; classes.mkdir(exist_ok=True)
dependencies = os.pathsep.join(map(str, [jars['client'], *libraries]))
def run(command, name):
with (build / (name + '.log')).open('w') as log:
result = subprocess.run(list(map(str, command)), cwd=lab.ROOT, timeout=3600, stdout=log, stderr=subprocess.STDOUT)
if result.returncode:
print((build / (name + '.log')).read_text()[-4000:]); sys.exit(f'{name} failed')
run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-nowarn', '-cp', dependencies, '-d', classes,
*(PARITY / f'{n}.java' for n in ('ParityData', 'VanillaPackSelectionOracle'))], 'compile-java')
run(['java', '-Xmx1G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaPackSelectionOracle',
inputs, build / 'vanilla.jsonl'], 'vanilla')
run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'pack_selection_fixture', '--',
inputs, build / 'rust.jsonl'], 'rust')
vanilla = [json.loads(l) for l in (build / 'vanilla.jsonl').read_text().splitlines()]
rust = [json.loads(l) for l in (build / 'rust.jsonl').read_text().splitlines()]
assert len(vanilla) == len(rust) == len(chosen)
errors = [v['error'] for v in vanilla if 'error' in v]
bad = [(c, v, r) for c, v, r in zip(chosen, vanilla, rust) if 'error' not in v and v != r]
for e in sorted(set(errors))[:5]:
print('ORACLE ERROR', e)
for c, v, r in bad[:args.detail]:
print('MISMATCH', json.dumps(c))
step = next((i for i, (a, b) in enumerate(zip(v['steps'], r['steps'])) if a != b), None)
if step is None:
print(f' committed: vanilla {v["committed"]} | horizon {r["committed"]}')
else:
print(f' after action {step}: vanilla {v["steps"][step]}\n horizon {r["steps"][step]}')
steps = sum(len(v.get('steps', [])) for v in vanilla)
print(f'{len(chosen) - len(bad) - len(errors)}/{len(chosen)} pack selections match ({steps} states); {len(errors)} oracle errors')
if bad or errors:
sys.exit(1)
print('pack selection parity ok')
if __name__ == '__main__':
main()
+10
View File
@@ -52,6 +52,12 @@ IGNORED = {
r'^chunk\.LastUpdate$': 'game time of the save (Horizon saves at its own time)',
r'^chunk\.InhabitedTime$': 'ticks the chunk was loaded; differs by the time Horizon ran',
r'^chunk\.isLightOn$': 'light is recomputed by vanilla when absent',
# Vanilla's server (view distance 4) leaves a border of proto chunks; Horizon's
# render distance 6 may finish some, as vanilla does when it loads the world at
# that distance. Their blocks are still compared; only what a full chunk saves
# differently (no worldgen heightmaps, entities in entities/) is accepted.
r'^chunk\.promoted\.(Status|Heightmaps\.(OCEAN_FLOOR_WG|WORLD_SURFACE_WG)|entities)$':
'a proto chunk vanilla left at its view distance, finished by Horizon',
# Horizon keeps simulating between loading and saving (it needs a few seconds of
# chunk generation first), so counters and positions of live things move on.
r'^chunk\.block_entities\.\(2, -60, 5\)\.(cooking_time_spent|lit_time_remaining|Items\[\]\.count)$':
@@ -445,6 +451,10 @@ def compare_chunks(vanilla, horizon, report):
ha, hs = normalize_chunk(horizon[key])
out = []
diff(va, ha, 'chunk', out)
if va.get('Status') != 'minecraft:full' and ha.get('Status') == 'minecraft:full':
promoted = re.compile(r'^chunk\.(Status|Heightmaps\.\w+_WG|entities)$')
out = [(path.replace('chunk.', 'chunk.promoted.', 1) if promoted.match(path) else path, p, q)
for path, p, q in out]
for y in sorted(set(vs) | set(hs)):
empty = {'blocks': ['minecraft:air'] * 4096, 'biomes': None, 'BlockLight': None, 'SkyLight': None}
a, b = vs.get(y, empty), hs.get(y, empty)
+112 -4
View File
@@ -4,7 +4,8 @@
The Java oracle (VanillaTabListOracle) runs vanilla's own
PlayerTabOverlay.extractRenderState, frame after frame, on a stand-in client
whose connection lists the case's players (game mode, latency, display name,
list order, hat layer, online mode for heads), whose level holds some of
list order, hat layer, online mode for heads, skins from each profile's signed or
unsigned `textures` property through a real SkinManager), whose level holds some of
them (upside-down Dinnerbone and Grumm) and whose real Scoreboard has the
case's teams (colour, prefix, suffix), `list` objective (integer or hearts,
number formats) and scores, with the header, footer, row background option
@@ -12,9 +13,16 @@ and Hud ticks. It records every fill, text (as styled runs), sprite and
face blit. `examples/tab_list_fixture` lays out the same frames with
`horizon_client::tab_list`; the ordered call lists must agree.
Downloaded skin images are compared too: VanillaSkinImageOracle decodes
PNGs as NativeImage does and runs SkinTextureDownloader.processLegacySkin;
`examples/skin_image_fixture` runs `horizon_client::skins`. Pixels must agree.
test_tab_list_parity.py [--count N] [--detail N]
"""
import argparse
import base64
import struct
import zlib
import json
import os
import random
@@ -68,6 +76,45 @@ def number_format(rng):
return {'type': 'fixed', 'value': component(rng, 1)}
TEXTURE_URIS = ['https://textures.minecraft.net/texture/{textureId}', 'http://textures.minecraft.net/texture/{textureId}']
def textures_property(rng, name, hashes):
"""A `textures` profile property: base64 JSON naming skin, cape and
elytra URLs (some outside the allowed domains or malformed), signed
validly, invalidly or not at all."""
def url():
h = rng.choice(hashes)
return rng.choice([
'http://textures.minecraft.net/texture/' + h, 'https://textures.minecraft.net/texture/' + h,
'http://textures.minecraft.net/texture/' + h + '.png', 'https://textures.minecraft.net/texture/' + h + '?v=2',
'https://evil.example.net/texture/' + h, 'http://textures.minecraft.net.evil/texture/' + h,
'http://textures.minecraft.net/texture/a/b/' + h + '#frag'])
textures = {}
if rng.random() < 0.9:
textures['SKIN'] = {'url': url()}
if rng.random() < 0.4:
textures['SKIN']['metadata'] = {'model': 'slim'}
if rng.random() < 0.25:
textures['CAPE'] = {'url': url()}
if rng.random() < 0.08:
textures['ELYTRA'] = {'url': url()}
if rng.random() < 0.03:
textures['SKIN'] = {}
payload = {'timestamp': rng.randint(0, 2**41), 'profileId': uuid.UUID(int=rng.getrandbits(128)).hex,
'profileName': name, 'textures': textures}
if rng.random() < 0.2:
payload['signatureRequired'] = True
text = rng.choice([json.dumps(payload)] * 12 + ['not json', 'null', '', '{"textures": {}}', '[1, 2]'])
value = base64.b64encode(text.encode()).decode()
kind = rng.random()
if kind < 0.05:
value = value.rstrip('=')
elif kind < 0.08:
value = rng.choice(['%%%', 'abc', 'YQ==YQ==', value + '!'])
return {'value': value, 'signature': rng.choice([None, 'valid', 'valid', 'invalid'])}
def cases(count):
rng = random.Random(0x544142)
out = []
@@ -79,6 +126,7 @@ def cases(count):
rng.choice('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_') for _ in range(rng.randint(1, 16)))
if name.lower() not in {x.lower() for x in names}:
names.append(name)
hashes = [''.join(rng.choice('0123456789abcdef') for _ in range(64)) for _ in range(rng.randint(1, 12))]
players = []
for name in names:
players.append({
@@ -88,7 +136,9 @@ def cases(count):
'displayName': component(rng, rng.randint(1, 2)) if rng.random() < 0.2 else None,
'listOrder': rng.choice([0, 0, 0, 1, -1, 5, 2147483647, -2147483648]),
'showHat': rng.random() < 0.8, 'inLevel': rng.random() < 0.5,
'textures': textures_property(rng, name, hashes) if rng.random() < 0.75 else None,
})
downloads = {h: rng.choice(['ok'] * 20 + ['fail'] * 3 + ['pending']) for h in hashes if rng.random() < 0.9}
teams = []
for t in range(rng.choice([0, 0, 1, 2, 4])):
members = [p['name'] for p in players if rng.random() < 0.3]
@@ -125,7 +175,45 @@ def cases(count):
out.append({'width': rng.choice([427, 320, 480, 640, 961, 160, 90, 300]), 'onlineMode': rng.random() < 0.7,
'backgroundForChatOnly': rng.random() < 0.8, 'opacity': rng.choice([0.5, 0.0, 1.0, 0.37]),
'header': header, 'footer': footer, 'teams': teams, 'objective': objective, 'players': players,
'frames': frames})
'frames': frames, 'downloads': downloads,
'local': rng.choice(players)['uuid'] if rng.random() < 0.3 else None,
'validUris': rng.choice([TEXTURE_URIS] * 6 + [TEXTURE_URIS[:1], []])})
return out
def png(width, height, color_type, depth, rows):
"""A PNG of the given colour type (0 grey, 2 RGB, 4 grey+alpha, 6 RGBA)."""
def chunk(kind, data):
return struct.pack('>I', len(data)) + kind + data + struct.pack('>I', zlib.crc32(kind + data))
raw = b''.join(b'\0' + row for row in rows)
return (b'\x89PNG\r\n\x1a\n' + chunk(b'IHDR', struct.pack('>IIBBBBB', width, height, depth, color_type, 0, 0, 0))
+ chunk(b'IDAT', zlib.compress(raw)) + chunk(b'IEND', b''))
def skin_images(count):
"""Downloaded skins: 64x32 legacy and 64x64 ones in every 8-bit colour
type (and 16-bit RGBA), with opaque, clear and mixed hat layers, and a
few sizes vanilla refuses."""
rng = random.Random(0x534B494E)
out = []
for _ in range(count):
width, height = rng.choice([(64, 32)] * 5 + [(64, 64)] * 5 + [(32, 32), (64, 48), (128, 64), (64, 128), (1, 1)])
color_type, depth = rng.choice([(6, 8)] * 6 + [(2, 8), (0, 8), (4, 8), (6, 16)])
channels = {0: 1, 2: 3, 4: 2, 6: 4}[color_type]
alpha = rng.choice(['opaque', 'clear', 'mixed', 'random'])
rows = []
for y in range(height):
row = bytearray()
for x in range(width):
px = [rng.randrange(256) for _ in range(channels)]
if color_type in (4, 6):
a = {'opaque': rng.randint(128, 255), 'clear': 0, 'mixed': rng.choice([0, 255, 127, 128]),
'random': rng.randrange(256)}[alpha]
px[-1] = a
for v in px:
row += bytes([v, rng.randrange(256)]) if depth == 16 else bytes([v])
rows.append(bytes(row))
out.append(base64.b64encode(png(width, height, color_type, depth, rows)).decode())
return out
@@ -133,6 +221,7 @@ def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--count', type=int, default=1000)
parser.add_argument('--detail', type=int, default=3)
parser.add_argument('--images', type=int, default=400)
args = parser.parse_args()
lock, jars, _ = base.verify_artifacts()
libraries = baking.client_libraries()
@@ -149,11 +238,30 @@ def main():
if result.returncode:
print((build / (name + '.log')).read_text()[-4000:]); sys.exit(f'{name} failed')
run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-nowarn', '-cp', dependencies, '-d', classes,
*(PARITY / f'{n}.java' for n in ('ParityData', 'ParityFont', 'VanillaTabListOracle'))], 'compile-java')
*(PARITY / f'{n}.java' for n in ('ParityData', 'ParityFont', 'VanillaTabListOracle', 'VanillaSkinImageOracle'))], 'compile-java')
run(['java', '-Xmx2G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaTabListOracle',
inputs, build / 'vanilla.jsonl'], 'vanilla')
run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'tab_list_fixture', '--',
resources, inputs, build / 'rust.jsonl'], 'rust')
images = build / 'skins.txt'; images.write_text(''.join(i + '\n' for i in skin_images(args.images)))
run(['java', '-Xmx1G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaSkinImageOracle',
images, build / 'vanilla-skins.txt'], 'vanilla-skins')
run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'skin_image_fixture', '--',
images, build / 'rust-skins.txt'], 'rust-skins')
vanilla_skins = (build / 'vanilla-skins.txt').read_text().splitlines()
rust_skins = (build / 'rust-skins.txt').read_text().splitlines()
assert len(vanilla_skins) == len(rust_skins) == args.images
skin_bad = [i for i, (a, b) in enumerate(zip(vanilla_skins, rust_skins)) if a != b]
for i in skin_bad[:args.detail]:
a, b = vanilla_skins[i], rust_skins[i]
if 'refused' in (a, b):
print(f'SKIN MISMATCH image {i}: vanilla {a[:20]}, horizon {b[:20]}')
else:
a, b = base64.b64decode(a), base64.b64decode(b)
k = next(k for k in range(min(len(a), len(b))) if a[k] != b[k]) // 4
print(f'SKIN MISMATCH image {i}: pixel ({k % 64}, {k // 64}) vanilla {a[k*4:k*4+4].hex()} horizon {b[k*4:k*4+4].hex()}')
print(f'{args.images - len(skin_bad)}/{args.images} processed skin images match '
f'({sum(v == "refused" for v in vanilla_skins)} refused)')
vanilla = [json.loads(l) for l in (build / 'vanilla.jsonl').read_text().splitlines()]
rust = [json.loads(l) for l in (build / 'rust.jsonl').read_text().splitlines()]
assert len(vanilla) == len(rust)
@@ -175,7 +283,7 @@ def main():
print(f' frame {i}, call {k} ({la} vanilla, {lb} Horizon calls)\n vanilla {a}\n horizon {b}')
print(f'{len(vanilla) - len(bad) - len(errors)}/{len(vanilla)} player lists match ({frames} frames, {calls} calls); '
f'{len(errors)} oracle errors')
if bad or errors:
if bad or errors or skin_bad:
sys.exit(1)
print('tab list parity ok')