-
Notifications
You must be signed in to change notification settings - Fork 11
feat: enable random anti-fee sniping #5
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
base: master
Are you sure you want to change the base?
feat: enable random anti-fee sniping #5
Conversation
6a39ba9 to
94237e8
Compare
|
Thanks @aagbotemi I'm still in the process of reviewing. I agree it would be nice to resolve the clippy error - my other suggestion would be to globally allow the lints in |
Thank you @ValuedMammal. Clippy error and large enum variant error in the CI build has been fixed. For subsequent ones(if there is), I'll open another for it. |
ValuedMammal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some review notes
- For imports, prefer
allocoverstd. This way we can actually support no-std. - I want to see a test of some kind that creates a PSBT with
enable_anti_fee_snipingand checks the expected values of the locktime and/or sequence.
Noted. |
42fe314 to
cfe7b5b
Compare
cfe7b5b to
9041b2f
Compare
|
We should also be able to remove the clippy allow attributes in |
Alright, I will remove the clippy allow attributes in |
|
I'm still in favor of using |
Fixed! I've updated the code to use |
5506018 to
9fde5c1
Compare
ff19f53 to
c4dd696
Compare
|
In general I think the git history would be cleaner if we didn't merge with merge commits but instead rebase the commits in this PR. |
cfa9826 to
4649e8d
Compare
Alright, I've done the cleanup |
|
Approach ACK. |
74d705d to
65a6eec
Compare
|
Sorry about the merge conflict. |
Alright. I will rebase to resolve the conflict. |
65a6eec to
cd6e919
Compare
3d7c798 to
d3a378e
Compare
|
Currently running error[E0433]: failed to resolve: could not find `rand` in `key`
--> src/selection.rs:201:74
|
201 | ...::bitcoin::key::rand::thread_rng())
| ^^^^ could not find `rand` in `key`
|
note: found an item that was configured out
--> /home/abiodun/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bitcoin-0.32.7/src/crypto/key.rs:29:20
|
29 | pub use secp256k1::rand;
| ^^^^
note: the item is gated behind the `rand-std` feature
--> /home/abiodun/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bitcoin-0.32.7/src/crypto/key.rs:28:7
|
28 | #[cfg(feature = "rand-std")]
| ^^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0433`.
error: could not compile `bdk_tx` (lib) due to 1 previous errorThe solution I could think of is moving bitcoin from EDIT: another solution is to add the |
d3a378e to
d9d165b
Compare
d9d165b to
9e8c355
Compare
9e8c355 to
88e798d
Compare
88e798d to
ddf46bf
Compare
|
Looks good overall, not sure if any review comments are still unresolved. |
ddf46bf to
ed9df3c
Compare
ValuedMammal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK ed9df3c
- You could make a note somewhere that this also includes an API breaking change in
CreatePsbtError - Following up on the no-std discussion, we should have default features disabled for
bdk_coin_selectdependency, but I ran into an issue trying to implement it - bitcoindevkit/coin-select#36
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK ed9df3c
A little bit redundant now, but worth vouching for regardless.
To complement @ValuedMammal, I think is enough to change commit ed9df3c message from feat: enable random anti-fee sniping to feat!: enable random anti-fee sniping and comment about the rationale for the variant additions on the body of the commit message.
Noted. Thank you.
no-std support is blocked by bdk_coin_select not having a no-std feature. I will fix it upstream.
Thank you for the suggestion. I will fix it |
4190c17 to
58b7134
Compare
58b7134 to
7047874
Compare
BREAKING CHANGE: - `CreatePsbtError::MissingFullTxForLegacyInput` and `CreatePsbtError::MissingFullTxForSegwitV0Input` now wrap `Input` in `Box` Added new error variants to handle anti-fee-sniping specific failures: - `InvalidLockTime` returns an error when the transaction locktime is time-based instead of height-based - `UnsupportedVersion` returns an error when the transaction version is less than 2
7047874 to
179860e
Compare
nymius
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 179860e
This PR implements Anti-Fee-Sniping with randomization as discussed in issue #4
Notes to the reviewers
The implementation adds randomization to anti-fee-sniping behavior:
Changelog notice
Changed
CreatePsbtError::MissingFullTxForLegacyInputandCreatePsbtError::MissingFullTxForSegwitV0Inputnow wrapInputinBox(breaking change)Added
PsbtParams::enable_anti_fee_snipingfield for BIP326 anti-fee-sniping protectionCreatePsbtError::InvalidLockTimeandCreatePsbtError::UnsupportedVersionerror variantsSelection::create_psbt_with_rngmethod for custom RNGcargo fmtandcargo clippybefore committingCloses #4