-
Notifications
You must be signed in to change notification settings - Fork 1.7k
complete null-signatures removal #11491
Changes from 2 commits
be03019
eefd451
9dea5a1
dd4bbf3
2c147db
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 |
---|---|---|
|
@@ -419,25 +419,6 @@ mod tests { | |
} | ||
} | ||
|
||
#[test] | ||
fn should_disallow_unsigned_transactions() { | ||
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 think we should keep the test. I guess the failure is going to be at a dfiferent level now, but still. 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. 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. or did you mean something else? 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. Well, I just think it's worth to keep the test in it's current form, as it's covering a bit more than constructor of 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. This test was added in #8802 and it doesn't make sense anymore. I removed it because it actually fails on this branch, since it creates a null-signed 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. The conversion happens within 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. The conversion happens in the verification queue when we convert Added dd4bbf3, let me know what you think. |
||
let rlp = "ea80843b9aca0083015f90948921ebb5f79e9e3920abe571004d0b1d5119c154865af3107a400080038080"; | ||
let transaction: UnverifiedTransaction = ::rlp::decode(&::rustc_hex::FromHex::from_hex(rlp).unwrap()).unwrap(); | ||
let spec = spec::new_ropsten_test(); | ||
let ethparams = get_default_ethash_extensions(); | ||
|
||
let machine = Machine::with_ethash_extensions( | ||
spec.params().clone(), | ||
Default::default(), | ||
ethparams, | ||
); | ||
let mut header = Header::new(); | ||
header.set_number(15); | ||
|
||
let res = machine.verify_transaction_basic(&transaction, &header); | ||
assert_eq!(res, Err(transaction::Error::InvalidSignature("invalid EC signature".into()))); | ||
} | ||
|
||
#[test] | ||
fn ethash_gas_limit_is_multiple_of_determinant() { | ||
use ethereum_types::U256; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -316,11 +316,6 @@ impl UnverifiedTransaction { | |
self | ||
} | ||
|
||
/// Checks if the signature is empty. | ||
pub fn is_unsigned(&self) -> bool { | ||
self.r.is_zero() && self.s.is_zero() | ||
} | ||
|
||
/// Returns transaction receiver, if any | ||
pub fn receiver(&self) -> Option<Address> { | ||
match self.unsigned.action { | ||
|
@@ -357,7 +352,6 @@ impl UnverifiedTransaction { | |
/// The chain ID, or `None` if this is a global transaction. | ||
pub fn chain_id(&self) -> Option<u64> { | ||
match self.v { | ||
v if self.is_unsigned() => Some(v), | ||
v if v >= 35 => Some((v - 35) / 2), | ||
_ => None, | ||
} | ||
|
@@ -391,9 +385,6 @@ impl UnverifiedTransaction { | |
|
||
/// Verify basic signature params. Does not attempt sender recovery. | ||
pub fn verify_basic(&self, check_low_s: bool, chain_id: Option<u64>) -> Result<(), error::Error> { | ||
if self.is_unsigned() { | ||
return Err(parity_crypto::publickey::Error::InvalidSignature.into()); | ||
} | ||
if check_low_s { | ||
self.check_low_s()?; | ||
} | ||
|
@@ -439,9 +430,6 @@ impl From<SignedTransaction> for UnverifiedTransaction { | |
impl SignedTransaction { | ||
/// Try to verify transaction and recover sender. | ||
pub fn new(transaction: UnverifiedTransaction) -> Result<Self, parity_crypto::publickey::Error> { | ||
if transaction.is_unsigned() { | ||
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. the aforementioned type safety is here, |
||
return Err(parity_crypto::publickey::Error::InvalidSignature); | ||
} | ||
let public = transaction.recover_public()?; | ||
let sender = public_to_address(&public); | ||
Ok(SignedTransaction { | ||
|
@@ -461,11 +449,6 @@ impl SignedTransaction { | |
self.public | ||
} | ||
|
||
/// Checks is signature is empty. | ||
pub fn is_unsigned(&self) -> bool { | ||
self.transaction.is_unsigned() | ||
} | ||
|
||
/// Deconstructs this transaction back into `UnverifiedTransaction` | ||
pub fn deconstruct(self) -> (UnverifiedTransaction, Address, Option<Public>) { | ||
(self.transaction, self.sender, self.public) | ||
|
@@ -494,9 +477,6 @@ impl LocalizedTransaction { | |
if let Some(sender) = self.cached_sender { | ||
return sender; | ||
} | ||
if self.is_unsigned() { | ||
return UNSIGNED_SENDER.clone(); | ||
} | ||
let sender = public_to_address(&self.recover_public() | ||
.expect("LocalizedTransaction is always constructed from transaction from blockchain; Blockchain only stores verified transactions; qed")); | ||
self.cached_sender = Some(sender); | ||
|
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.
changed to a warning