Skip to content

[TESTNET BUG] block_txs_payload unwraps Clarity response object #2097

@friedger

Description

@friedger

Describe the bug

The following contract defines a fungible token. It was deployed and a transfer call failed because the user didn't own the asset. However, the transaction result is shown as (err u1) instead of (ok (err u1))

(define-constant owner 'ST3X2W2SH9XQZRHHYJ21KWGTT1N6WX3D48K1NSTPE)
(define-fungible-token connect-token)
(begin (ft-mint? connect-token u100000000 owner))
(define-public (transfer (recipient principal) (amount uint))
  (ok (ft-transfer? connect-token amount tx-sender recipient)))

Steps To Reproduce

  1. setup mocknet and stacks-node-api
  2. deploy contract to mocknet
  3. send transfer tx with post condition
  4. use tx id to find tx on stacks-node-api
  5. see tx_result is equal to (err u1)

Expected behavior

The tx_result should be (ok (err u1))

Example (25 Nov 2020)

contract:
https://stacks-node-api.blockstack.org/extended/v1/tx/0x312cb2ba8c91183a57e02a2928b325ed18753d0043c50da7dd4ad2aa0675f1b6

transfer tx:
https://stacks-node-api.blockstack.org/extended/v1/tx/0x731b5ba5af6b07bea60a0f5d8552555794955dc41350e47c46d745264b22959f


If you think this is eligible for a bug bounty, please check the relevant boxes below:

Critical, Launch Blocking Bugs

Consensus critical bugs

  • Can cause a chain split
  • Can cause an invalid transaction to get mined
  • Can cause an invalid block to get accepted
  • Can cause a node to stall

State corruption

  • Can modify a smart contract’s data maps and data vars without a `contract-call?

Stolen funds

  • Any address losing STX without a corresponding transfer
  • Modify token balances and NFT ownership in other contracts without a contract-call?

Take control and/or bring network to a halt

  • Take control and/or bring network to a halt

Major, Launch Blocking Bugs

Major bugs

  • Performance or correctness bugs that don’t rise to P0 level
  • Stress test or DoS attacks that slow things down enough
  • Resource exhaustion
  • Expected functionality doesn’t work in obvious ways (important to be super specific with this wording)

Minor, Non-launch blocking bugs

Minor bugs

  • Bugs in non-critical software (CLI, UI, etc) that doesn’t impact critical functionality

Metadata

Metadata

Labels

bugUnwanted or unintended property causing functional harmlockedtestnet

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions