Skip to content

Commit 5e25c0f

Browse files
committed
graph, chain, runtime: Remove all references to rust-web3 crate
1 parent f9f6ac4 commit 5e25c0f

File tree

12 files changed

+10
-96
lines changed

12 files changed

+10
-96
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chain/ethereum/src/call_helper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ fn is_parity_revert(data: &str) -> bool {
121121
|| data == XDAI_REVERT
122122
}
123123

124-
/// Checks if the given `web3::Error` corresponds to a Parity / Nethermind style EVM
124+
/// Checks if the given data corresponds to a Parity / Nethermind style EVM
125125
/// revert and, if so, tries to extract a human-readable revert reason. Returns `Some`
126126
/// with the reason when the error is identified as a revert, otherwise `None`.
127127
fn parity_revert_reason(data: &str) -> String {

chain/ethereum/src/trigger.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,6 @@ impl<'a> EthereumTransactionData<'a> {
501501
}
502502

503503
pub fn from(&self) -> &Address {
504-
// unwrap: this is always `Some` for txns that have been mined
505-
// (see https://github.com/tomusdrw/rust-web3/pull/407)
506504
self.tx.inner.signer_ref()
507505
}
508506

graph/Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ parking_lot = "0.12.3"
9494
itertools = "0.14.0"
9595
defer = "0.2"
9696

97-
# Our fork contains patches to make some fields optional for Celo and Fantom compatibility.
98-
# Without the "arbitrary_precision" feature, we get the error `data did not match any variant of untagged enum Response`.
99-
web3 = { git = "https://github.com/graphprotocol/rust-web3", branch = "graph-patches-onto-0.18", features = [
100-
"arbitrary_precision",
101-
"test",
102-
] }
10397
serde_plain = "1.0.2"
10498
csv = "1.3.0"
10599
object_store = { version = "0.12.0", features = ["gcp"] }

graph/src/blockchain/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,6 @@ pub enum IngestorError {
244244
Unknown(#[from] Error),
245245
}
246246

247-
impl From<web3::Error> for IngestorError {
248-
fn from(e: web3::Error) -> Self {
249-
IngestorError::Unknown(anyhow::anyhow!(e))
250-
}
251-
}
252-
253247
/// The `TriggerFilterWrapper` is a higher-level wrapper around the chain-specific `TriggerFilter`,
254248
/// enabling subgraph-based trigger filtering for subgraph datasources. This abstraction is necessary
255249
/// because subgraph filtering operates at a higher level than chain-based filtering. By using this wrapper,

graph/src/cheap_clone.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,4 @@ cheap_clone_is_copy!(
118118
&'static str,
119119
std::time::Duration
120120
);
121-
cheap_clone_is_copy!(web3::types::Address);
122121
cheap_clone_is_copy!(alloy::primitives::Address);

graph/src/components/transaction_receipt.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use alloy::primitives::B256;
77
use alloy::rpc::types::TransactionReceipt;
88

9-
/// Like web3::types::Receipt, but with fewer fields.
109
#[derive(Debug, PartialEq, Eq)]
1110
pub struct LightTransactionReceipt {
1211
pub transaction_hash: B256,

graph/src/data/store/scalar/bytes.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use diesel::pg::PgValue;
33
use diesel::serialize::ToSql;
44
use hex;
55
use serde::{self, Deserialize, Serialize};
6-
use web3::types::*;
76

87
use std::fmt::{self, Display, Formatter};
98
use std::ops::Deref;
@@ -58,18 +57,12 @@ impl<'a> From<&'a [u8]> for Bytes {
5857
}
5958
}
6059

61-
impl From<Address> for Bytes {
62-
fn from(address: Address) -> Bytes {
60+
impl From<alloy::primitives::Address> for Bytes {
61+
fn from(address: alloy::primitives::Address) -> Bytes {
6362
Bytes::from(address.as_ref())
6463
}
6564
}
6665

67-
impl From<web3::types::Bytes> for Bytes {
68-
fn from(bytes: web3::types::Bytes) -> Bytes {
69-
Bytes::from(bytes.0.as_slice())
70-
}
71-
}
72-
7366
impl From<BlockHash> for Bytes {
7467
fn from(hash: BlockHash) -> Self {
7568
Bytes(hash.0)

graph/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ pub mod prelude {
109109
pub use tokio;
110110
pub use toml;
111111
pub use tonic;
112-
pub use web3;
113112

114113
pub type DynTryFuture<'a, Ok = (), Err = Error> =
115114
Pin<Box<dyn futures03::Future<Output = Result<Ok, Err>> + Send + 'a>>;

runtime/wasm/src/to_from/external.rs

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ use graph::data::store::scalar::Timestamp;
44
use graph::data::value::Word;
55
use graph::prelude::{BigDecimal, BigInt};
66
use graph::runtime::gas::GasCounter;
7+
use graph::runtime::AscHeap;
78
use graph::runtime::{
89
asc_get, asc_new, AscIndexId, AscPtr, AscType, AscValue, HostExportError, ToAscObj,
910
};
1011
use graph::{data::store, runtime::DeterministicHostError};
11-
use graph::{prelude::web3::types as web3, runtime::AscHeap};
1212
use graph::{
1313
prelude::{
1414
alloy::{self, primitives::U256},
@@ -20,38 +20,6 @@ use graph_runtime_derive::AscType;
2020

2121
use crate::asc_abi::class::*;
2222

23-
impl ToAscObj<Uint8Array> for web3::H160 {
24-
fn to_asc_obj<H: AscHeap + ?Sized>(
25-
&self,
26-
heap: &mut H,
27-
gas: &GasCounter,
28-
) -> Result<Uint8Array, HostExportError> {
29-
self.0.to_asc_obj(heap, gas)
30-
}
31-
}
32-
33-
impl ToAscObj<Uint8Array> for web3::Bytes {
34-
fn to_asc_obj<H: AscHeap + ?Sized>(
35-
&self,
36-
heap: &mut H,
37-
gas: &GasCounter,
38-
) -> Result<Uint8Array, HostExportError> {
39-
self.0.to_asc_obj(heap, gas)
40-
}
41-
}
42-
43-
impl FromAscObj<Uint8Array> for web3::H160 {
44-
fn from_asc_obj<H: AscHeap + ?Sized>(
45-
typed_array: Uint8Array,
46-
heap: &H,
47-
gas: &GasCounter,
48-
depth: usize,
49-
) -> Result<Self, DeterministicHostError> {
50-
let data = <[u8; 20]>::from_asc_obj(typed_array, heap, gas, depth)?;
51-
Ok(Self(data))
52-
}
53-
}
54-
5523
impl FromAscObj<Uint8Array> for alloy::primitives::Address {
5624
fn from_asc_obj<H: AscHeap + ?Sized>(
5725
typed_array: Uint8Array,
@@ -96,40 +64,6 @@ impl FromAscObj<Uint8Array> for alloy::primitives::B256 {
9664
}
9765
}
9866

99-
// impl FromAscObj<Uint8Array> for web3::H256 {
100-
// fn from_asc_obj<H: AscHeap + ?Sized>(
101-
// typed_array: Uint8Array,
102-
// heap: &H,
103-
// gas: &GasCounter,
104-
// depth: usize,
105-
// ) -> Result<Self, DeterministicHostError> {
106-
// let data = <[u8; 32]>::from_asc_obj(typed_array, heap, gas, depth)?;
107-
// Ok(Self(data))
108-
// }
109-
// }
110-
111-
// impl ToAscObj<Uint8Array> for web3::H256 {
112-
// fn to_asc_obj<H: AscHeap + ?Sized>(
113-
// &self,
114-
// heap: &mut H,
115-
// gas: &GasCounter,
116-
// ) -> Result<Uint8Array, HostExportError> {
117-
// self.0.to_asc_obj(heap, gas)
118-
// }
119-
// }
120-
121-
impl ToAscObj<AscBigInt> for web3::U128 {
122-
fn to_asc_obj<H: AscHeap + ?Sized>(
123-
&self,
124-
heap: &mut H,
125-
gas: &GasCounter,
126-
) -> Result<AscBigInt, HostExportError> {
127-
let mut bytes: [u8; 16] = [0; 16];
128-
self.to_little_endian(&mut bytes);
129-
bytes.to_asc_obj(heap, gas)
130-
}
131-
}
132-
13367
impl ToAscObj<AscBigInt> for BigInt {
13468
fn to_asc_obj<H: AscHeap + ?Sized>(
13569
&self,

0 commit comments

Comments
 (0)