From 3635cbdc8d919025d76c5fa057ab744f13971684 Mon Sep 17 00:00:00 2001 From: dynco-nym <173912580+dynco-nym@users.noreply.github.com> Date: Thu, 29 Aug 2024 01:22:51 +0200 Subject: [PATCH] Replace deprecated code --- .../validator-client/src/nyxd/cosmwasm_client/helpers.rs | 3 ++- common/client-libs/validator-client/src/rpc/reqwest.rs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/common/client-libs/validator-client/src/nyxd/cosmwasm_client/helpers.rs b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/helpers.rs index c437125b16..b60b4982cd 100644 --- a/common/client-libs/validator-client/src/nyxd/cosmwasm_client/helpers.rs +++ b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/helpers.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::nyxd::error::NyxdError; +use base64::Engine; use cosmrs::abci::TxMsgData; use cosmrs::cosmwasm::MsgExecuteContractResponse; use cosmrs::proto::cosmos::base::query::v1beta1::{PageRequest, PageResponse}; @@ -16,7 +17,7 @@ pub fn parse_msg_responses(data: Bytes) -> Vec { // it seems that currently, on wasmd 0.43 + tendermint-rs 0.37 + cosmrs 0.17.0-pre // the data is left in undecoded base64 form, but I'd imagine this might change so if the decoding fails, // use the bytes directly instead - let data = if let Ok(decoded) = base64::decode(&data) { + let data = if let Ok(decoded) = base64::prelude::BASE64_STANDARD.decode(&data) { decoded } else { error!("failed to base64-decode the 'data' field of the TxResponse - has the chain been upgraded and introduced some breaking changes?"); diff --git a/common/client-libs/validator-client/src/rpc/reqwest.rs b/common/client-libs/validator-client/src/rpc/reqwest.rs index 973fb63376..e20764d162 100644 --- a/common/client-libs/validator-client/src/rpc/reqwest.rs +++ b/common/client-libs/validator-client/src/rpc/reqwest.rs @@ -3,6 +3,7 @@ use crate::rpc::TendermintRpcClient; use async_trait::async_trait; +use base64::Engine; use cosmrs::tendermint::{block::Height, evidence::Evidence, Hash}; use reqwest::header::HeaderMap; use reqwest::{header, RequestBuilder}; @@ -13,7 +14,6 @@ use tendermint_rpc::{ query::Query, Error, Order, Response, SimpleRequest, }; - use url::Url; // copied macro from tendermint-rpc crate because that's exactly what we have to do here too @@ -206,7 +206,7 @@ pub fn extract_authorization(url: &Url) -> Option { let authority = url.authority(); if let Some((userpass, _)) = authority.split_once('@') { - Some(base64::encode(userpass)) + Some(base64::prelude::BASE64_STANDARD.encode(userpass)) } else { None }