Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: panic: decimal division by 0 #11568

Closed
cdummett opened this issue Aug 13, 2024 · 1 comment · Fixed by #11569
Closed

[Bug]: panic: decimal division by 0 #11568

cdummett opened this issue Aug 13, 2024 · 1 comment · Fixed by #11569

Comments

@cdummett
Copy link
Contributor

Problem encountered

vega-market-sim fuzz testing panics - note, not against latest develop but latest AMM fix, attempting to reproduce on develop

vega-sim-6th6u7bd.zip

2024-08-13T16:10:00.749+0100	INFO	core	node/node.go:99	starting vega	{"version": "v0.78.0-dev", "commit-hash": "712c168b57a5b24a5ab2c8764e91406f57069bc0"}
panic: decimal division by 0

goroutine 163381 [running]:
github.com/shopspring/decimal.Decimal.QuoRem({0x1400bf44ac0, 0xfffffff1}, {0x1400bf44b00, 0xfffffff0}, 0x10)
	/Users/caed/go/pkg/mod/github.com/vegaprotocol/[email protected]/decimal.go:590 +0x244
github.com/shopspring/decimal.Decimal.DivRound({0x1400bf44ac0?, 0x0?}, {0x1400bf44b00?, 0xfffffff0?}, 0x10)
	/Users/caed/go/pkg/mod/github.com/vegaprotocol/[email protected]/decimal.go:632 +0x3c
github.com/shopspring/decimal.Decimal.Div(...)
	/Users/caed/go/pkg/mod/github.com/vegaprotocol/[email protected]/decimal.go:577
code.vegaprotocol.io/vega/core/execution/amm.impliedPosition({0x1400bf44a20?, 0xd199140?}, {0x0?, 0x4971784?}, {0x14000393660?, 0x1902e8f0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/pool.go:544 +0x9c
code.vegaprotocol.io/vega/core/execution/amm.(*curve).positionAtPrice(0x1400b5d1ce0, 0x1131?, 0x0?)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/pool.go:73 +0x54
code.vegaprotocol.io/vega/core/execution/amm.(*shapeMaker).makeBoundaryOrder(0x14010c25710, 0x1401a505440, 0x0?)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/shape.go:97 +0x9c
code.vegaprotocol.io/vega/core/execution/amm.(*shapeMaker).calculateBoundaryOrders(0x14010c25710)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/shape.go:143 +0x538
code.vegaprotocol.io/vega/core/execution/amm.(*shapeMaker).makeShape(0x14010c25710)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/shape.go:347 +0x34
code.vegaprotocol.io/vega/core/execution/amm.(*Pool).OrderbookShape(0x1400fae0460?, 0x0?, 0x1400b1928a0?, 0x1?)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/shape.go:382 +0x38
code.vegaprotocol.io/vega/core/execution/common.(*MarketLiquidity).updateAMMCommitment(0x1400fcbc000, 0x61)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/common/liquidity_provision_fees.go:162 +0x4c0
code.vegaprotocol.io/vega/core/execution/common.(*MarketLiquidity).OnTick(0x1400fcbc000, {0x108d2d878, 0x1400fcb7da0}, {0x0?, 0xedbec177b?, 0x0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/common/liquidity_provision.go:390 +0x190
code.vegaprotocol.io/vega/core/execution/future.(*Market).OnTick(0x1400faf6a80, {0x108d2d878, 0x1400fcb7da0}, {0x40?, 0x14017163840?, 0x0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/future/market.go:1078 +0x504
code.vegaprotocol.io/vega/core/execution.(*Engine).OnTick(0x14000a56a80, {0x108d2d878, 0x1400fcb7da0}, {0x1?, 0x108d4d500?, 0x0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/engine.go:1223 +0x380
code.vegaprotocol.io/vega/core/vegatime.(*Svc).notify(...)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/vegatime/service.go:111
code.vegaprotocol.io/vega/core/vegatime.(*Svc).SetTimeNow(0x14000b5c300, {0x108d2d878, 0x1400fcb7da0}, {0x40?, 0x14000968dc0?, 0x0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/vegatime/service.go:80 +0x244
code.vegaprotocol.io/vega/core/processor.(*App).OnBeginBlock(0x1400014b180, 0xaa8, {0x140185cbd80, 0x40}, {0x140185cbd80?, 0x0?, 0x0?}, {0x0, 0x0}, {0x14000968dc0?, ...})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/processor/abci.go:1347 +0x764
code.vegaprotocol.io/vega/core/blockchain/abci.(*App).FinalizeBlock(0x14000a1e000, {0x108ac70c0?, 0x1?}, 0x14019328b40)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/abci/abci.go:168 +0x328
code.vegaprotocol.io/vega/cmd/vega/commands/node.(*appW).FinalizeBlock(0x14012630ab0?, {0x108d2d840?, 0x10b49b8a0?}, 0x10b49b8a0?)
	/Users/caed/Projects/vega-market-sim/extern/vega/cmd/vega/commands/node/app_wrapper.go:91 +0x30
code.vegaprotocol.io/vega/core/blockchain/nullchain.(*NullBlockchain).processBlock(0x14000614fc0)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/nullchain/nullchain.go:212 +0x488
code.vegaprotocol.io/vega/core/blockchain/nullchain.(*NullBlockchain).ForwardTime(0x14000614fc0, 0x218711a00)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/nullchain/nullchain.go:289 +0x194
code.vegaprotocol.io/vega/core/blockchain/nullchain.(*NullBlockchain).handleForwardTime.func1()
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/nullchain/server.go:132 +0x2c
created by code.vegaprotocol.io/vega/core/blockchain/nullchain.(*NullBlockchain).handleForwardTime in goroutine 163379
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/nullchain/server.go:131 +0x1e0

Observed behaviour

panic

Expected behaviour

no panic

Steps to reproduce

replay

Software version

712c168

Failing test

vega-market-sim fuzz test

Jenkins run

No response

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,
        "quantum": "1",
        "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.evmBridgeConfigs": "{\"configs\":[{\"network_id\": \"3\", \"chain_id\": \"3\", \"collateral_bridge_contract\": { \"address\": \"0xa6F1E140daC13002Dfd9789D6dBA59117c717D7a\" }, \"confirmations\": 50, \"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",
      "limits.markets.ammPoolEnabled": "1",
      "market.auction.maximumDuration": "168h",
      "market.auction.minimumDuration": "1s",
      "market.fee.factors.infrastructureFee": "0.0005",
      "market.fee.factors.makerFee": "0.0002",
      "market.fee.factors.treasuryFee": "0.0001",
      "market.fee.factors.buybackFee": "0.0001",
      "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",
      "market.aggressiveOrderBlockDelay": "1",
      "market.amm.minCommitmentQuantum": "1",
      "market.liquidity.maxAmmCalculationLevels": "100"
    },
    "network_limits": {
      "propose_market_enabled": true,
      "propose_asset_enabled": true,
      "bootstrap_block_count": 0
    },
    "checkpoint": {
      "load_hash": ""
    }
  }
}

Relevant log output

panic: decimal division by 0

goroutine 163381 [running]:
github.com/shopspring/decimal.Decimal.QuoRem({0x1400bf44ac0, 0xfffffff1}, {0x1400bf44b00, 0xfffffff0}, 0x10)
	/Users/caed/go/pkg/mod/github.com/vegaprotocol/[email protected]/decimal.go:590 +0x244
github.com/shopspring/decimal.Decimal.DivRound({0x1400bf44ac0?, 0x0?}, {0x1400bf44b00?, 0xfffffff0?}, 0x10)
	/Users/caed/go/pkg/mod/github.com/vegaprotocol/[email protected]/decimal.go:632 +0x3c
github.com/shopspring/decimal.Decimal.Div(...)
	/Users/caed/go/pkg/mod/github.com/vegaprotocol/[email protected]/decimal.go:577
code.vegaprotocol.io/vega/core/execution/amm.impliedPosition({0x1400bf44a20?, 0xd199140?}, {0x0?, 0x4971784?}, {0x14000393660?, 0x1902e8f0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/pool.go:544 +0x9c
code.vegaprotocol.io/vega/core/execution/amm.(*curve).positionAtPrice(0x1400b5d1ce0, 0x1131?, 0x0?)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/pool.go:73 +0x54
code.vegaprotocol.io/vega/core/execution/amm.(*shapeMaker).makeBoundaryOrder(0x14010c25710, 0x1401a505440, 0x0?)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/shape.go:97 +0x9c
code.vegaprotocol.io/vega/core/execution/amm.(*shapeMaker).calculateBoundaryOrders(0x14010c25710)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/shape.go:143 +0x538
code.vegaprotocol.io/vega/core/execution/amm.(*shapeMaker).makeShape(0x14010c25710)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/shape.go:347 +0x34
code.vegaprotocol.io/vega/core/execution/amm.(*Pool).OrderbookShape(0x1400fae0460?, 0x0?, 0x1400b1928a0?, 0x1?)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/shape.go:382 +0x38
code.vegaprotocol.io/vega/core/execution/common.(*MarketLiquidity).updateAMMCommitment(0x1400fcbc000, 0x61)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/common/liquidity_provision_fees.go:162 +0x4c0
code.vegaprotocol.io/vega/core/execution/common.(*MarketLiquidity).OnTick(0x1400fcbc000, {0x108d2d878, 0x1400fcb7da0}, {0x0?, 0xedbec177b?, 0x0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/common/liquidity_provision.go:390 +0x190
code.vegaprotocol.io/vega/core/execution/future.(*Market).OnTick(0x1400faf6a80, {0x108d2d878, 0x1400fcb7da0}, {0x40?, 0x14017163840?, 0x0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/future/market.go:1078 +0x504
code.vegaprotocol.io/vega/core/execution.(*Engine).OnTick(0x14000a56a80, {0x108d2d878, 0x1400fcb7da0}, {0x1?, 0x108d4d500?, 0x0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/engine.go:1223 +0x380
code.vegaprotocol.io/vega/core/vegatime.(*Svc).notify(...)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/vegatime/service.go:111
code.vegaprotocol.io/vega/core/vegatime.(*Svc).SetTimeNow(0x14000b5c300, {0x108d2d878, 0x1400fcb7da0}, {0x40?, 0x14000968dc0?, 0x0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/vegatime/service.go:80 +0x244
code.vegaprotocol.io/vega/core/processor.(*App).OnBeginBlock(0x1400014b180, 0xaa8, {0x140185cbd80, 0x40}, {0x140185cbd80?, 0x0?, 0x0?}, {0x0, 0x0}, {0x14000968dc0?, ...})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/processor/abci.go:1347 +0x764
code.vegaprotocol.io/vega/core/blockchain/abci.(*App).FinalizeBlock(0x14000a1e000, {0x108ac70c0?, 0x1?}, 0x14019328b40)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/abci/abci.go:168 +0x328
code.vegaprotocol.io/vega/cmd/vega/commands/node.(*appW).FinalizeBlock(0x14012630ab0?, {0x108d2d840?, 0x10b49b8a0?}, 0x10b49b8a0?)
	/Users/caed/Projects/vega-market-sim/extern/vega/cmd/vega/commands/node/app_wrapper.go:91 +0x30
code.vegaprotocol.io/vega/core/blockchain/nullchain.(*NullBlockchain).processBlock(0x14000614fc0)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/nullchain/nullchain.go:212 +0x488
code.vegaprotocol.io/vega/core/blockchain/nullchain.(*NullBlockchain).ForwardTime(0x14000614fc0, 0x218711a00)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/nullchain/nullchain.go:289 +0x194
code.vegaprotocol.io/vega/core/blockchain/nullchain.(*NullBlockchain).handleForwardTime.func1()
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/nullchain/server.go:132 +0x2c
created by code.vegaprotocol.io/vega/core/blockchain/nullchain.(*NullBlockchain).handleForwardTime in goroutine 163379
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/nullchain/server.go:131 +0x1e0
@cdummett
Copy link
Contributor Author

Reproduced on latest commit
vega-sim-q4rwtalb.zip

2024-08-13T16:19:46.331+0100	INFO	core	node/node.go:99	starting vega	{"version": "v0.78.0-dev", "commit-hash": "cbb9d899ab14d6c5b4e90f741b18491294aa5473"}
panic: decimal division by 0

goroutine 210677 [running]:
github.com/shopspring/decimal.Decimal.QuoRem({0x140059cb680, 0xfffffff1}, {0x140059cb6c0, 0xfffffff0}, 0x10)
	/Users/caed/go/pkg/mod/github.com/vegaprotocol/[email protected]/decimal.go:590 +0x244
github.com/shopspring/decimal.Decimal.DivRound({0x140059cb680?, 0x0?}, {0x140059cb6c0?, 0xfffffff0?}, 0x10)
	/Users/caed/go/pkg/mod/github.com/vegaprotocol/[email protected]/decimal.go:632 +0x3c
github.com/shopspring/decimal.Decimal.Div(...)
	/Users/caed/go/pkg/mod/github.com/vegaprotocol/[email protected]/decimal.go:577
code.vegaprotocol.io/vega/core/execution/amm.impliedPosition({0x140059cb600?, 0x6e6774?}, {0x0?, 0x43a5560?}, {0x140003ad680?, 0x6ef220?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/pool.go:544 +0x9c
code.vegaprotocol.io/vega/core/execution/amm.(*curve).positionAtPrice(0x1400e3791a0, 0x0?, 0x0?)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/pool.go:73 +0x54
code.vegaprotocol.io/vega/core/execution/amm.(*shapeMaker).makeBoundaryOrder(0x1400e28bef0, 0x1400796bc20, 0x0?)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/shape.go:97 +0x9c
code.vegaprotocol.io/vega/core/execution/amm.(*shapeMaker).calculateBoundaryOrders(0x1400e28bef0)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/shape.go:132 +0x17c
code.vegaprotocol.io/vega/core/execution/amm.(*shapeMaker).makeShape(0x1400e28bef0)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/shape.go:347 +0x34
code.vegaprotocol.io/vega/core/execution/amm.(*Pool).OrderbookShape(0x14001deca08?, 0x14005977f20?, 0x140058fa000?, 0x140059caf40?)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/amm/shape.go:382 +0x38
code.vegaprotocol.io/vega/core/execution/common.(*MarketLiquidity).updateAMMCommitment(0x14004698140, 0xe4)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/common/liquidity_provision_fees.go:162 +0x4c0
code.vegaprotocol.io/vega/core/execution/common.(*MarketLiquidity).OnTick(0x14004698140, {0x104c35878, 0x14008fcc900}, {0x0?, 0xedbec177e?, 0x0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/common/liquidity_provision.go:390 +0x190
code.vegaprotocol.io/vega/core/execution/future.(*Market).OnTick(0x1400864c000, {0x104c35878, 0x14008fcc900}, {0x40?, 0x14006130820?, 0x0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/future/market.go:1078 +0x504
code.vegaprotocol.io/vega/core/execution.(*Engine).OnTick(0x14000de5c00, {0x104c35878, 0x14008fcc900}, {0x1?, 0x104c55500?, 0x0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/execution/engine.go:1223 +0x380
code.vegaprotocol.io/vega/core/vegatime.(*Svc).notify(...)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/vegatime/service.go:111
code.vegaprotocol.io/vega/core/vegatime.(*Svc).SetTimeNow(0x14000d9a300, {0x104c35878, 0x14008fcc900}, {0x40?, 0x1073a38a0?, 0x0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/vegatime/service.go:80 +0x244
code.vegaprotocol.io/vega/core/processor.(*App).OnBeginBlock(0x140008c2e00, 0xbad, {0x1400511a580, 0x40}, {0x1400511a580?, 0x0?, 0x0?}, {0x0, 0x0}, {0x1073a38a0?, ...})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/processor/abci.go:1347 +0x764
code.vegaprotocol.io/vega/core/blockchain/abci.(*App).FinalizeBlock(0x140001e20c0, {0x1049cf0c0?, 0x1?}, 0x1400512c000)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/abci/abci.go:168 +0x328
code.vegaprotocol.io/vega/cmd/vega/commands/node.(*appW).FinalizeBlock(0x140052d24f8?, {0x104c35840?, 0x1073a38a0?}, 0x3b9aca00?)
	/Users/caed/Projects/vega-market-sim/extern/vega/cmd/vega/commands/node/app_wrapper.go:91 +0x30
code.vegaprotocol.io/vega/core/blockchain/nullchain.(*NullBlockchain).processBlock(0x14000745440)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/nullchain/nullchain.go:212 +0x488
code.vegaprotocol.io/vega/core/blockchain/nullchain.(*NullBlockchain).ForwardTime(0x14000745440, 0x3b9aca000)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/nullchain/nullchain.go:289 +0x194
code.vegaprotocol.io/vega/core/blockchain/nullchain.(*NullBlockchain).handleForwardTime.func1()
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/nullchain/server.go:132 +0x2c
created by code.vegaprotocol.io/vega/core/blockchain/nullchain.(*NullBlockchain).handleForwardTime in goroutine 210675
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/nullchain/server.go:131 +0x1e0

@vega-issues vega-issues moved this to Waiting Review in Core Kanban Aug 13, 2024
@vega-issues vega-issues moved this from Waiting Review to Approved in Core Kanban Aug 13, 2024
@github-project-automation github-project-automation bot moved this from Approved to Merged in Core Kanban Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant