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]: submit vAMM to a market that is setup with market decimals > 0 causes division by 0 panic #11247

Closed
Sohill-Patel opened this issue May 9, 2024 · 0 comments

Comments

@Sohill-Patel
Copy link
Contributor

Problem encountered

2024-05-09T08:19:22.766Z ERROR tendermint consensus/state.go:801 CONSENSUS FAILURE!!! {"err": "decimal division by 0", "stack": "goroutine 265 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x5e\ngithub.com/cometbft/cometbft/consensus.(*State).receiveRoutine.func2()\n\t/jenkins/GOPATH/pkg/mod/github.com/cometbft/cometbft@v0.38.6/consensus/state.go:801 +0x46\npanic({0x51f7940?, 0x6490ac0?})\n\t/usr/local/go/src/runtime/panic.go:914 +0x21f\ngithub.com/shopspring/decimal.Decimal.QuoRem({0xc00d0ccca0, 0xfffffff0}, {0xc015c88080, 0xfffffff0}, 0x10)\n\t/jenkins/GOPATH/pkg/mod/github.com/vegaprotocol/decimal@v1.3.1-uint256/decimal.go:590 +0x2bc\ngithub.com/shopspring/decimal.Decimal.DivRound({0xc00d0ccca0?, 0x0?}, {0xc015c88080?, 0x546b5878?}, 0x10)\n\t/jenkins/GOPATH/pkg/mod/github.com/vegaprotocol/decimal@v1.3.1-uint256/decimal.go:632 +0x4d\ngithub.com/shopspring/decimal.Decimal.Div(...)\n\t/jenkins/GOPATH/pkg/mod/github.com/vegaprotocol/decimal@v1.3.1-uint256/decimal.go:577\ncode.vegaprotocol.io/vega/core/execution/common.(*MarketLiquidity).scaleScores(0xc000148f80?, 0xc0049edad0)\n\t/jenkins/workspace/common/system-tests-wrapper/vega/core/execution/common/liquidity_provision_fees.go:194 +0x165\ncode.vegaprotocol.io/vega/core/execution/common.(*MarketLiquidity).AllocateFees(0xc003461b80, {0x64d39c8, 0xc001f7c750})\n\t/jenkins/workspace/common/system-tests-wrapper/vega/core/execution/common/liquidity_provision_fees.go:98 +0x4e5\ncode.vegaprotocol.io/vega/core/execution/common.(*MarketLiquidity).OnTick(0xc003461b80, {0x64d39c8, 0xc001f7c750}, {0x26b8211b?, 0xeddce7dda?, 0x0?})\n\t/jenkins/workspace/common/system-tests-wrapper/vega/core/execution/common/liquidity_provision.go:368 +0x8b\ncode.vegaprotocol.io/vega/core/execution/future.(*Market).OnTick(0xc002930000, {0x64d39c8, 0xc001f7c750}, {0x40?, 0x0?, 0x0?})\n\t/jenkins/workspace/common/system-tests-wrapper/vega/core/execution/future/market.go:1055 +0x675\ncode.vegaprotocol.io/vega/core/execution.(*Engine).OnTick(0xc0005d2600, {0x64d39c8, 0xc001f7c750}, {0x1?, 0x64f3820?, 0x0?})\n\t/jenkins/workspace/common/system-tests-wrapper/vega/core/execution/engine.go:1393 +0x4f1\ncode.vegaprotocol.io/vega/core/vegatime.(*Svc).notify(...)\n\t/jenkins/workspace/common/system-tests-wrapper/vega/core/vegatime/service.go:107\ncode.vegaprotocol.io/vega/core/vegatime.(*Svc).SetTimeNow(0xc000a3c600, {0x64d39c8, 0xc001f7c750}, {0x40?, 0x8c82140?, 0x0?})\n\t/jenkins/workspace/common/system-tests-wrapper/vega/core/vegatime/service.go:80 +0x263\ncode.vegaprotocol.io/vega/core/processor.(*App).OnBeginBlock(0xc000642700, 0xdd, {0xc0138ce800, 0x40}, {0x1d76bab?, 0x28?, 0x0?}, {0xc020b17aa0, 0x28}, {0x8c82140, ...})\n\t/jenkins/workspace/common/system-tests-wrapper/vega/core/processor/abci.go:1049 +0x956\ncode.vegaprotocol.io/vega/core/blockchain/abci.(*App).FinalizeBlock(0xc000aea0c0, {0xc00014a530?, 0x1d2c465?}, 0xc00f50e840)\n\t/jenkins/workspace/common/system-tests-wrapper/vega/core/blockchain/abci/abci.go:162 +0x449\ncode.vegaprotocol.io/vega/cmd/vega/commands/node.(*appW).FinalizeBlock(0x5274500?, {0x64d3aa8?, 0x8c82140?}, 0x7fb4546b5878?)\n\t/jenkins/workspace/common/system-tests-wrapper/vega/cmd/vega/commands/node/app_wrapper.go:91 +0x25\ngithub.com/cometbft/cometbft/abci/client.(*localClient).FinalizeBlock(0xc00014a5d0?, {0x64d3aa8?, 0x8c82140?}, 0xc0?)\n\t/jenkins/GOPATH/pkg/mod/github.com/cometbft/cometbft@v0.38.6/abci/client/local_client.go:185 +0xd0\ngithub.com/cometbft/cometbft/proxy.(*appConnConsensus).FinalizeBlock(0xc000c6eb40, {0x64d3aa8, 0x8c82140}, 0x1?)\n\t/jenkins/GOPATH/pkg/mod/github.com/cometbft/cometbft@v0.38.6/proxy/app_conn.go:104 +0x16d\ngithub.com/cometbft/cometbft/state.(*BlockExecutor).ApplyBlock(_, {{{0xb, 0x1}, {0xc001d35070, 0x6}}, {0xc001d35080, 0xb}, 0x1, 0xdc, {{0xc00e2015c0, ...}, ...}, ...}, ...)\n\t/jenkins/GOPATH/pkg/mod/github.com/cometbft/cometbft@v0.38.6/state/execution.go:213 +0x622\ngithub.com/cometbft/cometbft/consensus.(*State).finalizeCommit(0xc001d7e000, 0xdd)\n\t/jenkins/GOPATH/pkg/mod/github.com/cometbft/cometbft@v0.38.6/consensus/state.go:1771 +0xb7d\ngithub.com/cometbft/cometbft/consensus.(*State).tryFinalizeCommit(0xc001d7e000, 0xdd)\n\t/jenkins/GOPATH/pkg/mod/github.com/cometbft/cometbft@v0.38.6/consensus/state.go:1682 +0x2f6\ngithub.com/cometbft/cometbft/consensus.(*State).enterCommit.func1()\n\t/jenkins/GOPATH/pkg/mod/github.com/cometbft/cometbft@v0.38.6/consensus/state.go:1617 +0x9c\ngithub.com/cometbft/cometbft/consensus.(*State).enterCommit(0xc001d7e000, 0xdd, 0x0)\n\t/jenkins/GOPATH/pkg/mod/github.com/cometbft/cometbft@v0.38.6/consensus/state.go:1655 +0xc5b\ngithub.com/cometbft/cometbft/consensus.(*State).addVote(0xc001d7e000, 0xc00ac44a90, {0xc000b0e3c0, 0x28})\n\t/jenkins/GOPATH/pkg/mod/github.com/cometbft/cometbft@v0.38.6/consensus/state.go:2334 +0x1d4d\ngithub.com/cometbft/cometbft/consensus.(*State).tryAddVote(0xc001d7e000, 0xc00ac44a90, {0xc000b0e3c0?, 0xc00014bc08?})\n\t/jenkins/GOPATH/pkg/mod/github.com/cometbft/cometbft@v0.38.6/consensus/state.go:2066 +0x26\ngithub.com/cometbft/cometbft/consensus.(*State).handleMsg(0xc001d7e000, {{0x64a9d60, 0xc003aae538}, {0xc000b0e3c0, 0x28}})\n\t/jenkins/GOPATH/pkg/mod/github.com/cometbft/cometbft@v0.38.6/consensus/state.go:929 +0x3ce\ngithub.com/cometbft/cometbft/consensus.(*State).receiveRoutine(0xc001d7e000, 0x0)\n\t/jenkins/GOPATH/pkg/mod/github.com/cometbft/cometbft@v0.38.6/consensus/state.go:836 +0x3d1\ncreated by github.com/cometbft/cometbft/consensus.(*State).OnStart in goroutine 244\n\t/jenkins/GOPATH/pkg/mod/github.com/cometbft/cometbft@v0.38.6/consensus/state.go:398 +0x10c\n"}

Observed behaviour

when the market is configured with market decimals > 0 and amm tx is submitted then we have a panic

Expected behaviour

no panic

Steps to reproduce

1. st branch `amm-fiddle` vega branch `feature/amm-base-branch`
2. With test `test_amm_lifecyle`
3. Observe the error

Software version

feature/amm-base-branch

Failing test

test_amm_lifecyle

Jenkins run

https://jenkins.vega.rocks/job/common/job/system-tests-wrapper/57653/testReport/junit/tests.amm/amm_test/test_amm_lifecyle/

Configuration used

No response

Relevant log output

No response

@wwestgarth wwestgarth self-assigned this May 9, 2024
@wwestgarth wwestgarth moved this to In Progress in Core Kanban May 9, 2024
@wwestgarth wwestgarth moved this from In Progress to Waiting Review in Core Kanban May 10, 2024
@github-project-automation github-project-automation bot moved this from Waiting Review to Merged in Core Kanban May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants