Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

cleanup stratum errors#10884

Closed
debris wants to merge 2 commits into
masterfrom
stratum-errors
Closed

cleanup stratum errors#10884
debris wants to merge 2 commits into
masterfrom
stratum-errors

Conversation

@debris
Copy link
Copy Markdown
Collaborator

@debris debris commented Jul 14, 2019

No description provided.

@debris debris added A0-pleasereview 🤓 Pull request needs code review. M4-core ⛓ Core client code / Rust. labels Jul 14, 2019
@debris debris requested a review from dvdplm July 14, 2019 17:39
@ordian
Copy link
Copy Markdown
Member

ordian commented Jul 15, 2019

What's the motivation behind replacing Errors with Strings?

@debris
Copy link
Copy Markdown
Collaborator Author

debris commented Jul 15, 2019

Getting rid of bloated error types which contain the same kind of errors on multiple levels and are never matched.

I believe that if the 'error' is created only in one place and is never matched it does not deserve it's own type

Comment thread miner/stratum/src/lib.rs
}

fn push_work_all(&self, payload: String, tcp_dispatcher: &Dispatcher) -> Result<(), Error> {
fn push_work_all(&self, payload: String, tcp_dispatcher: &Dispatcher) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

wow, so this method has actually always returned an Ok(()), 👍

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Addressed this in #11161

@ordian ordian added this to the 2.7 milestone Jul 15, 2019
@ordian ordian added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Jul 15, 2019
@debris debris requested a review from tomusdrw July 16, 2019 09:45
Copy link
Copy Markdown
Collaborator

@tomusdrw tomusdrw left a comment

Choose a reason for hiding this comment

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

IMHO Stringifying errors is completely backwards, I don't understand how this cleans things up. By looking at the error enumeration you could at least roughly identify negative cases which gives a tremendous insight into the code.

I don't see this change as an improvement at all, I think that rather we should eradicate ALL String error types in the codebase.

@debris debris added A4-gotissues 💥 Pull request is reviewed and has significant issues which must be addressed. and removed A8-looksgood 🦄 Pull request is reviewed well. labels Jul 17, 2019
@dvdplm
Copy link
Copy Markdown
Collaborator

dvdplm commented Aug 6, 2019

I'm not sure I agree with this either, in particular I think that a proper error type helps readability – at a glance I know what the anticipated error conditions for a crate/module are. New devs looking at the code are going to go look for the errors too, and if they have to chase around for strings sprinkled all over the place they'll hate us.

@debris when you say that the error types are bloated, what are you referring to? You mean actually bloated as in "a potential performance problem" or more "unneeded type wankery"?

dvdplm added a commit that referenced this pull request Oct 10, 2019
Salvage some code from #10884 + some cleanup and typos.
@dvdplm dvdplm mentioned this pull request Oct 10, 2019
dvdplm added a commit that referenced this pull request Oct 11, 2019
* Cleanup stratum a bit

Salvage some code from #10884 + some cleanup and typos.

* HashSet::new does not allocate before first insert

* Remove unused method push_work()
@dvdplm
Copy link
Copy Markdown
Collaborator

dvdplm commented Oct 11, 2019

Closing as stale.

@dvdplm dvdplm closed this Oct 11, 2019
@ordian ordian deleted the stratum-errors branch October 16, 2019 10:03
niklasad1 pushed a commit that referenced this pull request Nov 5, 2019
* Cleanup stratum a bit

Salvage some code from #10884 + some cleanup and typos.

* HashSet::new does not allocate before first insert

* Remove unused method push_work()
dvdplm added a commit that referenced this pull request Nov 6, 2019
* Cleanup stratum a bit

Salvage some code from #10884 + some cleanup and typos.

* HashSet::new does not allocate before first insert

* Remove unused method push_work()
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A4-gotissues 💥 Pull request is reviewed and has significant issues which must be addressed. M4-core ⛓ Core client code / Rust.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants