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

Implement burn #3437

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

onchainguy-btc
Copy link
Contributor

After my first burn PR (#2766) got a bit outdated, I created a new one. Tried to make as less changes as possible. This PR does not support burn messages yet. Hope we can get the general burning merged first and then I'm happy to add support for an optional burn message via data pushes.

Copy link
Collaborator

@raphjaph raphjaph left a comment

Choose a reason for hiding this comment

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

Finally having a look at this. There's just two things but they probably require a bit of refactoring. Especially the new command ord wallet burn I think is important because burning is quite drastic and we want it to be a very distinct action.

src/subcommand/wallet/send.rs Outdated Show resolved Hide resolved
src/wallet/transaction_builder.rs Outdated Show resolved Hide resolved
@onchainguy-btc
Copy link
Contributor Author

@raphjaph thanks for the feedback, will get that done asap!

@onchainguy-btc
Copy link
Contributor Author

@raphjaph just implemented the changes. Let me know if I can improve on anything else. Can also write some more tests if you have ideas for some good ones.

Copy link
Collaborator

@raphjaph raphjaph left a comment

Choose a reason for hiding this comment

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

In OP_RETURNs there is no dust_limit and I see that you correctly disable the check for that. One thing you could try doing is only burn the exact sat that the inscription is on instead of the whole UTXO. This will require some careful changes to the TransactionBuilder, which should then be tested as well in the unit tests of the transaction_builder.rs file.

src/subcommand/wallet/burn.rs Outdated Show resolved Hide resolved
src/subcommand/wallet/send.rs Outdated Show resolved Hide resolved
src/subcommand/wallet/send.rs Outdated Show resolved Hide resolved
@onchainguy-btc
Copy link
Contributor Author

In OP_RETURNs there is no dust_limit and I see that you correctly disable the check for that. One thing you could try doing is only burn the exact sat that the inscription is on instead of the whole UTXO. This will require some careful changes to the TransactionBuilder, which should then be tested as well in the unit tests of the transaction_builder.rs file.

@raphjaph Do you think that's worth it? If I'm not mistaking doing so would add additional inputs to the transaction for extracting the sat. The fee for that could potentially be higher than what the inscription sats are worth.

As an alternative idea: What if we exit the ord wallet burn command with an error if the inscription is on a utxo with more than 10_000 sats. This way we can prevent burning large bitcoin amounts by mistake. If people still want to burn the inscriptions, they can first transfer it to a different, smaller output.

crates/ordinals/src/charm.rs Outdated Show resolved Hide resolved
@raphjaph
Copy link
Collaborator

@raphjaph Do you think that's worth it? If I'm not mistaking doing so would add additional inputs to the transaction for extracting the sat. The fee for that could potentially be higher than what the inscription sats are worth.

That's true, then let's just leave it how it is for now.

As an alternative idea: What if we exit the ord wallet burn command with an error if the inscription is on a utxo with more than 10_000 sats. This way we can prevent burning large bitcoin amounts by mistake. If people still want to burn the inscriptions, they can first transfer it to a different, smaller output.

Sounds reasonble

@onchainguy-btc
Copy link
Contributor Author

@raphjaph Do you think that's worth it? If I'm not mistaking doing so would add additional inputs to the transaction for extracting the sat. The fee for that could potentially be higher than what the inscription sats are worth.

That's true, then let's just leave it how it is for now.

As an alternative idea: What if we exit the ord wallet burn command with an error if the inscription is on a utxo with more than 10_000 sats. This way we can prevent burning large bitcoin amounts by mistake. If people still want to burn the inscriptions, they can first transfer it to a different, smaller output.

Sounds reasonble

Cool, will adapt to that!

@raphjaph
Copy link
Collaborator

raphjaph commented Jun 2, 2024

Let me know when this is ready for review :)

@onchainguy-btc
Copy link
Contributor Author

@raphjaph Ready for review ✅

@onchainguy-btc
Copy link
Contributor Author

@raphjaph just saw you merged master? Was that on purpose? I can also just rebase if you like.

@raphjaph
Copy link
Collaborator

raphjaph commented Jun 28, 2024

@onchainguy-btc don't worry about rebasing, I'm going to squash merge this anyway. Gonna have a look at this today or tomorrow.

The tests and linting also don't seem to pass yet. If you could fix, that would be great :)

You can run our CI if you install just and run just ci.

Copy link
Collaborator

@raphjaph raphjaph left a comment

Choose a reason for hiding this comment

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

See comments above

@onchainguy-btc
Copy link
Contributor Author

In my last commit I also protected last postage from being burned. Not 100% sure if that makes sense though.

Copy link
Collaborator

@raphjaph raphjaph left a comment

Choose a reason for hiding this comment

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

@onchainguy-btc This looks almost ready to go! I just made a couple small changes and also ran the fuzzing tests on the transaction builder.

Could you add some more tests:

  1. Multiple inscriptions in the same utxo and then try to burn and make sure it either fails or only burns the correct inscription.
  2. An inscription and a rune in the same utxo and then it should fail.
  3. Try ord wallet burn <RUNE_ID> and it should fail.

@onchainguy-btc
Copy link
Contributor Author

@raphjaph just implemented the tests you requested ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Ready for Review
Development

Successfully merging this pull request may close these issues.

3 participants