-
Notifications
You must be signed in to change notification settings - Fork 616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: feature flag compiler errors #256
Changes from 1 commit
70d1322
5399bfc
f3243e9
48abe53
3703310
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,7 @@ impl Precompiles { | |
static INSTANCE: OnceCell<Precompiles> = OnceCell::new(); | ||
INSTANCE.get_or_init(|| { | ||
let fun = vec![ | ||
#[cfg(any(feature = "k256_ecrecover", feature = "secp256k1"))] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dont want to disable ECRECOVER if default is not present, it seems like a footgun. As I said here I am fine with build failure: #252 (comment) Having this would make this more user-friendly: https://doc.rust-lang.org/std/macro.compile_error.html Something like
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the above mentioned |
||
secp256k1::ECRECOVER, | ||
hash::SHA256, | ||
hash::RIPEMD160, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
#[cfg(any(feature = "k256_ecrecover", feature = "secp256k1"))] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing feature |
||
use crate::{Error, Precompile, PrecompileAddress, PrecompileResult, StandardPrecompileFn}; | ||
use alloc::vec::Vec; | ||
use core::cmp::min; | ||
|
||
const ECRECOVER_BASE: u64 = 3_000; | ||
|
||
#[cfg(any(feature = "k256_ecrecover", feature = "secp256k1"))] | ||
pub const ECRECOVER: PrecompileAddress = PrecompileAddress( | ||
crate::u64_to_b160(1), | ||
Precompile::Standard(ec_recover_run as StandardPrecompileFn), | ||
|
@@ -59,7 +57,13 @@ mod secp256k1 { | |
} | ||
} | ||
|
||
#[cfg(any(feature = "k256_ecrecover", feature = "secp256k1"))] | ||
fn ec_recover_run(i: &[u8], target_gas: u64) -> PrecompileResult { | ||
use alloc::vec::Vec; | ||
Wodann marked this conversation as resolved.
Show resolved
Hide resolved
|
||
use core::cmp::min; | ||
|
||
const ECRECOVER_BASE: u64 = 3_000; | ||
|
||
if ECRECOVER_BASE > target_gas { | ||
return Err(Error::OutOfGas); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed deprecated feature flag
web3db
, as it will causecargo t --all-features
to fail