Closed jgsbennett closed 1 year ago
After discussing with @jgsbennett and going through everything in detail, we've confirmed that the orders are submitted, and the market data shows an indicative price, supplied stake > target stake (ie the market is ready to leave opening auction), but opening auction doesn't end for another 4 blocks. This delay seems to be consistent across runs, too.
The issue below is explained as the 4 blocks of delay between the orders getting placed and the opening auction ending are due to the price monitoring bounds statevar getting initialised, and waiting for a match. Examining the statevar events shows the event is sent immediately after the data is available, and the match event is emitted 2 blocks later, once the bounds are initialised, the next tick the market leaves opening auction. A block-by-block overview of what's happening, and why opening auction ends later than expected:
Which lines up perfectly with what is found in the event logs when running the tests (e.g. orders submitted on block 458 -> market leaves auction on block 462)
Leaving the issue below as-is for reference/context. Comments relate to that particular issue
While looking in to this issue, another sneaky bug was found. When a market is proposed, we create the market in the execution engine setting the auction state to opening auction, and initialising the auction start time to "now" (ie the block time when the proposal was submitted). When the vote closes, and the market is accepted, the actual opening auction should start, but the auction start time is never updated. This means that markets, once they passed governance, will be able to leave opening auction as soon as vega time >= proposed time + auction duration, rather than vote close time + auction duration (or enactment time). This bug was fixed in the PR referencing this issue
Problem encountered
I have noticed that markets are not as prompt leaving auctions as they could be (or used to be). In tests, the final order that is needed to cause a market to leave auction only results in the market leaving auction 4 blocks later.
Observed behaviour
Market leaves auction blocks after requirements are met
Expected behaviour
Market leaves auction as soon as requirements are met
Steps to reproduce
Software version
e905eb92661d4438d39611660b8e139e0106e539
Failing test
No response
Jenkins run
https://jenkins.vega.rocks/job/common/job/system-tests-wrapper/9032/
Configuration used
No response
Relevant log output