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

Sandbox transaction fails with buffer values #965

Open
whoabuddy opened this issue Jan 20, 2023 · 1 comment
Open

Sandbox transaction fails with buffer values #965

whoabuddy opened this issue Jan 20, 2023 · 1 comment
Labels

Comments

@whoabuddy
Copy link

Describe the bug

This started with testing a simple Clarity contract that can stack its own STX through pool delegation.

This contract call would not work from the sandbox, however is working from the local test as well as through a custom script.

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://explorer.stacks.co/sandbox/contract-call?chain=mainnet
  2. Paste in the contract value: SP2HNY1HNF5X25VC7GZ3Y48JC4762AYFHKS061BM0.stacking-contract
  3. Click Get contract
  4. Click stack-stx
  5. Enter values below:

The resulting transaction then contains incorrect buffer values, should be (buff 1) and (buff 20):

  • poxVer: 0x30783031 (buff 4)
  • poxHash: 0x307831336566666562653065613462623435653335363934663561313562623562393665383531616662 (buff 42)

Removing the leading 0x on the hex string results in incorrect values as well:

  • poxVer: 0x3031 (buff 2)
  • poxHash: 0x31336566666562653065613462623435653335363934663561313562623562393665383531616662 (buff 40)

Using Clarinet testing, the hex string needed to be passed in the tx options.

Using micro-stacks and a script, the hex string needed to be processed as bufferCV(hexToBytes(string)) instead of bufferCVFromString(string) to get the correct value.

Expected behavior

A clear way to know what value to provide, or confirmation that the values provided should be handled a different way.

The correct result for the transaction would be:

  • poxVer: 0x01
  • poxHash: 0x13effebe0ea4bb45e35694f5a15bb5b96e851afb

Screenshots

From the sandbox:

image

From the script:

image

Additional context

Related transaction:
https://explorer.stacks.co/txid/dbbecf8113b530bd12ca67c425cc1c27a0bf7916ded65e106cf0ecc8fb28c75a?chain=mainnet

Related issues:

@friedger
Copy link
Contributor

The current implementation expects that the user enters utf8 that is converted to buffer using encodeClarityValue from stacks.js
This is useful, e.g. for BNS contract. This is not useful for e.g. PoX contract

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants