Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

complete null-signatures removal#11491

Merged
ordian merged 5 commits into
masterfrom
ao-finish-cleanup-of-null-signatures-removal
Feb 15, 2020
Merged

complete null-signatures removal#11491
ordian merged 5 commits into
masterfrom
ao-finish-cleanup-of-null-signatures-removal

Conversation

@ordian
Copy link
Copy Markdown
Member

@ordian ordian commented Feb 14, 2020

Closes #11339.

@ordian ordian added A2-insubstantial 👶 Pull request requires no code review (e.g., a sub-repository hash update). M4-core ⛓ Core client code / Rust. labels Feb 14, 2020
Copy link
Copy Markdown
Collaborator

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Help a reviewer out and point me to where the type safety happens please?

impl SignedTransaction {
/// Try to verify transaction and recover sender.
pub fn new(transaction: UnverifiedTransaction) -> Result<Self, parity_crypto::publickey::Error> {
if transaction.is_unsigned() {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the aforementioned type safety is here, SignedTransaction::new will not accept unsigned transactions after #11335

match basic_test(&create_test_block_with_data(&bad_header, &eip86_transactions, &good_uncles), engine) {
Err(Error::Transaction(ref e)) if e == &parity_crypto::publickey::Error::InvalidSignature.into() => (),
e => panic!("Block verification failed.\nExpected: Transaction Error (Invalid Signature)\nGot: {:?}", e),
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was required (as some other removed code) to account for eip86 which we no longer support

return Ok(ContractCreateResult::Failed)
}
if let Err(e) = self.state.inc_nonce(&self.origin_info.address) {
warn!(target: "ext", "Database corruption encountered: {:?}", e);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to a warning

@ordian ordian requested review from sorpaas and tomusdrw February 14, 2020 15:26
}

#[test]
fn should_disallow_unsigned_transactions() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or did you mean something else?

Copy link
Copy Markdown
Collaborator

@tomusdrw tomusdrw Feb 15, 2020

Choose a reason for hiding this comment

The 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 SignedTransaction. I think it was added based on an actual previous bug, so keeping it as a way to prevent regressions should hurt.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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 UnverifiedTransaction and calls verify_transaction_basic expecting it to reject it.
But this PR removes this rejection logic, since it's not needed as we don't allow SignedTransactions with null-signatures.
Now if I modify the test to convert a transaction to a SignedTransaction, then it's not different than the test linked above.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conversion happens within engine/machine, doesn't it (via verify_transaction). IMHO still worth to check the machine/engine integration with this, but not super strong on this. If you disagree - then fine, let's remove it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conversion happens in the verification queue when we convert Unverified block to PreverifiedBlock
https://github.com/paritytech/parity-ethereum/blob/856a0755888a30d4dc52a68cb2638a8bfd5786ac/ethcore/verification/src/verification.rs#L100

Added dd4bbf3, let me know what you think.

@ordian ordian merged commit a4aef98 into master Feb 15, 2020
@ordian ordian deleted the ao-finish-cleanup-of-null-signatures-removal branch February 15, 2020 12:26
ordian added a commit that referenced this pull request Mar 6, 2020
* master: (27 commits)
  Faster kill_garbage (#11514)
  [EngineSigner]: don't sign message with only zeroes (#11524)
  fix compilation warnings (#11522)
  [ethcore cleanup]: various unrelated fixes from `#11493` (#11507)
  Add benchmark for transaction execution (#11509)
  Add Smart Contract License v1.0
  Misc fixes (#11510)
  [dependencies]: unify `rustc-hex` (#11506)
  Activate on-chain randomness in POA Sokol (#11505)
  Grab bag of cleanup (#11504)
  Implement eth/64 (EIP-2364) and drop support for eth/62 (#11472)
  [dependencies]: remove `util/macros` (#11501)
  OpenEthereum bootnodes are added (#11499)
  [ci benches]: use `all-features` (#11496)
  [verification]: make test-build compile standalone (#11495)
  complete null-signatures removal (#11491)
  Include the seal when populating the header for a new block (#11475)
  fix compilation warnings (#11492)
  cargo update -p cmake (#11490)
  update to published rlp-derive (#11489)
  ...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A2-insubstantial 👶 Pull request requires no code review (e.g., a sub-repository hash update). M4-core ⛓ Core client code / Rust.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Finish cleanup of miner code

3 participants