-
Notifications
You must be signed in to change notification settings - Fork 671
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
Feat/stacks signer #3850
Feat/stacks signer #3850
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3850 +/- ##
===========================================
- Coverage 0.16% 0.16% -0.01%
===========================================
Files 322 339 +17
Lines 287661 290230 +2569
===========================================
Hits 469 469
- Misses 287192 289761 +2569
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
…projects (like the signer binaries)
…NS not being available
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.
The stacks signer seems like it could use a request library like ureq
or reqwest
rather than implementing a new HTTP client.
Sure; I just added a really simple one for testing / debugging purposes. The stacker-signer will code to the trait, not this particular implementation. |
…signers will need them too
…would use this crate to implement a Stacks event receiver and a runloop.
Signed-off-by: Jacinta Ferrant <[email protected]>
Signed-off-by: Jacinta Ferrant <[email protected]>
Signed-off-by: Jacinta Ferrant <[email protected]>
Implement full DkgSign over StackerDB
…s interested; remove sleep calls in test since we know when it's done
Signed-off-by: Jacinta Ferrant <[email protected]>
Signed-off-by: Jacinta Ferrant <[email protected]>
Signed-off-by: Jacinta Ferrant <[email protected]>
Signed-off-by: Jacinta Ferrant <[email protected]>
Signed-off-by: Jacinta Ferrant <[email protected]>
@kantai @stjepangolemac @xoloki @jferrant There are a few PRs that are blocked on this PR. Can we merge this to |
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.
Looks good! My only real comment is that it would be great to remove as much custom HTTP
code as possible, since we're using tiny_http
internally now in libsigner
. But I'd be happy if this all went in as-is.
I can also submit upstream PRs to tiny_http
to remove any unsafe
code there. I'd good at playing the open source game ;)
|
||
/// Decoding of the relevant parts of a signer-directed HTTP request from the Stacks node | ||
#[derive(Debug)] | ||
pub struct SignerHttpRequest { |
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.
Since we're using tiny_http
now, probably all of this can go away.
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.
Did that happen in an upstream PR? Or is this just now dead code?
Either way, would it make sense to first merge the PR that includes tiny_http
into this PR first, and then merge this PR with tiny_http
applied?
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.
This happened in the first Signer
PR:
https://github.com/stacks-network/stacks-blockchain/blob/feat/stacks-signer/libsigner/Cargo.toml#L29
https://github.com/stacks-network/stacks-blockchain/blob/feat/stacks-signer/libsigner/src/events.rs#L33
https://github.com/stacks-network/stacks-blockchain/blob/feat/stacks-signer/libsigner/src/events.rs#L201
We're currently using it as an HTTP
server for StackerDBEventReceiver
. So all of the server side HTTP
parsing can go away in libsigner
, since tiny_http
comes with its own parser and request/response objects, along with all the tests.
In a later PR we can explore getting rid of async_h1
, which is used for the client side of the stacks event observer code.
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.
So AFAICT all of the libsigner
custom HTTP
code is now dead.
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.
Lines 33 through 127 are dead. However, we do use the run_http_request code (rpc_request is used throughout SignerSession which in turn uses run_http_request and a few other of the functions here)
|
||
use stacks_common::util::chunked_encoding::*; | ||
|
||
#[test] |
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.
This can also probably all go away since we're using tiny_http
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.
Lines 29 through 101 can but until we update SignerSession, we can't get rid of the rest.
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 haven't seen anything obviously wrong or weird, but the PR is large so take this with a grain of salt.
Signed-off-by: Jacinta Ferrant <[email protected]>
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.
Aside from potentially deleting the portions of dead HTTP code, might want to make a ticket to fully remove it from SignerSession and to use tiny http instead. Aside from that would just merge and build smaller PRs off of Develop.
So TLDR. LGTM
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR adds in the event observer system for StackerDB chunk arrivals, and adds a
libsigner
crate which consumes them and feeds them into a signer-specific runloop. StackerDB events contain the chunk data, so downstream consumers do not need to go and pull them.libsigner
is a basic crate that just implements an event observer client forStackerDB
messages, and a means of passing them into an implementation-specific runloop body. See the unit test inlibsigner/src/tests/mod.rs
for example usage.