Skip to content

[Bug]: division by zero panic - vaults #11750

Description

@cdummett

Problem encountered

VMS fuzzing PR integrating vaults panics

vega-sim-_wxk7zb9.zip

2024-10-25T12:36:15.835+0100	INFO	core	node/node.go:99	starting vega	{"version": "v0.79.0", "commit-hash": "9a5fdf81fba8228c51ffe398b1467259e11f82a6"}
panic: decimal division by 0

goroutine 675 [running]:
github.com/shopspring/decimal.Decimal.QuoRem({0x140018bd420, 0x0}, {0x140018bd440, 0x0}, 0x10)
	/Users/caed/go/pkg/mod/github.com/vegaprotocol/decimal@v1.3.1-uint256/decimal.go:590 +0x244
github.com/shopspring/decimal.Decimal.DivRound({0x140018bd420?, 0x2c2eac0?}, {0x140018bd440?, 0x2c2e800?}, 0x10)
	/Users/caed/go/pkg/mod/github.com/vegaprotocol/decimal@v1.3.1-uint256/decimal.go:632 +0x3c
github.com/shopspring/decimal.Decimal.Div(...)
	/Users/caed/go/pkg/mod/github.com/vegaprotocol/decimal@v1.3.1-uint256/decimal.go:577
code.vegaprotocol.io/vega/core/vault.(*VaultState).ProcessFees(0x140027e51e0, {0xedbf54b84?, 0x0?, 0x0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/vault/vault.go:319 +0xa8
code.vegaprotocol.io/vega/core/vault.(*VaultService).OnTick(0x14000c80280, {0x104eec4b8, 0x14002e089f0}, {0x1?, 0x104f0c230?, 0x0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/vault/vault_service.go:178 +0xf4
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(0x14000c80080, {0x104eec4b8, 0x14002e089f0}, {0x40?, 0x140018db7c0?, 0x0?})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/vegatime/service.go:80 +0x244
code.vegaprotocol.io/vega/core/processor.(*App).OnBeginBlock(0x14000126c00, 0x66, {0x140018d55c0, 0x40}, {0x140018d55c0?, 0x0?, 0x0?}, {0x0, 0x0}, {0x140018db7c0?, ...})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/processor/abci.go:1365 +0x764
code.vegaprotocol.io/vega/core/blockchain/abci.(*App).FinalizeBlock(0x140001e40c0, {0x104c7d7c0?, 0x1?}, 0x140018fe3c0)
	/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(0x140018c4b88?, {0x104eec480?, 0x1076ae980?}, 0x10098f178?)
	/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(0x140003b30e0)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/nullchain/nullchain.go:212 +0x488
code.vegaprotocol.io/vega/core/blockchain/nullchain.(*NullBlockchain).handleTransaction(0x140003b30e0, {0x14002e181a0, 0x191, 0x191})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/nullchain/nullchain.go:235 +0x21c
code.vegaprotocol.io/vega/core/blockchain/nullchain.(*NullBlockchain).SendTransactionSync(0x104eec4b8?, {0x14002e08450?, 0x14000e19568?}, {0x14002e181a0, 0x191, 0x191})
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/nullchain/nullchain.go:393 +0x48
code.vegaprotocol.io/vega/core/blockchain.(*Client).SubmitTransactionSync(0x14000274540, {0x104eec4b8, 0x14002e08450}, 0x0?)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/blockchain/client.go:137 +0xdc
code.vegaprotocol.io/vega/core/api.(*coreService).SubmitTransaction(0x140004c4d80, {0x104eec4b8, 0x14002e08450}, 0x14002e0a500)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/api/core.go:157 +0x9c
code.vegaprotocol.io/vega/protos/vega/api/v1._CoreService_SubmitTransaction_Handler.func1({0x104eec4b8, 0x14002e08450}, {0x104ad2660?, 0x14002e0a500})
	/Users/caed/Projects/vega-market-sim/extern/vega/protos/vega/api/v1/core_grpc.pb.go:302 +0x74
code.vegaprotocol.io/vega/core/api.(*GRPC).Start.remoteAddrInterceptor.func1({0x104eec4b8, 0x14002e083f0}, {0x104ad2660, 0x14002e0a500}, 0x140018bd320, 0x140018adf20)
	/Users/caed/Projects/vega-market-sim/extern/vega/core/api/grpc.go:231 +0x4b0
code.vegaprotocol.io/vega/protos/vega/api/v1._CoreService_SubmitTransaction_Handler({0x104d4c480?, 0x140004c4d80}, {0x104eec4b8, 0x14002e083f0}, 0x140018dd980, 0x140004b0340)
	/Users/caed/Projects/vega-market-sim/extern/vega/protos/vega/api/v1/core_grpc.pb.go:304 +0x12c
google.golang.org/grpc.(*Server).processUnaryRPC(0x140002a9e00, {0x104eec4b8, 0x14002e08360}, {0x104f07300, 0x14000c7c340}, 0x140018cf320, 0x14000643a70, 0x1073c3460, 0x0)
	/Users/caed/go/pkg/mod/google.golang.org/grpc@v1.60.0/server.go:1372 +0xb8c
google.golang.org/grpc.(*Server).handleStream(0x140002a9e00, {0x104f07300, 0x14000c7c340}, 0x140018cf320)
	/Users/caed/go/pkg/mod/google.golang.org/grpc@v1.60.0/server.go:1783 +0xc4c
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	/Users/caed/go/pkg/mod/google.golang.org/grpc@v1.60.0/server.go:1016 +0x5c
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 186
	/Users/caed/go/pkg/mod/google.golang.org/grpc@v1.60.0/server.go:1027 +0x138

Observed behaviour

Expected behaviour

Steps to reproduce

replay

Software version

9a5fdf8

Failing test

No response

Jenkins run

No response

Configuration used

No response

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status
    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions