Skip to content

Conversation

@akrem-chabchoub
Copy link
Contributor

@akrem-chabchoub akrem-chabchoub commented Jan 25, 2026

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

Before when running this command you will get panic error, now with the fix:
curl -s -X PATCH "http://localhost:1640/stamps/topup/{BATCH_ID}/2" \ -H "Gas-Price: 10"

{"code":500,"message":"cannot topup batch"}

Config:

minimum-gas-tip-cap: 2
full-node: false
swap-enable: false

Logs:

"time"="2026-01-29 13:39:34.554380" "level"="debug" "logger"="node/transaction" "msg"="estimate gas failed" "sender_address"="0xb25D7c21Fd221719826028D371bEabf74eB061EE" "error"="Transaction execution fails"
"time"="2026-01-29 13:39:34.923401" "level"="debug" "logger"="node/api/patch_stamp_topup" "msg"="topup batch: topup failed" "batch_id"="fe5db63cc90c61509744f952c6fae608c7488ce194227d8d31ca9d7fe502b371" "amount"="10" "error"="topup batch: amount 10: Invalid, intrinsic gas too low"
"time"="2026-01-29 13:39:34.923453" "level"="error" "logger"="node/api/patch_stamp_topup" "msg"="topup batch: topup failed"

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):

@akrem-chabchoub akrem-chabchoub self-assigned this Jan 25, 2026
@akrem-chabchoub akrem-chabchoub force-pushed the fix/postage-contract-panic branch from a1a5628 to ad373aa Compare January 25, 2026 22:51
@akrem-chabchoub akrem-chabchoub marked this pull request as ready for review January 25, 2026 22:52

receipt, err := c.sendTopUpBatchTransaction(ctx, batch.ID, topupBalance)
if err != nil {
txHash = receipt.TxHash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is obvious panic, if error happens, receipt is nil

@gacevicljubisa
Copy link
Member

Also, we should return txHash only in case that there is no error:

txHash = receipt.TxHash

so we should adapt for CreateBatch and DiluteBatch

Also, it would be good if this is covered in unit tests as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants