Skip to content

Commit 1b777e2

Browse files
committed
Revert "ci: use cargo hack"
This reverts commit cb0e9b2.
1 parent cb0e9b2 commit 1b777e2

File tree

6 files changed

+30
-47
lines changed

6 files changed

+30
-47
lines changed

.cargo-husky/hooks/pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fi
1414
set -xe
1515

1616
# Setting RUSTFLAGS env for clippy makes it not include custom rules
17-
RUSTFLAGS=-Dwarnings cargo hack check --feature-powerset --no-dev-deps
17+
RUSTFLAGS=-Dwarnings cargo check --workspace --all-targets --profile bench ${ALL_FEATURES}
1818
cargo clippy --all --all-targets ${ALL_FEATURES} -- -D warnings
1919
cargo fmt --all -- --check
2020
cargo test --doc --workspace ${ALL_FEATURES}

.github/workflows/hardhat-core-ci.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,19 @@ jobs:
5353
profile: minimal
5454
override: true
5555

56-
# Install pre-built binaries for cargo hack
57-
- uses: taiki-e/install-action@cargo-hack
58-
5956
- uses: Swatinem/rust-cache@v2
6057

61-
- name: Cargo hack
58+
- name: Cargo check
59+
uses: actions-rs/cargo@v1
60+
with:
61+
command: check
62+
args: --workspace --all-features --all-targets --profile bench
63+
64+
- name: Cargo check without all features
6265
uses: actions-rs/cargo@v1
6366
with:
64-
command: hack
65-
args: check --feature-powerset --no-dev-deps
67+
command: check
68+
args: --workspace --all-targets --no-default-features --profile bench
6669

6770
test-core:
6871
name: Test core (${{ matrix.os }}, Node ${{ matrix.node }}, ${{ matrix.vm }})

Brewfile

-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
tap "taiki-e/tap"
2-
31
# Rust toolchain
42
brew "rustup-init"
5-
# Cargo hack CLI
6-
brew "taiki-e/tap/cargo-hack"
73
# NodeJS version 18
84
brew "node@18"
95
# Yarn package manager for NodeJS

crates/rethnet_eth/src/block.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,21 @@ mod reorg;
1010

1111
use std::sync::OnceLock;
1212

13-
use revm_primitives::{keccak256, ruint::aliases::U160, SpecId, B160};
13+
use revm_primitives::{
14+
keccak256,
15+
ruint::{self, aliases::U160},
16+
SpecId, B160,
17+
};
1418
use rlp::Decodable;
1519

16-
#[cfg(feature = "serde")]
17-
use revm_primitives::ruint;
18-
1920
use crate::{
21+
remote::eth::{self, TransactionConversionError},
2022
transaction::SignedTransaction,
2123
trie::{self, KECCAK_NULL_RLP},
2224
withdrawal::Withdrawal,
2325
Address, Bloom, Bytes, B256, B64, U256,
2426
};
2527

26-
#[cfg(feature = "serde")]
27-
use crate::remote::eth::{self, TransactionConversionError};
28-
2928
use self::difficulty::calculate_ethash_canonical_difficulty;
3029
pub use self::{
3130
detailed::DetailedBlock,
@@ -104,7 +103,6 @@ impl PartialEq for Block {
104103

105104
/// Error that occurs when trying to convert the JSON-RPC `Block` type.
106105
#[derive(Debug, thiserror::Error)]
107-
#[cfg(feature = "serde")]
108106
pub enum BlockConversionError {
109107
/// Missing miner
110108
#[error("Missing miner")]
@@ -120,7 +118,6 @@ pub enum BlockConversionError {
120118
TransactionConversionError(#[from] TransactionConversionError),
121119
}
122120

123-
#[cfg(feature = "serde")]
124121
impl TryFrom<eth::Block<eth::Transaction>> for BlockAndCallers {
125122
type Error = BlockConversionError;
126123

@@ -211,9 +208,9 @@ pub struct Header {
211208
pub withdrawals_root: Option<B256>,
212209
}
213210

211+
#[cfg(feature = "serde")]
214212
#[derive(serde::Serialize, serde::Deserialize)]
215213
#[serde(remote = "B64")]
216-
#[cfg(feature = "serde")]
217214
struct B64Def(#[serde(getter = "B64::as_uint")] ruint::aliases::U64);
218215

219216
#[cfg(feature = "serde")]

crates/rethnet_eth/src/signature.rs

+13-23
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use secp256k1::{
1111
PublicKey, Secp256k1, SecretKey, SignOnly, ThirtyTwoByteHash,
1212
};
1313
use sha3::{Digest, Keccak256};
14+
use thiserror::Error;
1415

1516
use crate::{utils::hash_message, Address, B256, U256};
1617

@@ -51,30 +52,23 @@ fn private_to_public_key(
5152
}
5253

5354
/// An error involving a signature.
54-
#[derive(Debug)]
55-
#[cfg_attr(feature = "std", derive(thiserror::Error))]
55+
#[derive(Debug, Error)]
5656
pub enum SignatureError {
5757
/// Invalid length, secp256k1 signatures are 65 bytes
58-
#[cfg_attr(
59-
feature = "std",
60-
error("invalid signature length, got {0}, expected 65")
61-
)]
58+
#[error("invalid signature length, got {0}, expected 65")]
6259
InvalidLength(usize),
6360
/// When parsing a signature from string to hex
64-
#[cfg_attr(feature = "std", error(transparent))]
65-
DecodingError(#[cfg_attr(feature = "std", from)] hex::FromHexError),
61+
#[error(transparent)]
62+
DecodingError(#[from] hex::FromHexError),
6663
/// Thrown when signature verification failed (i.e. when the address that
6764
/// produced the signature did not match the expected address)
68-
#[cfg_attr(
69-
feature = "std",
70-
error("Signature verification failed. Expected {0}, got {1}")
71-
)]
65+
#[error("Signature verification failed. Expected {0}, got {1}")]
7266
VerificationError(Address, Address),
7367
/// Internal error during signature recovery
74-
#[cfg_attr(feature = "std", error(transparent))]
75-
K256Error(#[cfg_attr(feature = "std", from)] secp256k1::Error),
68+
#[error(transparent)]
69+
K256Error(#[from] secp256k1::Error),
7670
/// Error in recovering public key from signature
77-
#[cfg_attr(feature = "std", error("Public key recovery error"))]
71+
#[error("Public key recovery error")]
7872
RecoveryError,
7973
}
8074

@@ -192,9 +186,7 @@ impl Signature {
192186
let (recoverable_sig, _recovery_id) = self.as_signature()?;
193187

194188
let context = Secp256k1::verification_only();
195-
let public_key = context
196-
.recover_ecdsa(&message_hash.into(), &recoverable_sig)
197-
.map_err(SignatureError::K256Error)?;
189+
let public_key = context.recover_ecdsa(&message_hash.into(), &recoverable_sig)?;
198190

199191
Ok(public_key_to_address(public_key))
200192
}
@@ -210,8 +202,7 @@ impl Signature {
210202
bytes[..32].copy_from_slice(&r_bytes);
211203
bytes[32..64].copy_from_slice(&s_bytes);
212204

213-
RecoverableSignature::from_compact(&bytes, recovery_id)
214-
.map_err(SignatureError::K256Error)?
205+
RecoverableSignature::from_compact(&bytes, recovery_id)?
215206
};
216207

217208
Ok((signature, recovery_id))
@@ -220,7 +211,7 @@ impl Signature {
220211
/// Retrieve the recovery ID.
221212
pub fn recovery_id(&self) -> Result<RecoveryId, SignatureError> {
222213
let standard_v = normalize_recovery_id(self.v);
223-
RecoveryId::from_i32(standard_v).map_err(SignatureError::K256Error)
214+
Ok(RecoveryId::from_i32(standard_v)?)
224215
}
225216

226217
/// Copies and serializes `self` into a new `Vec` with the recovery id included
@@ -292,13 +283,12 @@ impl<'a> TryFrom<&'a [u8]> for Signature {
292283
}
293284
}
294285

295-
#[cfg(feature = "std")]
296286
impl FromStr for Signature {
297287
type Err = SignatureError;
298288

299289
fn from_str(s: &str) -> Result<Self, Self::Err> {
300290
let s = s.strip_prefix("0x").unwrap_or(s);
301-
let bytes = hex::decode(s).map_err(SignatureError::DecodingError)?;
291+
let bytes = hex::decode(s)?;
302292
Signature::try_from(&bytes[..])
303293
}
304294
}

scripts/setup.sh

-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ rust_version=$(<rust-toolchain)
66
# rustup
77
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $rust_version
88

9-
# cargo hack CLI
10-
cargo install cargo-hack
11-
129
sudo apt update
1310

1411
# TODO: nodejs, npm, yarn

0 commit comments

Comments
 (0)