stacks-core icon indicating copy to clipboard operation
stacks-core copied to clipboard

Runtime error when doing `from-consensus-buff?` with an empty buffer

Open hstove-stacks opened this issue 1 month ago • 1 comments

When calling from-consensus-buff? with an empty buffer, you get the runtime error:

Unchecked(CostComputationFailed("Error evaluating result of cost function ST000000000000000000002AMW42H.costs-3.cost_from_consensus_buff: Arithmetic(\"log2 must be passed a positive integer\")\n Stack Trace: \n"))

This is present in both epoch 3.2 and 3.3.

Example replication: (from-consensus-buff? bool 0x)

The expected behavior is that this function returns none, which is the normal return when deserialization fails.

hstove-stacks avatar Nov 13 '25 15:11 hstove-stacks

We actually have a runtime test for this case. See https://github.com/stacks-network/stacks-core/pull/6698

Did not realize it was a bug.

jacinta-stacks avatar Nov 21 '25 16:11 jacinta-stacks