Sponsor: Implausible:- Whenever strategicFetchObservations can be called, it will update the mainnet state, whenever the first fetch is called, the second will most probably revert (as no cooldown time has passed, and the twap hasn't changed significally)
- Every strategic fetch is permissionlessly bridgeable, keepers are rewarded to bridge the lastBridgeNonce+1
- Fetch and broadcast are separate processes (and have 2 separate tracked nonces)
Should
lastBridgeNonce be less than
lastObservedNonce, keepers are rewarded to bridge 1 by 1 each msg until both nonces match. Should they already match, keepers will have to wait until another observation to be rewarded for bridging.
Contest Manager:Let's name two
work functions from
StrategyJob.sol as
fetch_work and
send_work.
Let's say a keeper calls
fetch_work. This increases
_lastPoolStateObserved.poolNonce.
Time passes.
The keeper calls
fetch_work again. This increases
_lastPoolStateObserved.poolNonce again.
Now we have two observations with
nonce1 and
nonce2 and they are both not yet sent through the bridge.
Can we now call
send_work to send both observations through the bridge? This is answered by the
_workable(), which checks the following:
- If _lastPoolNonceBridged == 0, then _poolNonce == _lastPoolNonceObserved is checked
- Otherwise, _poolNonce == ++_lastPoolNonceBridged is checked
In (2) case,
nonce1 is expected to be
_lastPoolNonceBridged+1. This is OK.
In (1) case,
nonce1 should be equal to
_lastPoolStateObserved.poolNonce. This is not the case because the
_lastPoolStateObserved.poolNonce is equal to
nonce2 now. So, in the initial stage, when we have not yet sent anything through the bridge, we cannot send
nonce1. But can we send
nonce2? It seems not, because on the other side of the bridge
nonce1 is expected.
Sponsor:Ok, there's an edge case where that could happen.
Should we redeploy the Job, the
lastNonceBridged will be initialized to 0, if that situation you point happens, the keeper will be able to send any of the 2 nonces. If he sends the 2nd, then he will not be able to send the 1st (as the job initializes with the most recent one at the time of bridging).
keeper:
sendWork(2) -> works on mainnet -> reverts on sidechain (missing nonce 1 yet)
keeper:
sendWork(1) -> reverts on mainnet (old nonce)
keeper:
sendWork(3) -> should work on mainnet
the case is, only when swapping jobs (redeploying), counting that the last one didn't yet broadcast nonce
1when naturally initializes (job is the 1st one):
keeper:
sendWork(2) -> works on mainnet -> works on sidechain (initializes pool at nonce 2)
keeper:
sendWork(3) -> should work
in any case, the fetch and send job won't be stopped. What will be stopped is the sync between rewards in mainnet and sidechain, having to be manually fixed.
I'd put it under possible manual-fixable-out-of-service under operational change.