Repository navigation
Register the battle operator kind; define the fills hash fh (SPEC 7.2.1) - #5
Merged
Merged
Conversation
Battles get their own anchor kind (SPEC 2.1, 2.2, 7.5, 8, 9.1): operator signer,
id = the 4-hour UTC window YYYY-MM-DDTHH (HH in 00 04 08 12 16 20, a real date),
count = leaves, at most 10000. A battle belongs to the window its results were
frozen in; an empty window is not anchored; splitting a busier window is not
defined in v1.
- battle leaf: {v,k,id,b,rank,u,h,eq,pct,tr,out,fin,fh}, fh as in the cup leaf
- SDK: battleLeaf (refuses input outside the schema), battleLeafProblem,
isBattleLeaf, isBattleWindowId, kindRuleViolation, MAX_BATTLE_LEAVES;
parseMemo / formatMemo apply the window rule and the cap to battle only
- battle appended at the end of KINDS lists and ANCHOR_KINDS
- vectors appended (kinds, battle, 3 valid + 11 invalid memos); every existing
vector entry is unchanged (git diff: 0 removed lines)
- the longest valid memo stays 164 bytes; a battle memo is at most 106
The cup and battle `fh` is now defined so it can be reproduced independently:
lowercase hex SHA-256 of the canonical JSON array of the player's fills, in
submission order followed by the final sweep's liquidations, one object per fill
with exactly {seq,t,symbol,side,kind,orderType,qty,price,fee,realized,net,leverage}
(qty 10 decimals; price, fee, realized, net 8; toFixed rounding; no negative zero).
An empty list is [] (4f53cda1...b945).
For cups this is a clarification of what the app has computed since the first
cup anchor: no anchor, leaf, schema or vector changed (9.1). 7.5 and section 8
reference 7.2.1.
- SDK: fillsHash, fillsCanonical, fillsCommitment, CUP_ORDER_TYPES,
BATTLE_ORDER_TYPES, with input validation
- vectors appended (fillsHash: empty, three fills, negative zero); every
pre-existing entry is unchanged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the
battleoperator kind to the v1 registry before its first mainnet anchor (SPEC section 9), and writes down the fills hashfhso anyone can reproduce it independently.Battle kind
battle, operator signer.idis a 4-hour UTC windowYYYY-MM-DDTHH, with HH in 00/04/08/12/16/20. It is checked strictly as a real calendar date.b,eq,fh,fin,h,id,k,out,pct,rank,tr,u,v.KINDSandANCHOR_KINDS.battleonly. Every other kind behaves exactly as before.fh (SPEC 7.2.1)
fh= SHA-256 (lowercase hex) of the canonical JSON array of the player's fills: submission order, then the final sweep's liquidations.4f53cda1…b945.fillsHash(withfillsCanonicalandfillsCommitment).Vectors
Appended only. Every one of the 139 pre-existing entries is byte-identical. The new entries are:
fhvectors: empty, 3 fills, and negative zero.The new SHA-256 of
test-vectors/v1.jsonis7681b3ee…99f6. The ChartRunner app pins the same file, and its own fills digest reproduces all threefhvectors.Checks
233 tests, build, lint, typecheck,
vectors:checkandexamples: all pass. An independent review checked the spec and app agreement before thefhdefinition was added.