Skip to content

Commit 688fb8e

Browse files
leoyvenslutter
authored andcommitted
ethereum: Rebase web3, use upstream ethabi
This is a rebase of #2362
1 parent 590df45 commit 688fb8e

File tree

18 files changed

+714
-740
lines changed

18 files changed

+714
-740
lines changed

Cargo.lock

Lines changed: 344 additions & 424 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chain/ethereum/Cargo.toml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ edition = "2018"
66
[dependencies]
77
chrono = "0.4"
88
futures = "0.1.21"
9-
http = "0.1.21" # must be compatible with the version rust-web3 uses
10-
jsonrpc-core = "14.2.0"
9+
http = "0.2.4"
10+
jsonrpc-core = "17.0.0"
1111
graph = { path = "../../graph" }
1212
lazy_static = "1.2.0"
1313
mockall = "0.9.1"
@@ -21,15 +21,6 @@ tiny-keccak = "1.5.0"
2121
hex = "0.4.3"
2222
semver = "1.0.3"
2323

24-
# master contains changes such as
25-
# https://github.com/paritytech/ethabi/pull/140, which upstream does not want
26-
# and we should try to implement on top of ethabi instead of inside it, and
27-
# tuple support which isn't upstreamed yet. For now, we shall deviate from
28-
# ethabi, but long term we want to find a way to drop our fork.
29-
ethabi = { git = "https://github.com/graphprotocol/ethabi.git", branch = "master" }
30-
31-
# We have a couple custom patches to web3.
32-
web3 = { git = "https://github.com/graphprotocol/rust-web3", branch = "master" }
3324
itertools = "0.10.0"
3425

3526
graph-runtime-wasm = { path = "../../runtime/wasm" }

chain/ethereum/src/adapter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,8 +672,8 @@ mod tests {
672672
use super::EthereumCallFilter;
673673

674674
use graph::prelude::web3::types::Address;
675+
use graph::prelude::web3::types::Bytes;
675676
use graph::prelude::EthereumCall;
676-
use web3::types::Bytes;
677677

678678
use std::collections::{HashMap, HashSet};
679679
use std::iter::FromIterator;

chain/ethereum/src/codec.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
mod pbcodec;
33

44
use graph::prelude::{
5-
web3::types::TransactionReceipt as w3TransactionReceipt, EthereumBlock, EthereumBlockWithCalls,
6-
EthereumCall, LightEthereumBlock,
5+
web3,
6+
web3::types::TransactionReceipt as w3TransactionReceipt,
7+
web3::types::{Bytes, H160, H2048, H256, H64, U256, U64},
8+
EthereumBlock, EthereumBlockWithCalls, EthereumCall, LightEthereumBlock,
79
};
810
use std::sync::Arc;
9-
use web3::types::{Bytes, H160, H2048, H256, H64, U256, U64};
1011

1112
use crate::chain::BlockFinality;
1213

@@ -156,7 +157,7 @@ impl<'a> Into<web3::types::Transaction> for TransactionTraceAt<'a> {
156157
block_hash: Some(H256::from_slice(&self.block.hash)),
157158
block_number: Some(U64::from(self.block.number)),
158159
transaction_index: Some(U64::from(self.trace.index as u64)),
159-
from: H160::from_slice(&self.trace.from),
160+
from: Some(H160::from_slice(&self.trace.from)),
160161
to: Some(H160::from_slice(&self.trace.to)),
161162
value: self
162163
.trace
@@ -170,6 +171,10 @@ impl<'a> Into<web3::types::Transaction> for TransactionTraceAt<'a> {
170171
.map_or_else(|| U256::from(0), |x| x.into()),
171172
gas: U256::from(self.trace.gas_used),
172173
input: Bytes::from(self.trace.input.clone()),
174+
v: None,
175+
r: None,
176+
s: None,
177+
raw: None,
173178
}
174179
}
175180
}

chain/ethereum/src/data_source.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use anyhow::{anyhow, Error};
22
use anyhow::{ensure, Context};
3-
use ethabi::{Address, Contract, Event, Function, LogParam, ParamType, RawLog};
43
use graph::blockchain::TriggerWithHandler;
54
use graph::components::store::StoredDynamicDataSource;
5+
use graph::prelude::ethabi::StateMutability;
66
use graph::prelude::futures03::future::try_join;
77
use graph::prelude::futures03::stream::FuturesOrdered;
88
use graph::prelude::{Entity, Link, SubgraphManifestValidationError};
@@ -11,14 +11,16 @@ use std::collections::BTreeMap;
1111
use std::str::FromStr;
1212
use std::{convert::TryFrom, sync::Arc};
1313
use tiny_keccak::{keccak256, Keccak};
14-
use web3::types::{Log, Transaction, H256};
1514

1615
use graph::{
1716
blockchain::{self, Blockchain},
1817
prelude::{
19-
async_trait, info, serde_json, BlockNumber, CheapClone, DataSourceTemplateInfo,
20-
Deserialize, EthereumCall, LightEthereumBlock, LightEthereumBlockExt, LinkResolver, Logger,
21-
TryStreamExt,
18+
async_trait,
19+
ethabi::{Address, Contract, Event, Function, LogParam, ParamType, RawLog},
20+
info, serde_json,
21+
web3::types::{Log, Transaction, H256},
22+
BlockNumber, CheapClone, DataSourceTemplateInfo, Deserialize, EthereumCall,
23+
LightEthereumBlock, LightEthereumBlockExt, LinkResolver, Logger, TryStreamExt,
2224
},
2325
};
2426

@@ -399,8 +401,8 @@ impl DataSource {
399401
.contract
400402
.functions()
401403
.filter(|function| match function.state_mutability {
402-
ethabi::StateMutability::Payable | ethabi::StateMutability::NonPayable => true,
403-
ethabi::StateMutability::Pure | ethabi::StateMutability::View => false,
404+
StateMutability::Payable | StateMutability::NonPayable => true,
405+
StateMutability::Pure | StateMutability::View => false,
404406
})
405407
.find(|function| {
406408
// Construct the argument function signature:

0 commit comments

Comments
 (0)