@nori-zk/mina-token-bridge
Version:
Nori ethereum state settelment and nETH token bridge zkApp
31 lines (30 loc) • 1.58 kB
TypeScript
/**
* NoriTokenBridge — eviction-witness regression test
*
* Reproduces the audit finding on the deposit-root rolling window.
*
* update()/adminSetDepositRoot() forward a caller-supplied `oldestAction` to
* dispatchAndEvict(); when the window is full they advance `windowStart` to
* advanceActionState(windowStart, singleActionInnerHash(oldestAction))
* WITHOUT verifying that `oldestAction` is the real oldest action in the
* window. A caller can pass a bogus value, moving `windowStart` to an
* action-state hash that exists nowhere on the real action chain. From then
* on getActions({ fromActionState: windowStart }) returns nothing, so
* noriMint() can never rebuild the window — the mint flow is bricked.
*
* This test fills the window, then dispatches one more deposit root with a
* BOGUS oldestAction and asserts the window stays healthy and the deposit is
* still mintable. It FAILS on the unfixed contract (windowStart is poisoned)
* and passes once eviction derives the oldest action in-circuit.
*
* NOTE (4279a fix): the attack surface described above no longer exists.
* dispatchAndEvict() now derives the oldest action in-circuit via
* reducer.reduce(); there is no caller-supplied oldestAction parameter
* to exploit. This test remains as a regression guard: it confirms the
* window stays healthy after eviction without any caller input.
*
* Self-contained: own LocalBlockchain (proofsEnabled: false), deploy and a
* single test. Requires the test-only `adminSetDepositRoot` method to be
* enabled on the contract.
*/
export {};