Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
Remove rust v1.56 pin. (#85)
Browse files Browse the repository at this point in the history
Latest stable rust no longer has the issue that was causing builds to
get stuck.
  • Loading branch information
cobward authored Mar 1, 2022
1 parent eb2e0b3 commit f791f3b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ jobs:
path: didkit
ref: 436f53baa875564dccf8c04deb57a424290358af
submodules: true

# This is necessary until cargo build doesn't hang on stable rust.
- name: Configure rust
run: rustup default 1.56

- name: Build
run: cargo build --verbose
Expand All @@ -58,7 +54,6 @@ jobs:

- name: Configure rust
run: |
rustup default 1.56
rustup component add clippy
- name: Clippy
Expand All @@ -74,7 +69,6 @@ jobs:

- name: Configure rust
run: |
rustup default 1.56
rustup component add rustfmt
- name: Fmt
Expand Down
13 changes: 6 additions & 7 deletions src/orbit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl OrbitMetadata {
}

pub enum AuthTokens {
Tezos(TezosAuthorizationString),
Tezos(Box<TezosAuthorizationString>),
ZCAP(Box<ZCAPTokens>),
SIWEZcapDelegated(Box<SIWEZcapTokens>),
SIWEDelegated(Box<SIWETokens>),
Expand All @@ -94,7 +94,7 @@ impl<'r> FromRequest<'r> for AuthTokens {
async fn from_request(request: &'r Request<'_>) -> Outcome<Self, Self::Error> {
let ats =
if let Outcome::Success(tz) = TezosAuthorizationString::from_request(request).await {
Self::Tezos(tz)
Self::Tezos(Box::new(tz))
} else if let Outcome::Success(siwe) = SIWETokens::from_request(request).await {
Self::SIWEDelegated(Box::new(siwe))
} else if let Outcome::Success(siwe) = SIWEZcapTokens::from_request(request).await {
Expand Down Expand Up @@ -133,7 +133,7 @@ impl AuthorizationToken for AuthTokens {
impl AuthorizationPolicy<AuthTokens> for OrbitMetadata {
async fn authorize(&self, auth_token: &AuthTokens) -> Result<()> {
match auth_token {
AuthTokens::Tezos(token) => self.authorize(token).await,
AuthTokens::Tezos(token) => self.authorize(token.as_ref()).await,
AuthTokens::ZCAP(token) => self.authorize(token.as_ref()).await,
AuthTokens::SIWEDelegated(token) => self.authorize(token.as_ref()).await,
AuthTokens::SIWEZcapDelegated(token) => self.authorize(token.as_ref()).await,
Expand Down Expand Up @@ -318,8 +318,7 @@ async fn load_orbit_(dir: PathBuf, relay: (PeerId, Multiaddr)) -> Result<Orbit>
.clone()
.into_iter()
.filter(|(p, _)| p != &local_peer_id)
.map(|(peer, addrs)| addrs.into_iter().zip(std::iter::repeat(peer)))
.flatten()
.flat_map(|(peer, addrs)| addrs.into_iter().zip(std::iter::repeat(peer)))
.map(|(addr, peer_id)| Ok(MultiaddrWithoutPeerId::try_from(addr)?.with(peer_id))),
)
.try_for_each(|multiaddr| ipfs.connect(multiaddr))
Expand All @@ -335,7 +334,7 @@ async fn load_orbit_(dir: PathBuf, relay: (PeerId, Multiaddr)) -> Result<Orbit>
pub fn parse_hosts_str(s: &str) -> Result<Map<PeerId, Vec<Multiaddr>>> {
s.split('|')
.map(|hs| {
hs.split_once(":")
hs.split_once(':')
.ok_or_else(|| anyhow!("missing host:addrs map"))
.and_then(|(id, s)| {
Ok((
Expand All @@ -352,7 +351,7 @@ pub fn parse_hosts_str(s: &str) -> Result<Map<PeerId, Vec<Multiaddr>>> {
pub fn get_params(matrix_params: &str) -> Result<Map<String, String>> {
matrix_params
.split(';')
.map(|pair_str| match pair_str.split_once("=") {
.map(|pair_str| match pair_str.split_once('=') {
Some((key, value)) => Ok((
urlencoding::decode(key)?.into_owned(),
urlencoding::decode(value)?.into_owned(),
Expand Down
4 changes: 2 additions & 2 deletions src/siwe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ impl<'r> FromRequest<'r> for SIWETokens {
.resources
.first()
.and_then(|u| u.as_str().strip_prefix("kepler://"))
.and_then(|p| p.split_once("#"))
.map(|(op, a)| match op.rsplit_once("/") {
.and_then(|p| p.split_once('#'))
.map(|(op, a)| match op.rsplit_once('/') {
Some((o, p)) => Ok((
Cid::from_str(o)?,
Some(p.strip_prefix("s3/").unwrap_or(p)),
Expand Down
2 changes: 1 addition & 1 deletion src/tz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl<'r> FromRequest<'r> for TezosAuthorizationString {
match request
.headers()
.get_one("Authorization")
.map(|s| Self::from_str(s))
.map(Self::from_str)
{
Some(Ok(t)) => Outcome::Success(t),
_ => Outcome::Forward(()),
Expand Down

0 comments on commit f791f3b

Please sign in to comment.