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

Comments

Generalised Transaction Queue API#741

Merged
gavofyork merged 8 commits intomasterfrom
gav-general-txq
Sep 17, 2018
Merged

Generalised Transaction Queue API#741
gavofyork merged 8 commits intomasterfrom
gav-general-txq

Conversation

@gavofyork
Copy link
Member

@gavofyork gavofyork commented Sep 14, 2018

First part of what described in #728 .

Also:

  • Upgraded parity-codec (1.1)
  • Added API functionality versioning

@gavofyork gavofyork requested review from arkpar, dvdplm and tomusdrw and removed request for arkpar, dvdplm and tomusdrw September 14, 2018 13:54
@gavofyork gavofyork added the A0-please_review Pull request needs code review. label Sep 15, 2018
#[derive(Clone, PartialEq, Eq, Encode, Decode)]
pub enum TransactionValidity {
Invalid,
Valid(TransactionPriority, Vec<TransactionTag>, Vec<TransactionTag>),
Copy link
Contributor

Choose a reason for hiding this comment

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

I would actually use a named fields here, cause we might easily forget which one was requires and which one provides.

/// Information on a transaction's validity and, if valid, on how it relates to other transactions.
#[derive(Clone, PartialEq, Eq, Encode, Decode)]
pub enum TransactionValidity {
Invalid,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we allow also allow to give an optional reason for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

perhaps, but a 'static str/String isn't especially suitable as it's wasm -> runtime.

/// side-effects; it merely checks whether the transaction would panic if it were included or not.
///
/// Changes made to the storage should be discarded.
pub fn validate_transaction(uxt: Block::Extrinsic) -> TransactionValidity {
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be easier to have something like Result<..> here and use ? syntax to early exit. Then maybe From<Result<..>> for TransactionValidity

if xt.index() < &expected_index {
return TransactionValidity::Invalid
}
if *xt.index() > expected_index + As::sa(256) {
Copy link
Contributor

Choose a reason for hiding this comment

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

So this would be specific to runtime, right? The pool should not make any assumptions like this?

Copy link
Member Author

Choose a reason for hiding this comment

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

right - this is just a sanity check. the pool should be ignorant of such things and rely on what the runtime is telling it.

@gavofyork gavofyork merged commit cadd055 into master Sep 17, 2018
@gavofyork gavofyork deleted the gav-general-txq branch September 17, 2018 16:44
@tomusdrw tomusdrw mentioned this pull request Sep 21, 2018
4 tasks
lamafab pushed a commit to lamafab/substrate that referenced this pull request Jun 16, 2020
…ech#741)

* Bumped versions

* Bump to latest substrate that exposes load_spec
liuchengxu pushed a commit to chainx-org/substrate that referenced this pull request Aug 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants