Skip to content
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

refactor(blocking): replace ureq with minreq, update electrsd version #57

Closed

Conversation

notmandatory
Copy link
Member

@notmandatory notmandatory commented Sep 23, 2023

Since ureq still doesn't have an MSRV this PR refactors the blocking esplora client to use minreq.

I also replaced the dependency bitcoin-internals with the new hex-conservative crate.

@notmandatory notmandatory force-pushed the refactor/minreq branch 3 times, most recently from e099d65 to c587389 Compare September 23, 2023 05:40
@notmandatory
Copy link
Member Author

Rebased on master.

Copy link
Contributor

@vladimirfomene vladimirfomene left a comment

Choose a reason for hiding this comment

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

Wasn't sure if this was ready for review but left a couple of early comments.

@@ -18,8 +18,7 @@ path = "src/lib.rs"
[dependencies]
serde = { version = "1.0", features = ["derive"] }
bitcoin = { version = "0.30.0", features = ["serde", "std"], default-features = false }
# Temporary dependency on internals until the rust-bitcoin devs release the hex-conservative crate.
bitcoin-internals = { version = "0.1.0", features = ["alloc"] }
hex-conservative = { version = "0.1"}
Copy link
Contributor

Choose a reason for hiding this comment

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

I saw the following on the docs page of this crate:

Use the package key to improve import ergonomics (hex instead of hex-conservative).
hex = { package = "hex-conservative", version = "*" }

Feel free to ignore it if you think it is not important.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes even though still draft, yes certainly appreciate any early feedback. And I did miss that docs suggestion, I'll update it!

}
}

// Ok(deserialize(&Vec::from_hex(&resp.into_string()?)?)?),
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't forget to get rid of this.

path: &'a str,
) -> Result<T, Error> {
let response = self.get_request(path)?.send();
dbg!(&response);
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is also to be removed

message: resp.into_string()?,
}),
Err(e) => Err(Error::Ureq(e)),
let mut request = minreq::post(format!("{}/tx", self.url)).with_body(
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if there is not a way for us to abstract the creation of this POST request the way we did it with GET

Copy link
Member Author

Choose a reason for hiding this comment

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

Since we only have one post command, I think it's OK to leave this as a one-off function. If in the future a new post function is needed we can see about creating a shared function then.

@notmandatory notmandatory self-assigned this Dec 29, 2023
@TheBlueMatt
Copy link
Contributor

What's the status of this? We're trying to ship binary releases with esplora-client and really don't want to ship a huge pile of HTTP dependencies that we're then taking a responsibility for ensuring we keep up to date. With minreq at least it'd be one crate and we wouldn't have to monitor as many places.

@nondiremanuel
Copy link

@tnull will open a new PR for this, as we said during the Lib Team Call

@TheBlueMatt
Copy link
Contributor

Just noticed ureq added a dependency on a "This is work in progress!" crate written and maintained entirely by a single author (that just broke our MSRV) - https://github.com/algesten/hoot/commits/main/. Definitely need to drop that ASAP :)

@tnull
Copy link
Contributor

tnull commented Jan 31, 2024

Just noticed ureq added a dependency on a "This is work in progress!" crate written and maintained entirely by a single author (that just broke our MSRV) - https://github.com/algesten/hoot/commits/main/. Definitely need to drop that ASAP :)

Note the single author in this case is the ureq maintainer/main author.

Anyways, reported the issue, they pushed out ureq 2.9.4 and introduced an MSRV guarantee of 1.61 within ~1hour. Still, will open a PR switching to minreq soon.

@tnull
Copy link
Contributor

tnull commented Jan 31, 2024

Now superseded by #75.

@notmandatory notmandatory deleted the refactor/minreq branch January 31, 2024 18:50
@coveralls
Copy link

coveralls commented Feb 20, 2024

Pull Request Test Coverage Report for Build 6385992408

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 112 of 149 (75.17%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+6.0%) to 85.361%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/blocking.rs 110 147 74.83%
Totals Coverage Status
Change from base Build 6378033331: 6.0%
Covered Lines: 898
Relevant Lines: 1052

💛 - Coveralls

notmandatory added a commit that referenced this pull request Mar 6, 2024
6a598b2 ci: remove MSRV pinning for jobserver dependency (Steve Myers)
973c768 chore: remove deprecated get_header() function (Steve Myers)
df9c694 refactor(blocking): replace ureq with minreq (Steve Myers)

Pull request description:

  Taking this over from #57.

  So far just a few minor adjustments on top of #57. Tested that syncing LDK works with the updated blocking client (in addition to the tests here).

ACKs for top commit:
  notmandatory:
    ACK 6a598b2

Tree-SHA512: 19488ffbf19c59912c379ee77083ee56f7af7fd7b764f8e6c0b96f574d456a86cefdbacb6bf31dc8c1b3317e139a3ed1b54211c8ccfe55e5ad427c512a16b723
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants