mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
chore(deps): bump curve25519-dalek, revert nightly pin (#6497)
This commit is contained in:
2
.github/workflows/book.yml
vendored
2
.github/workflows/book.yml
vendored
@ -58,8 +58,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@nightly
|
- uses: dtolnay/rust-toolchain@nightly
|
||||||
with:
|
|
||||||
toolchain: nightly-2024-02-03
|
|
||||||
- name: Install mdbook
|
- name: Install mdbook
|
||||||
run: |
|
run: |
|
||||||
mkdir mdbook
|
mkdir mdbook
|
||||||
|
|||||||
3
.github/workflows/dependencies.yml
vendored
3
.github/workflows/dependencies.yml
vendored
@ -33,8 +33,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@nightly
|
- uses: dtolnay/rust-toolchain@nightly
|
||||||
with:
|
|
||||||
toolchain: nightly-2024-02-03
|
|
||||||
- name: cargo update
|
- name: cargo update
|
||||||
# Remove first line that always just says "Updating crates.io index"
|
# Remove first line that always just says "Updating crates.io index"
|
||||||
run: cargo update --color never 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
|
run: cargo update --color never 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
|
||||||
|
|||||||
7
.github/workflows/lint.yml
vendored
7
.github/workflows/lint.yml
vendored
@ -24,8 +24,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@clippy
|
- uses: dtolnay/rust-toolchain@clippy
|
||||||
with:
|
|
||||||
toolchain: nightly-2024-02-03
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
cache-on-failure: true
|
cache-on-failure: true
|
||||||
@ -41,8 +39,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@clippy
|
- uses: dtolnay/rust-toolchain@clippy
|
||||||
with:
|
|
||||||
toolchain: nightly-2024-02-03
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
cache-on-failure: true
|
cache-on-failure: true
|
||||||
@ -92,8 +88,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@nightly
|
- uses: dtolnay/rust-toolchain@nightly
|
||||||
with:
|
|
||||||
toolchain: nightly-2024-02-03
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
cache-on-failure: true
|
cache-on-failure: true
|
||||||
@ -113,7 +107,6 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@nightly
|
- uses: dtolnay/rust-toolchain@nightly
|
||||||
with:
|
with:
|
||||||
toolchain: nightly-2024-02-03
|
|
||||||
components: rustfmt
|
components: rustfmt
|
||||||
- run: cargo fmt --all --check
|
- run: cargo fmt --all --check
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/sanity.yml
vendored
2
.github/workflows/sanity.yml
vendored
@ -20,8 +20,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: dtolnay/rust-toolchain@nightly
|
- uses: dtolnay/rust-toolchain@nightly
|
||||||
with:
|
|
||||||
toolchain: nightly-2024-02-03
|
|
||||||
- uses: taiki-e/install-action@cargo-udeps
|
- uses: taiki-e/install-action@cargo-udeps
|
||||||
- name: Check for unused dependencies
|
- name: Check for unused dependencies
|
||||||
run: cargo udeps --lib --features "jemalloc,${{ matrix.network }}"
|
run: cargo udeps --lib --features "jemalloc,${{ matrix.network }}"
|
||||||
|
|||||||
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -1780,9 +1780,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "curve25519-dalek"
|
name = "curve25519-dalek"
|
||||||
version = "4.1.1"
|
version = "4.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c"
|
checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"cpufeatures",
|
"cpufeatures",
|
||||||
|
|||||||
@ -181,10 +181,7 @@ pub(crate) trait DynProtocolHandler: fmt::Debug + Send + Sync + 'static {
|
|||||||
) -> Option<Box<dyn DynConnectionHandler>>;
|
) -> Option<Box<dyn DynConnectionHandler>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> DynProtocolHandler for T
|
impl<T: ProtocolHandler> DynProtocolHandler for T {
|
||||||
where
|
|
||||||
T: ProtocolHandler,
|
|
||||||
{
|
|
||||||
fn on_incoming(&self, socket_addr: SocketAddr) -> Option<Box<dyn DynConnectionHandler>> {
|
fn on_incoming(&self, socket_addr: SocketAddr) -> Option<Box<dyn DynConnectionHandler>> {
|
||||||
T::on_incoming(self, socket_addr)
|
T::on_incoming(self, socket_addr)
|
||||||
.map(|handler| Box::new(handler) as Box<dyn DynConnectionHandler>)
|
.map(|handler| Box::new(handler) as Box<dyn DynConnectionHandler>)
|
||||||
@ -204,13 +201,6 @@ where
|
|||||||
pub(crate) trait DynConnectionHandler: Send + Sync + 'static {
|
pub(crate) trait DynConnectionHandler: Send + Sync + 'static {
|
||||||
fn protocol(&self) -> Protocol;
|
fn protocol(&self) -> Protocol;
|
||||||
|
|
||||||
fn on_unsupported_by_peer(
|
|
||||||
self,
|
|
||||||
supported: &SharedCapabilities,
|
|
||||||
direction: Direction,
|
|
||||||
peer_id: PeerId,
|
|
||||||
) -> OnNotSupported;
|
|
||||||
|
|
||||||
fn into_connection(
|
fn into_connection(
|
||||||
self: Box<Self>,
|
self: Box<Self>,
|
||||||
direction: Direction,
|
direction: Direction,
|
||||||
@ -219,23 +209,11 @@ pub(crate) trait DynConnectionHandler: Send + Sync + 'static {
|
|||||||
) -> Pin<Box<dyn Stream<Item = BytesMut> + Send + 'static>>;
|
) -> Pin<Box<dyn Stream<Item = BytesMut> + Send + 'static>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> DynConnectionHandler for T
|
impl<T: ConnectionHandler> DynConnectionHandler for T {
|
||||||
where
|
|
||||||
T: ConnectionHandler,
|
|
||||||
{
|
|
||||||
fn protocol(&self) -> Protocol {
|
fn protocol(&self) -> Protocol {
|
||||||
T::protocol(self)
|
T::protocol(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_unsupported_by_peer(
|
|
||||||
self,
|
|
||||||
supported: &SharedCapabilities,
|
|
||||||
direction: Direction,
|
|
||||||
peer_id: PeerId,
|
|
||||||
) -> OnNotSupported {
|
|
||||||
T::on_unsupported_by_peer(self, supported, direction, peer_id)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn into_connection(
|
fn into_connection(
|
||||||
self: Box<Self>,
|
self: Box<Self>,
|
||||||
direction: Direction,
|
direction: Direction,
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
//! Additional helpers for converting errors.
|
//! Additional helpers for converting errors.
|
||||||
|
|
||||||
use crate::eth::error::EthApiError;
|
|
||||||
use jsonrpsee::core::RpcResult;
|
use jsonrpsee::core::RpcResult;
|
||||||
use reth_interfaces::RethResult;
|
|
||||||
use reth_primitives::Block;
|
|
||||||
use reth_rpc_types::engine::PayloadError;
|
use reth_rpc_types::engine::PayloadError;
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
||||||
@ -106,27 +103,6 @@ impl_to_rpc_result!(reth_interfaces::RethError);
|
|||||||
impl_to_rpc_result!(reth_interfaces::provider::ProviderError);
|
impl_to_rpc_result!(reth_interfaces::provider::ProviderError);
|
||||||
impl_to_rpc_result!(reth_network_api::NetworkError);
|
impl_to_rpc_result!(reth_network_api::NetworkError);
|
||||||
|
|
||||||
/// An extension to used to apply error conversions to various result types
|
|
||||||
pub(crate) trait ToRpcResultExt {
|
|
||||||
/// The `Ok` variant of the [RpcResult]
|
|
||||||
type Ok;
|
|
||||||
|
|
||||||
/// Maps the `Ok` variant of this type into [Self::Ok] and maps the `Err` variant into rpc
|
|
||||||
/// error.
|
|
||||||
fn map_ok_or_rpc_err(self) -> RpcResult<<Self as ToRpcResultExt>::Ok>;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToRpcResultExt for RethResult<Option<Block>> {
|
|
||||||
type Ok = Block;
|
|
||||||
|
|
||||||
fn map_ok_or_rpc_err(self) -> RpcResult<<Self as ToRpcResultExt>::Ok> {
|
|
||||||
match self {
|
|
||||||
Ok(block) => block.ok_or_else(|| EthApiError::UnknownBlockNumber.into()),
|
|
||||||
Err(err) => Err(internal_rpc_err(err.to_string())),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Constructs an invalid params JSON-RPC error.
|
/// Constructs an invalid params JSON-RPC error.
|
||||||
pub(crate) fn invalid_params_rpc_err(
|
pub(crate) fn invalid_params_rpc_err(
|
||||||
msg: impl Into<String>,
|
msg: impl Into<String>,
|
||||||
@ -176,19 +152,15 @@ pub(crate) fn rpc_err(
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use reth_interfaces::RethError;
|
use reth_interfaces::{RethError, RethResult};
|
||||||
|
|
||||||
fn assert_rpc_result<Ok, Err, T: ToRpcResult<Ok, Err>>() {}
|
fn assert_rpc_result<T, E, TRR: ToRpcResult<T, E>>() {}
|
||||||
|
|
||||||
fn to_reth_err<Ok>(o: Ok) -> RethResult<Ok> {
|
|
||||||
Ok(o)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_convert_rpc() {
|
fn can_convert_rpc() {
|
||||||
assert_rpc_result::<(), RethError, RethResult<()>>();
|
assert_rpc_result::<(), RethError, RethResult<()>>();
|
||||||
let res = to_reth_err(100);
|
|
||||||
|
|
||||||
|
let res = RethResult::Ok(100);
|
||||||
let rpc_res = res.map_internal_err(|_| "This is a message");
|
let rpc_res = res.map_internal_err(|_| "This is a message");
|
||||||
let val = rpc_res.unwrap();
|
let val = rpc_res.unwrap();
|
||||||
assert_eq!(val, 100);
|
assert_eq!(val, 100);
|
||||||
|
|||||||
Reference in New Issue
Block a user