Guard costs[i] bounds in estimateAndAssignTxCost to fix panic under Go 1.27 - #94
Guard costs[i] bounds in estimateAndAssignTxCost to fix panic under Go 1.27#94alex-semenyuk with Copilot wants to merge 3 commits into
Conversation
…c on incomplete sim receipt Co-authored-by: alex-semenyuk <5480441+alex-semenyuk@users.noreply.github.com>
…rshalJSON recursion Co-authored-by: alex-semenyuk <5480441+alex-semenyuk@users.noreply.github.com>
That output ( The real CI failure was the
Fixed in commit |
|
@copilot can you push directly to dependabot/docker/docker-0c7ab30260 |
Unfortunately I can only push to the branch associated with this PR ( |
PR #93 bumps the Docker builder from
golang:1.26.5-alpinetogolang:1.27rc2-alpine, which exposed a latent bug:estimateAndAssignTxCostaccessescosts[i]in a logging loop without checking whethersim.Costs()returned a slice of the same length asop.Contents. When those lengths diverge (e.g. a minimal/synthetic simulation receipt), this causes an index-out-of-bounds crash — manifesting asfatal error: stack overflowunder Go 1.27rc2.Changes
internal/tezos/prepare_transaction.go— addi >= len(costs)guard in theestimateAndAssignTxCostdebug logging loop; emit a reduced log line (without simulation cost fields) for any op entry that has no corresponding simulation result:internal/tezos/prepare_transaction_test.go— addTest_estimateAndAssignTxCostFewerSimResultsThanOpContentswhich passes an op with two contents entries against a mock that returns only one simulation result, directly exercising the new bounds check.