agora icon indicating copy to clipboard operation
agora copied to clipboard

Improve LocalRest to see which call triggered an assertion failure

Open Geod24 opened this issue 3 years ago • 0 comments

Currently, if a node assert in unittest, we'll see something like this:

[...]
Unittesting agora.test.VariableBlockSize..
Unittesting agora.test.ValidatorRecurringEnrollment..
================================ ASSERT HANDLER ===============================
[source/agora/node/Ledger.d:351] Assertion thrown during test:
/Users/geod24/projects/bpfk/agora/source/agora/node/Ledger.d:351 @safe bool agora.node.Ledger.Ledger.acceptTransaction(agora.consensus.data.Transaction.Transaction) [0x10fd9cfdd]
/Users/geod24/projects/bpfk/agora/source/agora/node/FullNode.d:712 @safe void agora.node.FullNode.FullNode.putTransaction(agora.consensus.data.Transaction.Transaction) [0x10fe091b7]
/Users/geod24/projects/bpfk/agora/source/agora/test/Base.d:1583 @safe void agora.test.Base.TestValidatorNode.__mixin8.putTransaction(agora.consensus.data.Transaction.Transaction) [0x10fd40730]
/Users/geod24/projects/bpfk/agora/submodules/localrest/source/geod24/LocalRest.d-mixin-667:684 void geod24.LocalRest.RemoteAPI!(agora.test.Base.TestAPI, agora.test.Base.Serializer).RemoteAPI.handleCommand(geod24.LocalRest.Command, agora.test.Base.TestAPI, geod24.LocalRest.FilterAPI, geod24.concurrency.Channel!(geod24.LocalRest.Response).Channel) [0x10fe0e7bf]
/Users/geod24/projects/bpfk/agora/submodules/localrest/source/geod24/LocalRest.d:801 void geod24.LocalRest.RemoteAPI!(agora.test.Base.TestAPI, agora.test.Base.Serializer).RemoteAPI.spawned!(agora.test.Base.TestValidatorNode).spawned(geod24.concurrency.Channel!(geod24.LocalRest.Connection).Channel, immutable(char)[], int, agora.common.Config.Config, shared(geod24.Registry.Registry!(agora.test.Base.TestAPI).Registry)*, shared(geod24.Registry.Registry!(agora.registry.API.NameRegistryAPI).Registry)*, immutable(agora.consensus.data.Block.Block)[], in ref agora.test.Base.TestConf, shared(ulong)*).runNode().__lambda1().__lambda4() [0x10fe2e8a4]
context.d:46 void core.thread.context.Callable.opCall() [0x110d6518e]
fiber.d:1129 void core.thread.fiber.Fiber.run() [0x110d6531d]
fiber.d:186 fiber_entryPoint [0x110d65252]
================================ NODE LOGS ===============================
2021-04-18 19:48:21,460 Info [agora.node.Ledger] - Last known block: #0 (0x1f11e6c77f54030baf04b0fada789e5a34f6fab36d1377acd697788b561eb0b7acb469c13b54934516c9fd2ea279603a92e1d2078f33a922c6bb7d3c43df8cf0)
2021-04-18 19:48:21,463 Info [agora.node.Ledger] - Beginning externalization of block #0
2021-04-18 19:48:21,463 Info [agora.node.Ledger] - Transactions: 2 - Enrollments: 6
2021-04-18 19:48:21,463 Info [agora.node.Ledger] - Validators: Active: 0 - Signing: [0] - Slashed: []
[...]

Provided https://github.com/bosagora/agora/pull/1971 is merged. The issue with this is that we don't know which call in the unittest itself triggered the assertion, which makes it hard to follow the logic.

Geod24 avatar Apr 18 '21 10:04 Geod24