This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Don't remove invalid transactions when skipping. #5121
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
990bfb7
Don't remove invalid transactions when skipping.
tomusdrw bd14cd2
Use a special kind of extrinsic instead of arbitrary limit.
tomusdrw 6c4afe5
Fix txpool tests.
tomusdrw f4475bb
Attempt to create more blocks.
tomusdrw f0f213e
Bump lock
gavofyork 3ca7cce
Merge remote-tracking branch 'origin/master' into td-dont-ban-when-sk…
NikVolf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use a special kind of extrinsic instead of arbitrary limit.
- Loading branch information
commit bd14cd294b419e6ebf1c320f143bc77d58b23bab
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,15 +101,36 @@ impl Transfer { | |
| pub fn into_signed_tx(self) -> Extrinsic { | ||
| let signature = sp_keyring::AccountKeyring::from_public(&self.from) | ||
| .expect("Creates keyring from public key.").sign(&self.encode()).into(); | ||
| Extrinsic::Transfer(self, signature) | ||
| Extrinsic::Transfer { | ||
| transfer: self, | ||
| signature, | ||
| exhaust_resources: false, | ||
| } | ||
| } | ||
|
|
||
| /// Convert into a signed extrinsic, which will not end up included | ||
| /// in block due to resource exhaustion. | ||
| #[cfg(feature = "std")] | ||
| pub fn into_exhaust_tx(self) -> Extrinsic { | ||
| let signature = sp_keyring::AccountKeyring::from_public(&self.from) | ||
| .expect("Creates keyring from public key.").sign(&self.encode()).into(); | ||
| Extrinsic::Transfer { | ||
| transfer: self, | ||
| signature, | ||
| exhaust_resources: true, | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /// Extrinsic for test-runtime. | ||
| #[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug)] | ||
| pub enum Extrinsic { | ||
| AuthoritiesChange(Vec<AuthorityId>), | ||
| Transfer(Transfer, AccountSignature), | ||
| Transfer { | ||
| transfer: Transfer, | ||
| signature: AccountSignature, | ||
| exhaust_resources: bool, | ||
|
||
| }, | ||
| IncludeData(Vec<u8>), | ||
| StorageChange(Vec<u8>, Option<Vec<u8>>), | ||
| ChangesTrieConfigUpdate(Option<ChangesTrieConfiguration>), | ||
|
|
@@ -130,9 +151,9 @@ impl BlindCheckable for Extrinsic { | |
| fn check(self, _signature: CheckSignature) -> Result<Self, TransactionValidityError> { | ||
| match self { | ||
| Extrinsic::AuthoritiesChange(new_auth) => Ok(Extrinsic::AuthoritiesChange(new_auth)), | ||
| Extrinsic::Transfer(transfer, signature) => { | ||
| Extrinsic::Transfer { transfer, signature, exhaust_resources } => { | ||
| if sp_runtime::verify_encoded_lazy(&signature, &transfer, &transfer.from) { | ||
| Ok(Extrinsic::Transfer(transfer, signature)) | ||
| Ok(Extrinsic::Transfer { transfer, signature, exhaust_resources }) | ||
| } else { | ||
| Err(InvalidTransaction::BadProof.into()) | ||
| } | ||
|
|
@@ -165,7 +186,7 @@ impl ExtrinsicT for Extrinsic { | |
| impl Extrinsic { | ||
| pub fn transfer(&self) -> &Transfer { | ||
| match self { | ||
| Extrinsic::Transfer(ref transfer, _) => transfer, | ||
| Extrinsic::Transfer { ref transfer, .. } => transfer, | ||
| _ => panic!("cannot convert to transfer ref"), | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I still would like to see that we build a second block here.
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.
Then it means that the transaction cannot always exhaust resources. I guess it's fine, I'll change it so that it exhaust resources if it's not the ONLY/FIRST transaction in the block. Then keeping that variant as
Transferextension makes even more sense to me.