Skip to content

Commit

Permalink
refactor(eth-client): Remove JSON-RPC signer (#1883)
Browse files Browse the repository at this point in the history
## What ❔

Removes JSON-RPC signer from the codebase.

## Why ❔

It's unused and brings an obsolete dependency (`jsonrpc-core`).

## Checklist

- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [x] Code has been formatted via `zk fmt` and `zk lint`.
- [x] Spellcheck has been run via `zk spellcheck`.
  • Loading branch information
slowli authored May 9, 2024
1 parent c22ce63 commit f3ca032
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 509 deletions.
22 changes: 0 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ http = "0.2.9"
iai = "0.1"
insta = "1.29.0"
itertools = "0.10"
jsonrpc-core = "18"
jsonrpsee = { version = "0.21.0", default-features = false }
lazy_static = "1.4"
leb128 = "0.2.5"
Expand Down
2 changes: 1 addition & 1 deletion core/lib/eth_client/src/clients/http/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{fmt, sync::Arc};

use async_trait::async_trait;
use zksync_contracts::hyperchain_contract;
use zksync_eth_signer::{raw_ethereum_tx::TransactionParameters, EthereumSigner, PrivateKeySigner};
use zksync_eth_signer::{EthereumSigner, PrivateKeySigner, TransactionParameters};
use zksync_types::{
ethabi, web3, Address, K256PrivateKey, L1ChainId, EIP_4844_TX_TYPE, H160, U256,
};
Expand Down
2 changes: 1 addition & 1 deletion core/lib/eth_client/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pub enum Error {
Contract(#[from] ContractError),
/// Problem with transaction signer.
#[error("Transaction signing failed: {0}")]
Signer(#[from] zksync_eth_signer::error::SignerError),
Signer(#[from] zksync_eth_signer::SignerError),
/// Incorrect fee provided for a transaction.
#[error("Max fee {0} less than priority fee {1}")]
WrongFeeProvided(U256, U256),
Expand Down
7 changes: 0 additions & 7 deletions core/lib/eth_signer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,9 @@ categories.workspace = true

[dependencies]
zksync_types.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
hex.workspace = true
rlp.workspace = true
reqwest = { workspace = true, features = ["json", "blocking"] }
thiserror.workspace = true
jsonrpc-core.workspace = true
async-trait.workspace = true

[dev-dependencies]
tokio = { workspace = true, features = ["full"] }
axum.workspace = true
futures.workspace = true
33 changes: 0 additions & 33 deletions core/lib/eth_signer/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1 @@
pub use jsonrpc_core::types::response::Failure as RpcFailure;
use thiserror::Error;

#[derive(Debug, Error, PartialEq)]
pub enum RpcSignerError {
#[error("Unable to decode server response")]
MalformedResponse(String),
#[error("RPC error: {0:?}")]
RpcError(RpcFailure),
#[error("Network error: {0}")]
NetworkError(String),
}

#[derive(Debug, Error, PartialEq, Eq)]
pub enum SignerError {
#[error("Ethereum private key required to perform an operation")]
MissingEthPrivateKey,
#[error("EthereumSigner required to perform an operation")]
MissingEthSigner,
#[error("Signing failed: {0}")]
SigningFailed(String),
#[error("Unlocking failed: {0}")]
UnlockingFailed(String),
#[error("Decode raw transaction failed: {0}")]
DecodeRawTxFailed(String),
#[error("Signing key is not set in account")]
NoSigningKey,
#[error("Address determination error")]
DefineAddress,
#[error("Recover address from signature failed: {0}")]
RecoverAddress(String),
#[error("{0}")]
CustomError(String),
}
Loading

0 comments on commit f3ca032

Please sign in to comment.