mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 04:39:24 +00:00
alloy-core 1.0, alloy 0.14, revm 0.22 (001)
This moves to Rust 1.86 as were prior on Rust 1.81, and the new alloy dependencies require 1.82. The revm API changes were notable for us. Instead of relying on a modified call instruction (with deep introspection into the EVM design), we now use the more recent and now more prominent Inspector API. This: 1) Lets us perform far less introspection 2) Forces us to rewrite the gas estimation code we just had audited Thankfully, it itself should be much easier to read/review, and our existing test suite has extensively validated it. This resolves 001 which was a concern for if/when this upgrade occurs. By doing it now, with a dedicated test case ensuring the issue we would have had with alloy-core 0.8 and `validate=false` isn't actively an issue, we resolve it.
This commit is contained in:
@@ -4,7 +4,6 @@ use std::sync::Arc;
|
||||
use alloy_rlp::Encodable;
|
||||
|
||||
use alloy_transport::{TransportErrorKind, RpcError};
|
||||
use alloy_simple_request_transport::SimpleRequest;
|
||||
use alloy_provider::RootProvider;
|
||||
|
||||
use tokio::{
|
||||
@@ -26,13 +25,13 @@ use crate::{
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct TransactionPublisher<D: Db> {
|
||||
db: D,
|
||||
rpc: Arc<RootProvider<SimpleRequest>>,
|
||||
rpc: Arc<RootProvider>,
|
||||
router: Arc<RwLock<Option<Router>>>,
|
||||
relayer_url: String,
|
||||
}
|
||||
|
||||
impl<D: Db> TransactionPublisher<D> {
|
||||
pub(crate) fn new(db: D, rpc: Arc<RootProvider<SimpleRequest>>, relayer_url: String) -> Self {
|
||||
pub(crate) fn new(db: D, rpc: Arc<RootProvider>, relayer_url: String) -> Self {
|
||||
Self { db, rpc, router: Arc::new(RwLock::new(None)), relayer_url }
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,8 @@ use core::future::Future;
|
||||
use std::{sync::Arc, collections::HashSet};
|
||||
|
||||
use alloy_core::primitives::B256;
|
||||
use alloy_rpc_types_eth::{Header, BlockTransactionsKind, BlockNumberOrTag};
|
||||
use alloy_rpc_types_eth::{Header, BlockNumberOrTag};
|
||||
use alloy_transport::{RpcError, TransportErrorKind};
|
||||
use alloy_simple_request_transport::SimpleRequest;
|
||||
use alloy_provider::{Provider, RootProvider};
|
||||
|
||||
use serai_client::primitives::{ExternalNetworkId, ExternalCoin, Amount};
|
||||
@@ -26,7 +25,7 @@ use crate::{
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct Rpc<D: Db> {
|
||||
pub(crate) db: D,
|
||||
pub(crate) provider: Arc<RootProvider<SimpleRequest>>,
|
||||
pub(crate) provider: Arc<RootProvider>,
|
||||
}
|
||||
|
||||
impl<D: Db> ScannerFeed for Rpc<D> {
|
||||
@@ -49,7 +48,7 @@ impl<D: Db> ScannerFeed for Rpc<D> {
|
||||
async move {
|
||||
let actual_number = self
|
||||
.provider
|
||||
.get_block(BlockNumberOrTag::Finalized.into(), BlockTransactionsKind::Hashes)
|
||||
.get_block(BlockNumberOrTag::Finalized.into())
|
||||
.await?
|
||||
.ok_or_else(|| {
|
||||
TransportErrorKind::Custom("there was no finalized block".to_string().into())
|
||||
@@ -77,7 +76,7 @@ impl<D: Db> ScannerFeed for Rpc<D> {
|
||||
async move {
|
||||
let header = self
|
||||
.provider
|
||||
.get_block(BlockNumberOrTag::Number(number).into(), BlockTransactionsKind::Hashes)
|
||||
.get_block(BlockNumberOrTag::Number(number).into())
|
||||
.await?
|
||||
.ok_or_else(|| {
|
||||
TransportErrorKind::Custom(
|
||||
@@ -105,7 +104,7 @@ impl<D: Db> ScannerFeed for Rpc<D> {
|
||||
} else {
|
||||
self
|
||||
.provider
|
||||
.get_block((start - 1).into(), BlockTransactionsKind::Hashes)
|
||||
.get_block((start - 1).into())
|
||||
.await?
|
||||
.ok_or_else(|| {
|
||||
TransportErrorKind::Custom(
|
||||
@@ -120,7 +119,7 @@ impl<D: Db> ScannerFeed for Rpc<D> {
|
||||
|
||||
let end_header = self
|
||||
.provider
|
||||
.get_block((start + 31).into(), BlockTransactionsKind::Hashes)
|
||||
.get_block((start + 31).into())
|
||||
.await?
|
||||
.ok_or_else(|| {
|
||||
TransportErrorKind::Custom(
|
||||
@@ -177,7 +176,7 @@ impl<D: Db> ScannerFeed for Rpc<D> {
|
||||
while to_check != epoch.prior_end_hash {
|
||||
let to_check_block = self
|
||||
.provider
|
||||
.get_block(B256::from(to_check).into(), BlockTransactionsKind::Hashes)
|
||||
.get_block(B256::from(to_check).into())
|
||||
.await?
|
||||
.ok_or_else(|| {
|
||||
TransportErrorKind::Custom(
|
||||
|
||||
Reference in New Issue
Block a user