vegaprotocol / vega

A Go implementation of the Vega Protocol, a protocol for creating and trading derivatives on a fully decentralised network.
https://vega.xyz
GNU Affero General Public License v3.0
38 stars 22 forks source link

[Bug]: ListMarkets and GetLatestMarketData APIs return inconsistent state information. #11045

Closed cdummett closed 7 months ago

cdummett commented 7 months ago

Problem encountered

The ListMarkets and GetLatestMarketData APIs each report the market state and trading mode. Console raised issue where APIs were reporting conflicting information.

A check was added to market-sim fuzzing tests to capture this inconsistency.

Two CI runs have now captured the issue, replaying the replay file shows the APIs reporting inconsistent data despite calls being made at the same block height.

  1. https://jenkins.vega.rocks/blue/organizations/jenkins/common%2Fvega-market-sim-reinforcement/detail/vega-market-sim-reinforcement/402/pipeline
    
    [2024-03-26T23:44:44.678Z] 2024-03-26 23:44:44,377 - vega_sim.service - INFO - Request to ListMarkets made at datanode block_height=1865.

[2024-03-26T23:44:44.678Z] 2024-03-26 23:44:44,377 - vega_sim.service - INFO - Request to GetLatestMarketData made at datanode block_height=1865.

[2024-03-26T23:44:51.202Z] 2024-03-26 23:44:50,377 - vega_sim.service - WARNING - Market fcc830, market API says state STATE_SUSPENDED but market data API says STATE_ACTIVE.

{ "data": { "marketsConnection": { "edges": [ { "node": { "id": "fcc8308ee675ffeb1255206610b7fb906fddb1a05a5065f1cb8a4bd320f71d18", "state": "STATE_SUSPENDED", "tradingMode": "TRADING_MODE_MONITORING_AUCTION", "data": { "marketState": "STATE_ACTIVE", "marketTradingMode": "TRADING_MODE_CONTINUOUS" } } } ] } } }


2. https://jenkins.vega.rocks/blue/organizations/jenkins/common%2Fvega-market-sim-reinforcement/detail/vega-market-sim-reinforcement/411/pipeline

[2024-03-27T00:13:13.063Z] 2024-03-27 00:13:12,500 - vega_sim.service - INFO - Request to ListMarkets made at datanode block_height=7232.

[2024-03-27T00:13:13.063Z] 2024-03-27 00:13:12,500 - vega_sim.service - INFO - Request to GetLatestMarketData made at datanode block_height=7232.

[2024-03-27T00:13:19.596Z] 2024-03-27 00:13:18,500 - vega_sim.service - WARNING - Market 5ae381, market API says state STATE_SUSPENDED but market data API says STATE_ACTIVE

{ "data": { "marketsConnection": { "edges": [ { "node": { "id": "5ae381e52dd30fb3e2cf3afe4eb971b9834bf46b2b69099f390011450776e430", "state": "STATE_SUSPENDED", "tradingMode": "TRADING_MODE_MONITORING_AUCTION", "data": { "marketState": "STATE_ACTIVE", "marketTradingMode": "TRADING_MODE_CONTINUOUS" } } } ] } } }


### Observed behaviour

- APIs report an inconsistent state and trading mode.

### Expected behaviour

- APIs should report a consistent state and trading mode.

### Steps to reproduce

```bash
1. Replay replay files and check apis

Software version

d3a35a22f37306b84db77bd9853cd5ac8e82cdee

Failing test

vega-market-sim fuzz test

Jenkins run

https://jenkins.vega.rocks/blue/organizations/jenkins/common%2Fvega-market-sim-reinforcement/detail/vega-market-sim-reinforcement/402/pipeline

Configuration used

{
  "genesis_time": "2023-05-09T10:00:00.000000000Z",
  "chain_id": "CUSTOM",
  "initial_height": "0",
  "consensus_params": {
    "block": {
      "max_bytes": "22020096",
      "max_gas": "-1",
      "time_iota_ms": "1"
    },
    "evidence": {
      "max_age_num_blocks": "100000",
      "max_age_duration": "172800000000000",
      "max_bytes": "1048576"
    },
    "validator": {
      "pub_key_types": ["ed25519"]
    },
    "version": {}
  },
  "validators": [
    {
      "address": "7DFD3744A773C166B36F170E4F5EF3E998703F4E",
      "pub_key": {
        "type": "tendermint/PubKeyEd25519",
        "value": "2lPO6I0p5uCBZzeoA2+ECJ2+57LtLVMjXpxH5za9TvE="
      },
      "power": "10",
      "name": ""
    }
  ],
  "app_hash": "",
  "app_state": {
    "assets": {
      "0000000000000000000000000000000000000000000000000000000000000000": {
        "name": "VOTE",
        "symbol": "VOTE",
        "decimals": 5,
        "min_lp_stake": "1",
        "source": {
          "builtin_asset": {
            "max_faucet_amount_mint": "100000000000000000"
          }
        }
      }
    },
    "validators": {
      "6NemqXSfN4zfZvAQeIANflEFqQ98izX9C0KLI2dITSY=": {
        "id": "c2b0ab69fb1bd19862c04df401920ea62d3e0bce41a50148240f42017824d17a",
        "vega_pub_key": "dfcf0fa8d67cfa11b3a511e320f3c47807a5e0735cc06dd9c2bc00f7ccc67117",
        "vega_pub_key_index": 1,
        "ethereum_address": "0x9e5BEEC6E56B28cCbd02864840B0f1e0125e42Ce",
        "tm_pub_key": "6NemqXSfN4zfZvAQeIANflEFqQ98izX9C0KLI2dITSY=",
        "info_url": "",
        "country": "",
        "name": "",
        "avatar_url": ""
      }
    },
    "network": {
      "replay_attack_threshold": 150
    },
    "network_parameters": {
      "blockchains.ethereumConfig": "{\"network_id\": \"3\", \"chain_id\": \"3\", \"collateral_bridge_contract\": { \"address\": \"0xa6F1E140daC13002Dfd9789D6dBA59117c717D7a\" }, \"confirmations\": 50, \"staking_bridge_contract\": { \"address\": \"0xfce2CC92203A266a9C8e67461ae5067c78f67235\", \"deployment_block_height\": 11001702}, \"multisig_control_contract\": {\"address\": \"0xCF6d41235911184fe6F35D47207813bFF3B91601\", \"deployment_block_height\": 12710009 } }",
      "blockchains.ethereumRpcAndEvmCompatDataSourcesConfig": "{\"configs\": []}",
      "governance.proposal.asset.maxClose": "8760h0m0s",
      "governance.proposal.asset.maxEnact": "8760h0m0s",
      "governance.proposal.asset.minClose": "1s",
      "governance.proposal.asset.minEnact": "1s",
      "governance.proposal.asset.minProposerBalance": "1",
      "governance.proposal.asset.minVoterBalance": "1",
      "governance.proposal.asset.requiredMajority": "0.66",
      "governance.proposal.asset.requiredParticipation": "0.00001",
      "governance.proposal.freeform.maxClose": "8760h0m0s",
      "governance.proposal.freeform.minClose": "1s",
      "governance.proposal.freeform.minProposerBalance": "1",
      "governance.proposal.freeform.minVoterBalance": "1",
      "governance.proposal.freeform.requiredMajority": "0.66",
      "governance.proposal.freeform.requiredParticipation": "0.00001",
      "governance.proposal.market.maxClose": "8760h0m0s",
      "governance.proposal.market.maxEnact": "8760h0m0s",
      "governance.proposal.market.minClose": "1s",
      "governance.proposal.market.minEnact": "2s",
      "governance.proposal.market.minProposerBalance": "1",
      "governance.proposal.market.minVoterBalance": "1",
      "governance.proposal.market.requiredMajority": "0.66",
      "governance.proposal.market.requiredParticipation": "0.00001",
      "governance.proposal.updateAsset.maxClose": "720h",
      "governance.proposal.updateAsset.maxEnact": "720h",
      "governance.proposal.updateAsset.minClose": "1s",
      "governance.proposal.updateAsset.minEnact": "1s",
      "governance.proposal.updateAsset.minProposerBalance": "1",
      "governance.proposal.updateAsset.minVoterBalance": "1",
      "governance.proposal.updateAsset.requiredMajority": "0.66",
      "governance.proposal.updateAsset.requiredParticipation": "0.09",
      "governance.proposal.updateMarket.maxClose": "8760h0m0s",
      "governance.proposal.updateMarket.maxEnact": "8760h0m0s",
      "governance.proposal.updateMarket.minClose": "1s",
      "governance.proposal.updateMarket.minEnact": "1s",
      "governance.proposal.updateMarket.minProposerBalance": "1",
      "governance.proposal.updateMarket.minProposerEquityLikeShare": "0",
      "governance.proposal.updateMarket.minVoterBalance": "1",
      "governance.proposal.updateMarket.requiredMajority": "0.66",
      "governance.proposal.updateMarket.requiredMajorityLP": "0.66",
      "governance.proposal.updateMarket.requiredParticipation": "0.00001",
      "governance.proposal.updateMarket.requiredParticipationLP": "0",
      "governance.proposal.updateNetParam.maxClose": "8760h0m0s",
      "governance.proposal.updateNetParam.maxEnact": "8760h0m0s",
      "governance.proposal.updateNetParam.minClose": "1s",
      "governance.proposal.updateNetParam.minEnact": "1s",
      "governance.proposal.updateNetParam.minProposerBalance": "1",
      "governance.proposal.updateNetParam.minVoterBalance": "1",
      "governance.proposal.updateNetParam.requiredMajority": "0.5",
      "governance.proposal.updateNetParam.requiredParticipation": "0.00001",
      "governance.proposal.referralProgram.maxClose": "8760h0m0s",
      "governance.proposal.referralProgram.maxEnact": "8760h0m0s",
      "governance.proposal.referralProgram.minClose": "1s",
      "governance.proposal.referralProgram.minEnact": "1s",
      "governance.proposal.referralProgram.minProposerBalance": "1",
      "governance.proposal.referralProgram.minVoterBalance": "1",
      "governance.proposal.referralProgram.requiredMajority": "0.5",
      "governance.proposal.referralProgram.requiredParticipation": "0.00001",
      "governance.proposal.VolumeDiscountProgram.maxClose": "8760h0m0s",
      "governance.proposal.VolumeDiscountProgram.maxEnact": "8760h0m0s",
      "governance.proposal.VolumeDiscountProgram.minClose": "1s",
      "governance.proposal.VolumeDiscountProgram.minEnact": "1s",
      "governance.proposal.VolumeDiscountProgram.minProposerBalance": "1",
      "governance.proposal.VolumeDiscountProgram.minVoterBalance": "1",
      "governance.proposal.VolumeDiscountProgram.requiredMajority": "0.5",
      "governance.proposal.VolumeDiscountProgram.requiredParticipation": "0.00001",
      "governance.proposal.transfer.maxClose": "8760h0m0s",
      "governance.proposal.transfer.maxEnact": "8760h0m0s",
      "governance.proposal.transfer.minClose": "1s",
      "governance.proposal.transfer.minEnact": "1s",
      "governance.proposal.transfer.minProposerBalance": "1",
      "governance.proposal.transfer.minVoterBalance": "1",
      "governance.proposal.transfer.requiredMajority": "0.5",
      "governance.proposal.transfer.requiredParticipation": "0.00001",
      "limits.markets.maxPeggedOrders": "1500",
      "limits.markets.proposePerpetualEnabled": "1",
      "market.auction.maximumDuration": "168h",
      "market.auction.minimumDuration": "1s",
      "market.fee.factors.infrastructureFee": "0.0005",
      "market.fee.factors.makerFee": "0.0002",
      "market.liquidity.bondPenaltyParameter": "0.1",
      "market.liquidity.earlyExitPenalty": "0.1",
      "market.liquidity.maximumLiquidityFeeFactorLevel": "0.03",
      "market.liquidity.minimum.probabilityOfTrading.lpOrders": "1e-6",
      "market.liquidity.probabilityOfTrading.tau.scaling": "10.0",
      "market.liquidity.providersFeeCalculationTimeStep": "1s",
      "market.liquidity.sla.nonPerformanceBondPenaltyMax": "0.5",
      "market.liquidity.sla.nonPerformanceBondPenaltySlope": "2",
      "market.liquidity.stakeToCcyVolume": "1.0",
      "market.liquidity.targetstake.triggering.ratio": "0.25",
      "market.liquidityProvision.minLpStakeQuantumMultiple": "5000",
      "market.liquidityProvision.shapes.maxSize": "100",
      "market.margin.scalingFactors": "{\"search_level\": 1.1, \"initial_margin\": 1.5, \"collateral_release\": 1.7}",
      "market.monitor.price.defaultParameters": "{\"triggers\": [{\"auction_extension\": 300, \"horizon\": 43200, \"probability\": \"0.9999999\"}] }",
      "market.stake.target.scalingFactor": "0.0001",
      "market.stake.target.timeWindow": "1h",
      "market.value.windowLength": "2h0m0s",
      "network.checkpoint.timeElapsedBetweenCheckpoints": "5m",
      "network.floatingPointUpdates.delay": "5m",
      "network.markPriceUpdateMaximumFrequency": "5s",
      "network.transaction.defaultgas": "1",
      "network.transactions.maxgasperblock": "3000000",
      "network.transactions.minBlockCapacity": "32",
      "network.validators.ersatz.multipleOfTendermintValidators": "0",
      "network.validators.ersatz.rewardFactor": "0.85",
      "network.validators.incumbentBonus": "0.05",
      "network.validators.minimumEthereumEventsForNewValidator": "3",
      "network.validators.multisig.numberOfSigners": "13",
      "network.validators.tendermint.number": "13",
      "reward.asset": "0000000000000000000000000000000000000000000000000000000000000000",
      "reward.staking.delegation.competitionLevel": "1.3",
      "reward.staking.delegation.delegatorShare": "0.8",
      "reward.staking.delegation.maxPayoutPerEpoch": "9890000000000000000000",
      "reward.staking.delegation.maxPayoutPerParticipant": "700000000000000000000",
      "reward.staking.delegation.minimumValidatorStake": "3000000000000000000000",
      "reward.staking.delegation.minValidators": "5",
      "reward.staking.delegation.optimalStakeMultiplier": "3.0",
      "reward.staking.delegation.payoutDelay": "0h",
      "reward.staking.delegation.payoutFraction": "1.0",
      "rewards.marketCreationQuantumMultiple": "1",
      "snapshot.interval.length": "300",
      "spam.pow.difficulty": "15",
      "spam.pow.hashFunction": "sha3_24_rounds",
      "spam.pow.increaseDifficulty": "0",
      "spam.pow.numberOfPastBlocks": "100",
      "spam.pow.numberOfTxPerBlock": "1000",
      "spam.protection.delegation.min.tokens": "100000000000000000",
      "spam.protection.max.batchSize": "30",
      "spam.protection.max.delegations": "360",
      "spam.protection.max.proposals": "300",
      "spam.protection.max.votes": "300",
      "spam.protection.maxUserTransfersPerEpoch": "10000",
      "spam.protection.minimumWithdrawalQuantumMultiple": "10",
      "spam.protection.minMultisigUpdates": "100000000000000000000",
      "spam.protection.proposal.min.tokens": "2000000000000000000000",
      "spam.protection.voting.min.tokens": "1000000000000000000",
      "spam.protection.applyReferral.min.funds": "0",
      "transfer.fee.factor": "0.001",
      "transfer.minTransferQuantumMultiple": "0",
      "transfer.fee.maxQuantumAmount": "100",
      "transfer.feeDiscountMinimumTrackedAmount": "0.001",
      "transfer.feeDiscountDecayFraction": "0.5",
      "validator.performance.scaling.factor": "0",
      "validators.delegation.minAmount": "1",
      "validators.epoch.length": "2m",
      "validators.vote.required": "0.67",
      "referralProgram.maxReferralTiers": "10",
      "referralProgram.maxReferralRewardFactor": "1",
      "referralProgram.maxReferralDiscountFactor": "1",
      "referralProgram.maxPartyNotionalVolumeByQuantumPerEpoch": "10000",
      "referralProgram.minStakedVegaTokens": "0",
      "referralProgram.maxReferralRewardProportion": "1"
    },
    "network_limits": {
      "propose_market_enabled": true,
      "propose_asset_enabled": true,
      "bootstrap_block_count": 0
    },
    "checkpoint": {
      "load_hash": ""
    }
  }
}

Relevant log output

[2024-03-26T23:44:44.678Z] 2024-03-26 23:44:44,377 - vega_sim.service - INFO - Request to ListMarkets made at datanode block_height=1865.

[2024-03-26T23:44:44.678Z] 2024-03-26 23:44:44,377 - vega_sim.service - INFO - Request to GetLatestMarketData made at datanode block_height=1865.

[2024-03-26T23:44:51.202Z] 2024-03-26 23:44:50,377 - vega_sim.service - WARNING - Market fcc830, market API says state STATE_SUSPENDED but market data API says STATE_ACTIVE.
ze97286 commented 7 months ago

this is an artefact of how the core works. Market updates are send at the end of onTick() which happens on beginBlock, before any other transactions are processed. So what would happen if the market is switching to/from an auction is that we'd publish the market data on block x, e.g. 7232 and then at the beginning on block 7233, we'd publish the market data for it before processing any other transaction. I don't think it's ideal, but it's how it's always been and it definitely doesn't represent an inconsistent state. To prove this is the case I moved the code that emits the market data event from beginBlock to endBlock, which I could nicely without changing the block hash, I'm getting consistent state for the market see below:

market update with state monitoring auction and market suspended:

{
   "id": "7232-13",
   "block": "6604C1A89F29BD644228DB7A78B039AB944746B7DDC256C927B35B3E81347BC1",
   "type": 26,
   "market_updated": {
      "id": "5ae381e52dd30fb3e2cf3afe4eb971b9834bf46b2b69099f390011450776e430",
      "tradable_instrument": {
         "instrument": {
            "code": "ETH/USDT-PERP",
            "name": "Ether / Tether USD (Perpetual)",
            "metadata": {
               "tags": [
                  "base:ETH",
                  "quote:USDT",
                  "oracle:pyth",
                  "oracleChain:gnosis",
                  "class:fx/crypto",
                  "perpetual",
                  "sector:defi",
                  "enactment:2023-11-19T02:00:00Z"
               ]
            },
            "perpetual": {
               "settlement_asset": "308fccbb0268bfce19f1f06d67ced93f79e286b4c75a2e680c86b6f512e9e2e9",
               "quote_name": "USDT",
               "margin_funding_factor": "0.9",
               "interest_rate": "0.1095",
               "clamp_lower_bound": "-0.0005",
               "clamp_upper_bound": "0.0005",
               "data_source_spec_for_settlement_schedule": {
                  "id": "6b363bc622b6626f8fc598ccca199fe243c4a2b4ae665c02d3cff15e9a729792",
                  "data": {
                     "internal": {
                        "time_trigger": {
                           "conditions": [
                              {
                                 "operator": 3,
                                 "value": "0"
                              }
                           ],
                           "triggers": [
                              {
                                 "initial": "1683627460",
                                 "every": "300"
                              }
                           ]
                        }
                     }
                  }
               },
               "data_source_spec_for_settlement_data": {
                  "id": "dc31a9d7701356c1c46f19e4927ff10e3930508db02ad2080ae44e93c38f3404",
                  "data": {
                     "external": {
                        "oracle": {
                           "signers": [
                              {
                                 "pub_key": {
                                    "key": "5f556d8d8c8d649868367195f2cd8ea8ae1432054708d569ac6edb4efcc6bf53"
                                 }
                              }
                           ],
                           "filters": [
                              {
                                 "key": {
                                    "name": "eth.price",
                                    "type": 2,
                                    "number_decimal_places": "18"
                                 }
                              }
                           ]
                        }
                     }
                  }
               },
               "data_source_spec_binding": {
                  "settlement_data_property": "eth.price",
                  "settlement_schedule_property": "vegaprotocol.builtin.timetrigger"
               },
               "funding_rate_scaling_factor": "1",
               "funding_rate_lower_bound": "-0.001",
               "funding_rate_upper_bound": "0.001"
            }
         },
         "margin_calculator": {
            "scaling_factors": {
               "search_level": 1.1,
               "initial_margin": 1.5,
               "collateral_release": 1.7
            }
         },
         "log_normal_risk_model": {
            "risk_aversion_parameter": 0.000001,
            "tau": 0.000003995,
            "params": {
               "sigma": 1
            }
         }
      },
      "decimal_places": "2",
      "fees": {
         "factors": {
            "maker_fee": "0.0002",
            "infrastructure_fee": "0.0005",
            "liquidity_fee": "0.001"
         },
         "liquidity_fee_settings": {
            "method": 1
         }
      },
      "opening_auction": {
         "duration": "590"
      },
      "price_monitoring_settings": {
         "parameters": {
            "triggers": [
               {
                  "horizon": "21600",
                  "probability": "0.9999999",
                  "auction_extension": "86400"
               },
               {
                  "horizon": "4320",
                  "probability": "0.9999999",
                  "auction_extension": "3600"
               },
               {
                  "horizon": "1440",
                  "probability": "0.9999999",
                  "auction_extension": "1800"
               },
               {
                  "horizon": "360",
                  "probability": "0.9999999",
                  "auction_extension": "300"
               }
            ]
         }
      },
      "liquidity_monitoring_parameters": {
         "target_stake_parameters": {
            "time_window": "3600",
            "scaling_factor": 0.05
         }
      },
      "trading_mode": 4,
      "state": 6,
      "market_timestamps": {
         "proposed": "1683626861000000000",
         "pending": "1683626870000000000",
         "open": "1683627462000000000"
      },
      "position_decimal_places": "3",
      "linear_slippage_factor": "0.001",
      "quadratic_slippage_factor": "0",
      "liquidity_sla_params": {
         "price_range": "0.03",
         "commitment_min_time_fraction": "0.75",
         "performance_hysteresis_epochs": "1",
         "sla_competition_factor": "0.8"
      },
      "liquidation_strategy": {
         "disposal_time_step": "1",
         "disposal_fraction": "1",
         "full_disposal_size": "10000000",
         "max_fraction_consumed": "0.1"
      },
      "mark_price_configuration": {
         "decay_weight": "1",
         "decay_power": "1",
         "cash_amount": "50000000",
         "source_staleness_tolerance": [
            "1m0s",
            "1m0s",
            "168h0m0s",
            "168h0m0s",
            "1m0s"
         ],
         "composite_price_type": 2,
         "data_sources_spec": [
            {
               "external": {
                  "oracle": {
                     "signers": [
                        {
                           "pub_key": {
                              "key": "5f556d8d8c8d649868367195f2cd8ea8ae1432054708d569ac6edb4efcc6bf53"
                           }
                        }
                     ],
                     "filters": [
                        {
                           "key": {
                              "name": "eth.price",
                              "type": 2,
                              "number_decimal_places": "18"
                           }
                        }
                     ]
                  }
               }
            },
            {
               "external": {
                  "oracle": {
                     "signers": [
                        {
                           "pub_key": {
                              "key": "5f556d8d8c8d649868367195f2cd8ea8ae1432054708d569ac6edb4efcc6bf53"
                           }
                        }
                     ],
                     "filters": [
                        {
                           "key": {
                              "name": "eth.price",
                              "type": 2,
                              "number_decimal_places": "18"
                           }
                        }
                     ]
                  }
               }
            }
         ],
         "data_sources_spec_binding": [
            {
               "price_source_property": "eth.price"
            },
            {
               "price_source_property": "eth.price"
            }
         ]
      },
      "tick_size": "2"
   },
   "version": 1,
   "chain_id": "CUSTOM",
   "tx_hash": "6604C1A89F29BD644228DB7A78B039AB944746B7DDC256C927B35B3E81347BC1"
}

same block later the market data, with the same state:

{
   "id": "7232-19",
   "block": "6604C1A89F29BD644228DB7A78B039AB944746B7DDC256C927B35B3E81347BC1",
   "type": 12,
   "market_data": {
      "mark_price": "369077",
      "best_bid_price": "0",
      "best_offer_price": "368600",
      "best_offer_volume": "21",
      "best_static_bid_price": "0",
      "best_static_offer_price": "368600",
      "best_static_offer_volume": "21",
      "mid_price": "0",
      "static_mid_price": "0",
      "market": "5ae381e52dd30fb3e2cf3afe4eb971b9834bf46b2b69099f390011450776e430",
      "timestamp": "1683633631000000000",
      "open_interest": "6611186",
      "auction_end": "1683633931000000000",
      "auction_start": "1683633631000000000",
      "indicative_price": "0",
      "market_trading_mode": 4,
      "trigger": 3,
      "target_stake": "12132192824963142494917",
      "supplied_stake": "1500000000000000000000000",
      "price_monitoring_bounds": [
         {
            "min_valid_price": "350449",
            "max_valid_price": "376597",
            "trigger": {
               "horizon": "1440",
               "probability": "0.9999999",
               "auction_extension": "1800"
            },
            "reference_price": "363295"
         },
         {
            "min_valid_price": "341322",
            "max_valid_price": "386631",
            "trigger": {
               "horizon": "4320",
               "probability": "0.9999999",
               "auction_extension": "3600"
            },
            "reference_price": "363295"
         },
         {
            "min_valid_price": "315929",
            "max_valid_price": "417479",
            "trigger": {
               "horizon": "21600",
               "probability": "0.9999999",
               "auction_extension": "86400"
            },
            "reference_price": "363295"
         }
      ],
      "market_value_proxy": "0",
      "liquidity_provider_fee_share": [
         {
            "party": "7eec8109decdbdfd301fe55d1cfa42420663479972da72bb8ba72d3cb741cb6e",
            "equity_like_share": "0.6262626262626263",
            "average_entry_valuation": "2000000000000000000000000",
            "average_score": "0",
            "virtual_stake": "837837837837837800000000.0000000000000000"
         },
         {
            "party": "f1a23dd0e6f3eb15e9169d4b24e01415b27f35b6dd35d05f92c3946f3cc4892b",
            "equity_like_share": "0.3737373737373737",
            "average_entry_valuation": "1000000000000000000000000",
            "average_score": "0",
            "virtual_stake": "500000000000000000000000.0000000000000000"
         }
      ],
      "market_state": 6,
      "next_mark_to_market": "1683633636000000000",
      "last_traded_price": "368600",
      "market_growth": "0",
      "product_data": {
         "perpetual_data": {
            "funding_payment": "-113225902918639568",
            "funding_rate": "-0.0000308211879241",
            "internal_twap": "3671688466037914367172",
            "external_twap": "3673638511196431222352",
            "seq_num": "20",
            "start_time": "1683633461000000000",
            "internal_composite_price": "369077",
            "next_internal_composite_price_calc": "1683633636000000000",
            "internal_composite_price_type": 2,
            "underlying_index_price": "3698315564071345000000",
            "internal_composite_price_state": {
               "price_sources": [
                  {
                     "price_source": "priceFromTrades",
                     "price": "3683241379310344827520",
                     "last_updated": "1683633608000000000"
                  },
                  {
                     "price_source": "priceFromOrderBook",
                     "price": "3669230000000000000000",
                     "last_updated": "1683633569000000000"
                  },
                  {
                     "price_source": "priceFromOracle1",
                     "price": "3698315564071345000000",
                     "last_updated": "1683633608000000000"
                  },
                  {
                     "price_source": "priceFromOracle2",
                     "price": "3698315564071345000000",
                     "last_updated": "1683633608000000000"
                  },
                  {
                     "price_source": "medianPrice",
                     "price": "3698315564071345000000",
                     "last_updated": "1683633608000000000"
                  }
               ]
            }
         }
      },
      "liquidity_provider_sla": [
         {
            "party": "f1a23dd0e6f3eb15e9169d4b24e01415b27f35b6dd35d05f92c3946f3cc4892b",
            "current_epoch_fraction_of_time_on_book": "0",
            "last_epoch_fraction_of_time_on_book": "0",
            "last_epoch_fee_penalty": "1",
            "last_epoch_bond_penalty": "0.5",
            "hysteresis_period_fee_penalties": [
               "1"
            ],
            "required_liquidity": "500000000000000000000000",
            "notional_volume_buys": "0",
            "notional_volume_sells": "0"
         },
         {
            "party": "7eec8109decdbdfd301fe55d1cfa42420663479972da72bb8ba72d3cb741cb6e",
            "current_epoch_fraction_of_time_on_book": "0.5871611982881598",
            "last_epoch_fraction_of_time_on_book": "0.6891891891891892",
            "last_epoch_fee_penalty": "1",
            "last_epoch_bond_penalty": "0.1621621621621622",
            "hysteresis_period_fee_penalties": [
               "1"
            ],
            "required_liquidity": "837837837837837800000000",
            "notional_volume_buys": "0",
            "notional_volume_sells": "1197532127595641685788052.16"
         }
      ],
      "mark_price_type": 2,
      "mark_price_state": {
         "price_sources": [
            {
               "price_source": "priceFromTrades",
               "price": "3683241379310344827520",
               "last_updated": "1683633608000000000"
            },
            {
               "price_source": "priceFromOrderBook",
               "price": "3669230000000000000000",
               "last_updated": "1683633569000000000"
            },
            {
               "price_source": "priceFromOracle1",
               "price": "3698315564071345000000",
               "last_updated": "1683633608000000000"
            },
            {
               "price_source": "priceFromOracle2",
               "price": "3698315564071345000000",
               "last_updated": "1683633608000000000"
            },
            {
               "price_source": "medianPrice",
               "price": "3698315564071345000000",
               "last_updated": "1683633608000000000"
            }
         ]
      }
   },
   "version": 1,
   "chain_id": "CUSTOM",
   "tx_hash": "6604C1A89F29BD644228DB7A78B039AB944746B7DDC256C927B35B3E81347BC1"
}
cdummett commented 7 months ago

Awesome, thanks for looking into it @ze97286. In that case if the next block this always resolves itself then I'm happy to close this and then disable the check in market-sim 👍