The treasury holds eight independent token balances. It accepts a settlement if four weighted sums of the balance changes are zero.
These are , so they don't prove that each asset was repaid. The exploit needs no reentrancy, overflow, forged tokens, or admin privileges. The checks read real balances and still accept the wrong state.
four linear constraints on eight unknowns
Let d[i] be the player's net token gain during a crossing. A positive value means the player takes tokens, and a negative value means the player settles them. The treasury's change is -d[i]. Define:
D(x) = d[0] + d[1]x + ... + d[7]x^7
The four checks accept a crossing exactly when D vanishes at the four weights.
Note
Negating every coefficient still leaves D zero at the weights. The sign convention still matters when you implement take and settle.
Every accepted integer polynomial of degree at most seven has this form:
D0(x) = P0(x) (a + bx + cx^2 + dx^3)D1(x) = P1(x) (e + fx + gx^2 + hx^3)
The quotients have integer coefficients, because dividing by a monic integer polynomial preserves integrality. This form covers every possible net settlement, including the zero settlement, so there is no need to guess a convenient vector.
Several shortcuts fail. A rational nullspace vector may require fractional tokens, and rounding it breaks the checks. Scaling a vector may break the cargo limits. Maximizing the first withdrawal can spend assets that the second crossing needs.
These bounds are finite and come from the instance itself, so no guessed search range is required. Once a quotient is complete, check all eight token bounds. Then search the second crossing using the resulting purse.
There are 11 feasible first-crossing net vectors, and only one of them extends to a winning second crossing. Both first routes that collect 420 Obol-0 are dead ends, and the zero route also strands the player.
Important
Uniqueness applies to the pair of net vectors. Several call orderings can produce those same vectors, so no single transaction trace is claimed to be unique.
All four evaluations of each D are exactly zero over the integers, with no modular wraparound or unchecked arithmetic.
The first crossing obtains exactly the 23 Obol-4 that the second payment of 675 is missing. It also keeps exactly the 25 Obol-6 that the second crossing settles.
Deploy a helper that implements ICrossing. Bind it to the assigned Setup and player, and restrict its entry point to that player.
Transfer the purse to the helper: 346 Obol-3, 652 Obol-4, and 39 Obol-6.
Have the helper approve the ferry to pull settlement tokens.
Call ferry.cross(). In onCrossing(0), settle 346 of token 3 and 14 of token 6. Take 210 of token 0, 173 of token 1, 237 of token 2, 23 of token 4, 52 of token 5, and 1 of token 7.
Call ferry.cross() again. In onCrossing(1), settle 675 of token 4 and 25 of token 6. Take 1155 of token 0, 269 of token 1, 505 of token 2, 479 of token 3, 211 of token 5, and 1 of token 7.
Transfer the remaining tokens to the assigned player.
Read Setup.isSolved(), which should return true. The organizer then releases the flag.
Both crossings can run inside one outer transaction. If the second crossing fails, the first one rolls back too.
Tip
Validate the callback sender inside onCrossing.
private/ReferencePlayer.sol implements this reference harness. Players must build their own helper and don't receive this file.
600 is the proposed capstone score. Calibrate it through blind playtests, not by counting stages. If first- and second-year teams are allowed to use LLMs, playtest with those same tools enabled.
This challenge is not claimed to resist LLM solving. Don't pad it with obscure encodings or extra computation just to slow down AI-assisted teams.
If representative teams finish very quickly, reconsider the score. If no team can finish within 150 minutes, release the hints sooner.
The scenario, contract, numerical construction, and coupled inventory route were written for this repository. They don't reuse the solutions from other challenges in the set:
the bank's fork parsing
hidden audio
IPFS provenance
share inflation
voting
delegatecall storage collision
Polynomial factorization and deficient linear checks are established mathematics. The challenge makes no claim of a new primitive, or of being unique among all CTFs.
Fixed public weighted sums don't prove that every component of an adversarial vector is zero. Checking all eight per-token changes independently closes this flaw.
A cryptographic commitment protocol would need its own soundness argument.
Separate editions
The Charons-Counterweight-Simplified-files folder holds the six-coin, single-crossing student edition. Don't mix its artifacts with this edition, and don't distribute it as a hint during the harder challenge.
Flag
The flag format is rvcectf{...}. The flag for this edition is rvcectf{f0ur_b4l4nc3s_d0_n0t_c0unt_31ght_c01ns}.