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
Separate all bitcoinconsensus validation stuff in module #330
Conversation
09a4d52
to
aa2fbbe
Compare
if you are fancy this could also have functions
|
I think you forgot to commit the validation.rs file. :) |
aa2fbbe
to
ee90201
Compare
Haha, of course I did! Fixed. |
9a92599
to
cd23159
Compare
@stevenroose this does not compile, please fix or close |
cd23159
to
733d5a4
Compare
updated |
Codecov Report
@@ Coverage Diff @@
## master #330 +/- ##
==========================================
+ Coverage 82.17% 82.56% +0.39%
==========================================
Files 38 39 +1
Lines 7063 7510 +447
==========================================
+ Hits 5804 6201 +397
- Misses 1259 1309 +50
Continue to review full report at Codecov.
|
Needs rebase. concept ACK. @stevenroose one thing I like about this is that it removes In #413 you add some new instances of feature-gated enum variants. I wonder if we should change that too? |
25fbea0
to
a691dd9
Compare
Rebased and updated this PR. |
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 310f9926049cd379675c242154f7d37f3cda0fc4
I think it might be a superior approach for compatibility to implement the functions in the validation module on the type rather than as standalone funcs. e.g. pub struct Foo;
impl Foo {
pub fn foo(){
println!("foo");
}
}
mod extend {
impl super::Foo {
pub fn bar() {
println!("bar");
}
}
}
fn main() {
Foo::bar();
Foo::foo();
} |
Hmm, in what way do you mean "for compatibility"? |
the method names do not change, nor does how you call them. less impact on the crate's current users. |
Oh yeah this PR is so old I forgot it removes existing methods. How about
adding them so that we have the bare module functions and the existing
methods that refer to them?
…On Sat, Oct 31, 2020, 23:19 Jeremy Rubin ***@***.*** wrote:
the method names do not change, nor does how you call them. less impact on
the crate's current users.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#330 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGQLXCFD2DXRBR3HX2FXADSNSLRDANCNFSM4IWTCQHA>
.
|
not sure what you're suggesting -- it's fine that this is a breaking change w.r.t. a feature flag on the crate, I'm more pointing out that you can just move the impls to a split out feature module and not rename or remove any exisiting method. |
I think it makes more sense for the verify method to keep track of double-spending itself instead of requiring the closure to do that. When internally keeping track of double-spending, the closure can just be a simple inspector closure and doesn't need to mutate any state, making it a lot simpler and potentially more efficient. Also, OutPoint is Copy, so doesn't need to be referenced.
a691dd9
to
20a4f0e
Compare
@JeremyRubin I added the methods you suggested. Now they're duplicated with the raw module functions though. I somehow feel that it makes sense to bundle validation in one module and just have it there as module functions. Perhaps I should mark the type methods as deprecated? Thoughts? @apoelstra @elichai @sgeisler ? |
Not sure if it's the right place to put the module, but I think it makes more sense to have all validation stuff inside the same module and have a validation::Error type for validation methods.
Concept ACK for splitting, |
The issue with @stevenroose I guess I was saying that I don't see a reason to introduce the non type methods at all? Is this a general direction we're going or is there a plan to make this a separate crate? |
Hey @stevenroose I like the purpose of this PR, do you want me to redo it? Just offering because it will be way easier for me to do it from scratch knowing whats changed in the codebase since you originally did this than you trying to rebase. |
Yeah sure, go ahead use whatever I put here. |
eb453b8 Add global context API (Tobin Harding) 3ecb5e4 Refactor from_secret_key definition (Tobin Harding) e2d47a2 Remove unnecessary import statement (Tobin Harding) d79989b Remove erroneous duplicate feature (Tobin Harding) Pull request description: Our API often involves a `Secp256k1` parameter, when users enable the `global-context` feature they must then pass `SECP256K1` into these functions. This is kind of clunky since the global is by definition available everywhere. Make the API more ergonomic for `global-context` builds by adding various API functions/methods that use the global context implicitly. The first 3 patches are clean up. Resolves: rust-bitcoin#330 ACKs for top commit: apoelstra: ACK eb453b8 Tree-SHA512: 21d89a6688c24a7920d48ea92d923889bec2bbe9dc5ed5e33639405be45a50f50022a28dc1f235b8bea850ac39013c7dd24b5aed086ed40f5b259dd44c06433d
Done in #1912 |
Includes #327.
Not sure if it's the right place to put the module, but I think it makes
more sense to have all validation stuff inside the same module and have
a
validation::Error
type for validation methods.