-
Notifications
You must be signed in to change notification settings - Fork 62
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
Publish/validate before db commit #2856
Conversation
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.
Lots of additional Clone
derives, which indicate that we now clone more. Not entirely sure where this is and how big the impact is, pretty sure it could be avoided though from what I read.
In bad136e, which is on top of this PR, I removed a bunch of the clones again, and passed the arguments to |
In https://github.com/nimiq/core-rs-albatross/compare/nibhar/publish-pre-commit?expand=1 I also added the changed documentation, as well as a |
4308c1a
to
92ecfd6
Compare
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.
LGTM, nice way to decouple the publish and commit. 1 small log thing.
pub(crate) enum ProduceMicroBlockEvent { | ||
MicroBlock(MicroBlock, PushResult), | ||
MicroBlock, | ||
} |
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 like this event is now unused and we could get rid of it. But it's also not breaking anything so I think it would be fine to address this in a separate 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.
Yes it is unused and could be removed.
Removing it will likely also entail making the micro Producer no longer having to implement Stream. That probably will mean a bunch of additional changes (for the better).
I opted not to do it here as it is out of scope of 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.
Maybe the "fix clippy warning" commit could be dropped instead of half-removing the MicroBlock
event. A #[allow()]
could be used instead, leaving the (full) removal for a future 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.
For the time being I don't plan on doing any additional work there. The Event is unused, but removing the stream makes us less flexible in the future. If the micro producer is ever going to return something meaningful again it would have to be re implemented. It does not break anything as it is and I think it is semantically not too bad either.
e7dc06c
to
b113d42
Compare
b113d42
to
c9952fc
Compare
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.
LGTM
c9952fc
to
d4d854d
Compare
* Fixed compilation error with no features on blockchain crate. * cleanup after rebase.
Rebasing branch and signing commits for merge |
d4d854d
to
93e9788
Compare
This PR adds a post-validation hook to the blockchain and uses it to publish/validate blocks before the database commit is happening. This way, the blocks are forwarded to the network without waiting for the database.
Pull request checklist
clippy
andrustfmt
warnings.