Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sbtc withdrawal does not use dust amount #1580

Open
friedger opened this issue Oct 25, 2023 · 1 comment
Open

sbtc withdrawal does not use dust amount #1580

friedger opened this issue Oct 25, 2023 · 1 comment
Labels
bug Unwanted or unintended logic causing harm

Comments

@friedger
Copy link
Collaborator

What version of Stacks.js are you using?

    "sbtc": "^0.1.8"

Describe the bug

Calling sbtcWithdrawHelper results in a btc tx with 3 outputs where the second spends the total amount.

Screenshot from 2023-10-25 17-23-12

How to reproduce

Follow the tutorial on https://stacks-network.github.io/sbtc-docs/withdrawal.html
and call

 const tx = await sbtcWithdrawHelper({
      sbtcWalletAddress,
      bitcoinAddress: btcAddress,
      amountSats: total,
      signature,
      feeRate: await helper.estimateFeeRate('low'),
      utxos,
      bitcoinChangeAddress: btcAddress,
      fulfillmentFeeSats: 2000,
    });

Expected behavior

Second output should be a dust value
as described in https://github.com/stacks-network/sbtc/blob/main/sbtc-core/src/operations/op_return/withdrawal_request.rs#L287C22-L287C43

@friedger friedger added the bug Unwanted or unintended logic causing harm label Oct 25, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in DevTools Oct 25, 2023
@janniks
Copy link
Collaborator

janniks commented Oct 25, 2023

Got it, thanks for the report. I had been using the same serialization from the bridge-lib earlier, but only the dust amount was withdrawn, so I assumed this was the right way of doing things. This way I got the withdraw to work on devenv 😬

fyi, I heard you were asking about helper methods eg. for fetching balance. See the tests/ folder in the sbtc package. (They are not runnable as a whole test-suite right now, but more are a collection of runnable snippets helpful for the sbtc devenv flow)

@janniks janniks moved this from 🆕 New to 📋 Backlog in DevTools Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unwanted or unintended logic causing harm
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants