Submitted by RadiantLabs
Part of the reason bonds exist is to refund honest challengers for the gas costs incurred from countering malicious claims. We can observe in the Optimism specs how bond prices are chosen:
As per to Optimism specs, we can see that at MAX_GAME_DEPTH the bond price is specifically chosen to reimburse the winning party for the high gas costs of proposing an LPP if necessary, as the proposer must call addLeavesLPP() many times. The intention is that the honest party creates an LPP and subsequently calls step() to receive the bond of the MAX_GAME_DEPTH claim they are countering.
However, the step() function is actually permissionless: it does not check if the user who proposes an LPP or loads data into the preimage oracle is the caller of step() when it accesses such data, and it always grants the bond to the caller.
This means that an attacker can call step() (and squeezeLPP() before that if necessary, as soon as the challenge period has passed) before the proposer to receive the bond, stealing their reimbursement for the high gas costs of proposing the LPP.
Honest LPP proposers may not be reimbursed for the high gas costs of proposing an LPP, defeating the intended purpose of bonds and leading to misaligned incentives.
If a step() reads from a preimage oracle, the bonds from step() should be assigned to the one that loaded the data into the oracle.
A possible way to do this would be to set a new  variable currentPreimageProposer using a preimageProposer mapping during the readPreimage call, and then read this value from the oracle to find out who to send the step() bond to:
obront (judge) commented:
haxatron (warden) commented:
obront (judge) commented:
clabby (Optimism) commented:
haxatron (warden) commented:
obront (judge) commented:
xuwinnie (warden) commented:
obront (judge) commented:
Optimism confirmed
