Skip to content

Commit

Permalink
Update web3
Browse files Browse the repository at this point in the history
Signed-off-by: deniallugo <[email protected]>
  • Loading branch information
Deniallugo committed Mar 30, 2022
1 parent 0e01669 commit 4d42e4d
Show file tree
Hide file tree
Showing 27 changed files with 248 additions and 80 deletions.
236 changes: 193 additions & 43 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions core/bin/block_revert/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ zksync_eth_client = { path = "../../lib/eth_client", version = "1.0" }
zksync_config = { path = "../../lib/config", version = "1.0" }

tokio = { version = "1", features = ["full"] }
ethabi = "14.0.0"
ethabi = "16.0.0"
anyhow = "1.0"
web3 = "0.16.0"
web3 = "0.18.0"
structopt = "0.3.20"
6 changes: 3 additions & 3 deletions core/bin/data_restore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ vlog = { path = "../../lib/vlog", version = "1.0" }

num = { version = "0.3.1", features = ["serde"] }
tiny-keccak = "1.4.2"
ethabi = "14.0.0"
web3 = "0.16.0"
ethabi = "16.0.0"
web3 = "0.18.0"
hex = "0.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.0"
Expand All @@ -38,6 +38,6 @@ zksync_config = { path = "../../lib/config", version = "1.0" }
zksync_contracts = { path = "../../lib/contracts", version = "1.0" }

[dev-dependencies]
jsonrpc-core = "17.0.0"
jsonrpc-core = "18.0.0"
db_test_macro = { path = "../../lib/storage/db_test_macro" }
futures = "0.3.5"
8 changes: 6 additions & 2 deletions core/bin/data_restore/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ fn create_transaction_v4(number: u32, stored_block: Block, blocks: Vec<Block>) -
from: Some([5u8; 20].into()),
to: Some([7u8; 20].into()),
value: u32_to_32bytes(10).into(),
gas_price: u32_to_32bytes(1).into(),
gas_price: Some(u32_to_32bytes(1).into()),
gas: u32_to_32bytes(1).into(),
input: Bytes(input_data),
v: None,
Expand All @@ -146,6 +146,8 @@ fn create_transaction_v4(number: u32, stored_block: Block, blocks: Vec<Block>) -
raw: None,
transaction_type: None,
access_list: None,
max_fee_per_gas: None,
max_priority_fee_per_gas: None,
}
}
fn create_transaction(number: u32, block: Block) -> Transaction {
Expand Down Expand Up @@ -175,7 +177,7 @@ fn create_transaction(number: u32, block: Block) -> Transaction {
from: Some([5u8; 20].into()),
to: Some([7u8; 20].into()),
value: u32_to_32bytes(10).into(),
gas_price: u32_to_32bytes(1).into(),
gas_price: Some(u32_to_32bytes(1).into()),
gas: u32_to_32bytes(1).into(),
input: Bytes(input_data),
v: None,
Expand All @@ -184,6 +186,8 @@ fn create_transaction(number: u32, block: Block) -> Transaction {
raw: None,
transaction_type: None,
access_list: None,
max_fee_per_gas: None,
max_priority_fee_per_gas: None,
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/bin/prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ zksync_prometheus_exporter = { path = "../../lib/prometheus_exporter", version =

hex = "0.4"
rust-crypto = "0.2"
web3 = "0.16.0"
web3 = "0.18.0"
tokio = { version = "1", features = ["full"] }
async-trait = "0.1"
futures = "0.3"
Expand Down
4 changes: 2 additions & 2 deletions core/bin/remove_proofs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ zksync_eth_client = { path = "../../lib/eth_client", version = "1.0" }
zksync_config = { path = "../../lib/config", version = "1.0" }

tokio = { version = "1", features = ["full"] }
ethabi = "14.0.0"
ethabi = "16.0.0"
anyhow = "1.0"
web3 = "0.16.0"
web3 = "0.18.0"
structopt = "0.3.20"
4 changes: 2 additions & 2 deletions core/bin/zksync_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ zksync_gateway_watcher = { path = "../../lib/gateway_watcher", version = "1.0" }
vlog = { path = "../../lib/vlog", version = "1.0" }

hex = "0.4"
ethabi = "14.0.0"
web3 = "0.16.0"
ethabi = "16.0.0"
web3 = "0.18.0"
serde = "1.0.90"
serde_json = "1.0.0"
serde_repr = "0.1"
Expand Down
4 changes: 3 additions & 1 deletion core/bin/zksync_api/src/api_server/web3/converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub fn transaction_from_tx_data(tx: TxData) -> Transaction {
from: Some(tx.from),
to: tx.to,
value: 0.into(),
gas_price: 0.into(),
gas_price: Some(0.into()),
gas: 0.into(),
input: Vec::new().into(),
v: None,
Expand All @@ -87,6 +87,8 @@ pub fn transaction_from_tx_data(tx: TxData) -> Transaction {
raw: None,
transaction_type: None,
access_list: None,
max_fee_per_gas: None,
max_priority_fee_per_gas: None,
}
}

Expand Down
4 changes: 4 additions & 0 deletions core/bin/zksync_api/src/api_server/web3/rpc_impl.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Built-in uses
use ethabi::Address;
use std::time::Instant;
// External uses
use jsonrpc_core::{Error, Result};
Expand Down Expand Up @@ -355,6 +356,8 @@ impl Web3RpcApp {
transaction_index: receipt.block_index.map(Into::into).unwrap_or(U64::MAX),
block_hash: Some(root_hash),
block_number: Some(receipt.block_number.into()),
from: Address::from_slice(&receipt.from_account),
to: receipt.to_account.map(|acc| Address::from_slice(&acc)),
cumulative_gas_used: 0.into(),
gas_used: Some(0.into()),
contract_address: None,
Expand All @@ -363,6 +366,7 @@ impl Web3RpcApp {
root: Some(root_hash),
logs_bloom: H2048::zero(),
transaction_type: None,
effective_gas_price: None,
})
}

Expand Down
1 change: 1 addition & 0 deletions core/bin/zksync_api/src/api_server/web3/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ impl BlockInfo {
number: Some(block_number.0.into()),
gas_used: 0.into(),
gas_limit: 50000.into(),
base_fee_per_gas: None,
extra_data: Vec::new().into(),
logs_bloom: None,
timestamp: timestamp.into(),
Expand Down
4 changes: 2 additions & 2 deletions core/bin/zksync_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ zksync_gateway_watcher = { path = "../../lib/gateway_watcher", version = "1.0" }

num = { version = "0.3.1", features = ["serde"] }

ethabi = "14.0.0"
web3 = "0.16.0"
ethabi = "16.0.0"
web3 = "0.18.0"
serde = "1.0.90"
serde_json = "1.0.0"
metrics = "0.17"
Expand Down
4 changes: 2 additions & 2 deletions core/bin/zksync_eth_sender/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ zksync_prometheus_exporter = { path = "../../lib/prometheus_exporter", version =
zksync_gateway_watcher = { path = "../../lib/gateway_watcher", version = "1.0" }

hex = "0.4"
ethabi = "14.0.0"
web3 = "0.16.0"
ethabi = "16.0.0"
web3 = "0.18.0"
serde = "1.0.90"
serde_json = "1.0.0"
metrics = "0.17"
Expand Down
2 changes: 2 additions & 0 deletions core/bin/zksync_eth_sender/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,8 @@ impl<DB: DatabaseInterface> ETHSender<DB> {
nonce: Some(op.nonce),
gas_price: Some(op.last_used_gas_price),
gas: Some(gas_limit),
max_fee_per_gas: None,
max_priority_fee_per_gas: None,
..Default::default()
}
};
Expand Down
4 changes: 2 additions & 2 deletions core/bin/zksync_forced_exit_requests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ vlog = { path = "../../lib/vlog", version = "1.0" }
zksync_core = { path = "../zksync_core", version = "1.0" }
zksync_api = { path = "../zksync_api", version = "1.0" }
actix-web = "4.0.0-beta.8"
ethabi = "14.0.0"
web3 = "0.16.0"
ethabi = "16.0.0"
web3 = "0.18.0"
log = "0.4"
hex = "0.4"
metrics = "0.17"
Expand Down
2 changes: 1 addition & 1 deletion core/lib/basic_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ keywords = ["blockchain", "zksync"]
categories = ["cryptography"]

[dependencies]
web3 = "0.16.0"
web3 = "0.18.0"
serde = { version = "1.0", features = ["derive"] }
2 changes: 1 addition & 1 deletion core/lib/contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ keywords = ["blockchain", "zksync"]
categories = ["cryptography"]

[dependencies]
ethabi = "14.0.0"
ethabi = "16.0.0"
serde_json = "1.0"
2 changes: 1 addition & 1 deletion core/lib/crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ rescue_poseidon = { package = "rescue_poseidon", version = "0.3.0", git = "https

num = { version = "0.3.1", features = ["serde"] }
zksync_basic_types = { path = "../basic_types", version = "1.0" }
ethabi = "14.0.0"
ethabi = "16.0.0"

serde = "1.0"
thiserror = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions core/lib/eth_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ zksync_contracts = { path = "../contracts", version = "1.0" }
vlog = { path = "../../lib/vlog", version = "1.0" }

serde = "1.0.90"
ethabi = "14.0.0"
web3 = "0.16.0"
ethabi = "16.0.0"
web3 = "0.18.0"
parity-crypto = {version = "0.8", features = ["publickey"] }
hex = "0.4"

Expand Down
4 changes: 3 additions & 1 deletion core/lib/eth_client/src/clients/http_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,13 @@ impl<S: EthereumSigner> ETHDirectClient<S> {
from: transaction.from,
to: transaction.to,
gas: Some(transaction.gas),
gas_price: Some(transaction.gas_price),
gas_price: transaction.gas_price,
value: Some(transaction.value),
data: Some(transaction.input),
transaction_type: None,
access_list: None,
max_fee_per_gas: None,
max_priority_fee_per_gas: None,
};

let encoded_revert_reason = self
Expand Down
2 changes: 1 addition & 1 deletion core/lib/eth_signer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ serde_derive = "1.0.90"
serde_json = "1.0.0"
hex = "0.4.2"

parity-crypto = {version = "0.8", features = ["publickey"] }
parity-crypto = {version = "0.9", features = ["publickey"] }
rlp = "0.5.0"

reqwest = { version = "0.11", features = ["json", "blocking"] }
Expand Down
2 changes: 1 addition & 1 deletion core/lib/gateway_watcher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ zksync_utils = { path = "../../lib/utils", version = "1.0" }
thiserror = "1.0"
futures = "0.3"
vlog = { path = "../../lib/vlog", version = "1.0" }
web3 = "0.16.0"
web3 = "0.18.0"
tokio = { version = "1", features = ["time", "rt-multi-thread"] }
tokio-stream = "0.1"
metrics = "0.17"
2 changes: 1 addition & 1 deletion core/lib/state/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ serde_json = "1.0"

[dev-dependencies]
criterion = "0.3.0"
web3 = "0.16.0"
web3 = "0.18.0"

[[bench]]
name = "criterion"
Expand Down
2 changes: 1 addition & 1 deletion core/lib/storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ once_cell = "1.4"
itertools = "0.9"
hex = "0.4"
metrics = "0.17"
parity-crypto = { version = "0.8", features = ["publickey"] }
parity-crypto = { version = "0.9", features = ["publickey"] }

vlog = { path = "../../lib/vlog", version = "1.0" }

Expand Down
6 changes: 3 additions & 3 deletions core/lib/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ serde_json = "1.0.0"
serde_with = "1.8.0"

# Crypto stuff
parity-crypto = { version = "0.8", features = ["publickey"] }
ethabi = "14.0.0"
parity-crypto = { version = "0.9", features = ["publickey"] }
ethabi = "16.0.0"

[dev-dependencies]
criterion = "0.3.0"
web3 = "0.16.0"
web3 = "0.18.0"
secp256k1 = { version = "0.20", features = ["std", "recovery"] }

[[bench]]
Expand Down
4 changes: 2 additions & 2 deletions core/tests/testkit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ tokio = { version = "1", features = ["full"] }
vlog = { path = "../../lib/vlog", version = "1.0" }
num = { version = "0.3.1", features = ["serde"] }
futures = "0.3"
ethabi = "14.0.0"
web3 = "0.16.0"
ethabi = "16.0.0"
web3 = "0.18.0"
anyhow = "1.0"
serde = "1.0.90"
serde_json = "1.0.0"
Expand Down
5 changes: 4 additions & 1 deletion core/tests/testkit/src/eth_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,5 +593,8 @@ pub async fn get_executed_tx_fee(
.await?
.ok_or_else(|| format_err!("Transaction not found: 0x{:x?}", receipt.transaction_hash))?;

Ok((gas_used * tx.gas_price).to_string().parse().unwrap())
Ok((gas_used * tx.gas_price.unwrap())
.to_string()
.parse()
.unwrap())
}
4 changes: 2 additions & 2 deletions sdk/zksync-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ zksync_crypto = { path = "../../core/lib/crypto", version = "1.0" }
zksync_utils = { path = "../../core/lib/utils", version = "1.0" }

sha2 = "0.8"
web3 = "0.16.0"
ethabi = "14.0.0"
web3 = "0.18.0"
ethabi = "16.0.0"
tokio = { version = "1", features = ["time"] }

serde = { version = "1.0", features = ["derive"] }
Expand Down

0 comments on commit 4d42e4d

Please sign in to comment.