-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat(mempool): add pending transaction type #439
feat(mempool): add pending transaction type #439
Conversation
4cdc00b
to
fcb733d
Compare
7bff7dc
to
55308a2
Compare
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.
Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @ayeletstarkware, @giladchase, and @MohammadNassar1)
crates/mempool/src/mempool.rs
line 238 at r1 (raw file):
} }
Aren't there these getters in SN API?
crates/mempool/src/transaction_queue.rs
line 71 at r1 (raw file):
} /// Encapsulates a transaction reference to assess its order (i.e., priority).
Update comment.
Code quote:
priority
crates/mempool/src/transaction_queue.rs
line 72 at r1 (raw file):
/// Encapsulates a transaction reference to assess its order (i.e., priority). /// A transaction with gas price below the threshold. Sorted according to the gas price.
This belongs next to the data structure that will be holding them; it's our of scope for the transaction struct itself.
Code quote:
/// A transaction with gas price below the threshold. Sorted according to the gas price.
crates/mempool/src/transaction_queue.rs
line 77 at r1 (raw file):
/// Compare transactions based only on their gas price, a uint, using the Eq trait. It ensures that /// two gas price are either exactly equal or not.
But it's the PartialEq
trait, I'm confused.
Also, this comment isn't clear to me in general. Did you understand it?
Code quote:
/// Compare transactions based only on their gas price, a uint, using the Eq trait. It ensures that
/// two gas price are either exactly equal or not.
crates/mempool/src/transaction_queue.rs
line 101 at r1 (raw file):
Some(self.cmp(other)) } }
I wouldn't repeat all comments for the two structs. Better to refer the reader to PendingTransaction
's documentation.
362f5e4
to
f1559fc
Compare
2da3d4c
to
c57d7dd
Compare
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.
Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on @ayeletstarkware, @elintul, and @giladchase)
crates/mempool/src/mempool.rs
line 238 at r1 (raw file):
Previously, elintul (Elin) wrote…
Aren't there these getters in SN API?
No.
crates/mempool/src/transaction_queue.rs
line 101 at r1 (raw file):
Previously, elintul (Elin) wrote…
I wouldn't repeat all comments for the two structs. Better to refer the reader to
PendingTransaction
's documentation.
Done
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.
Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @ayeletstarkware, @giladchase, and @MohammadNassar1)
crates/mempool/src/mempool.rs
line 238 at r1 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
No.
Don't think they should be pub
lic though. Note visibility in general; and specifically when the compiler doesn't complain about unused code - means the code is pub
lic, we should be convinced it needs to be.
crates/mempool/src/mempool.rs
line 235 at r2 (raw file):
} pub fn get_l2_gas_price(&self) -> Option<u128> {
Do we need this?
Code quote:
get_l2_gas_price
crates/mempool/src/transaction_queue.rs
line 102 at r2 (raw file):
} /// This struct behaves similarly to [`PendingTransaction`], It encapsulates a transaction reference
Suggestion:
, encapsulating
crates/mempool/src/transaction_queue.rs
line 106 at r2 (raw file):
/// # See Also /// /// - [`PendingTransaction`]: for details.
How do I see the resulting doc. file from this?
Code quote:
/// # See Also
///
/// - [`PendingTransaction`]: for details.
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.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @ayeletstarkware, @elintul, and @giladchase)
crates/mempool/src/transaction_queue.rs
line 77 at r1 (raw file):
Previously, elintul (Elin) wrote…
But it's the
PartialEq
trait, I'm confused.
Also, this comment isn't clear to me in general. Did you understand it?
I think Gilad added this comment.
What's unclear exactly?
PartialEq
implements eq
method.
c57d7dd
to
158d54c
Compare
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.
Reviewable status: 0 of 2 files reviewed, 5 unresolved discussions (waiting on @ayeletstarkware, @elintul, and @giladchase)
crates/mempool/src/mempool.rs
line 238 at r1 (raw file):
Previously, elintul (Elin) wrote…
Don't think they should be
pub
lic though. Note visibility in general; and specifically when the compiler doesn't complain about unused code - means the code ispub
lic, we should be convinced it needs to be.
It needs to be public so that it can be used in tx queue file.
crates/mempool/src/mempool.rs
line 235 at r2 (raw file):
Previously, elintul (Elin) wrote…
Do we need this?
I assume you mean l1.
Removed; it will be added once mempool considers the l1 price.
crates/mempool/src/transaction_queue.rs
line 102 at r2 (raw file):
} /// This struct behaves similarly to [`PendingTransaction`], It encapsulates a transaction reference
Done.
crates/mempool/src/transaction_queue.rs
line 106 at r2 (raw file):
Previously, elintul (Elin) wrote…
How do I see the resulting doc. file from this?
Not sure I get it.
What do you mean?
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.
Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ayeletstarkware, @giladchase, and @MohammadNassar1)
crates/mempool/src/mempool.rs
line 238 at r1 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
It needs to be public so that it can be used in tx queue file.
Okay, cool. I thought it was the other way around.
crates/mempool/src/transaction_queue.rs
line 106 at r2 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
Not sure I get it.
What do you mean?
The HTML doc. that is created from this doc.; I think you should run cargo build docs
or something similar. Was wondering about this syntax, since I don't recognize it.
crates/mempool/src/transaction_queue.rs
line 75 at r3 (raw file):
struct PendingTransaction(pub TransactionReference); /// Compare transactions based only on their gas price, a uint, using the Eq trait. It ensures that
158d54c
to
582a989
Compare
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.
Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware, @giladchase, and @MohammadNassar1)
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.
Reviewed 1 of 2 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware, @elintul, and @giladchase)
crates/mempool/src/transaction_queue.rs
line 106 at r2 (raw file):
Previously, elintul (Elin) wrote…
The HTML doc. that is created from this doc.; I think you should run
cargo build docs
or something similar. Was wondering about this syntax, since I don't recognize it.
It seems that it only generates public code, and transactino_queue is a private module.
See output:
file:///home/lt-mohammadn/workspace/sequencer1/target/doc/starknet_mempool/mempool/struct.Mempool.html
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware, @giladchase, and @MohammadNassar1)
crates/mempool/src/transaction_queue.rs
line 105 at r4 (raw file):
/// to assess its order (i.e., tip). /// /// # See also `PendingTransaction` docstring for details.
Suggestion:
/// to assess its order (i.e., tip); see its documentation for more details.
f4eb3bd
to
591f6f6
Compare
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.
Reviewed 2 of 2 files at r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware, @giladchase, and @MohammadNassar1)
crates/mempool/src/mempool.rs
line 219 at r5 (raw file):
pub resource_bounds: ResourceBoundsMapping, }
Keep error messages (tip and L2 gas) in same format.
Also, is this the earliest point of time this can happen in?
591f6f6
to
9e88b7d
Compare
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.
Reviewable status: 1 of 3 files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware, @elintul, and @giladchase)
crates/mempool/src/mempool.rs
line 219 at r5 (raw file):
Previously, elintul (Elin) wrote…
Keep error messages (tip and L2 gas) in same format.
Also, is this the earliest point of time this can happen in?
Done.
As the current Transaction type may be a deprecated version, this is the earliest point.
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.
Reviewed 2 of 2 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware, @giladchase, and @MohammadNassar1)
crates/mempool/src/mempool.rs
line 219 at r5 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
Done.
As the current Transaction type may be a deprecated version, this is the earliest point.
@ArniStarkware, should be changed.
crates/mempool/src/mempool.rs
line 239 at r6 (raw file):
.get(&Resource::L2Gas) .map(|bounds| bounds.max_price_per_unit) .expect("Expected L2Gas resource found")
Why is it still optional here? This should change in 0.13.3
, right?
Please align the error message here too.
Code quote:
.map(|bounds| bounds.max_price_per_unit)
.expect("Expected L2Gas resource found")
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware, @elintul, and @giladchase)
crates/mempool/src/mempool.rs
line 239 at r6 (raw file):
Previously, elintul (Elin) wrote…
Why is it still optional here? This should change in
0.13.3
, right?
Please align the error message here too.
because resource bounds is a map of resource to resource bound.
So here it is optional since the map keys "may" not include L2Resource.
What do you mean by "align the error message"? Here, I cannot say "expected a valid resource but received none." The resource is not none, the resource is not existed, so I wrote "L2Gas should be found". wdyt?
9e88b7d
to
322d3fc
Compare
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.
Reviewed all commit messages.
Reviewable status: 2 of 3 files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware, @giladchase, and @MohammadNassar1)
crates/mempool/src/mempool.rs
line 239 at r6 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
because resource bounds is a map of resource to resource bound.
So here it is optional since the map keys "may" not include L2Resource.What do you mean by "align the error message"? Here, I cannot say "expected a valid resource but received none." The resource is not none, the resource is not existed, so I wrote "L2Gas should be found". wdyt?
You can say expected a valid X value, without say what you received.
322d3fc
to
053ae9a
Compare
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.
Reviewable status: 2 of 3 files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware, @elintul, and @giladchase)
crates/mempool/src/mempool.rs
line 239 at r6 (raw file):
Previously, elintul (Elin) wrote…
You can say expected a valid X value, without say what you received.
Done.
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.
Reviewed 1 of 1 files at r8, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ayeletstarkware, @giladchase, and @MohammadNassar1)
crates/mempool/src/mempool.rs
line 212 at r8 (raw file):
nonce: tx.nonce(), tx_hash: tx.tx_hash(), tip: tx.tip().expect("Expected a valid tip value, but received None."),
Suggestion:
"Expected a valid tip value."
crates/mempool/src/mempool.rs
line 215 at r8 (raw file):
resource_bounds: tx .resource_bounds() .expect("Expected a valid resource bounds value, but received None.")
Suggestion:
"Expected a valid resource bounds value."
crates/mempool/src/mempool.rs
line 225 at r8 (raw file):
.get(&Resource::L2Gas) .map(|bounds| bounds.max_price_per_unit) .expect("Expected a valid L2Gas resource.")
Suggestion:
"Expected a valid L2 gas resource bounds."
053ae9a
to
9048645
Compare
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.
Reviewed 1 of 1 files at r9, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ayeletstarkware and @giladchase)
Previously, elintul (Elin) wrote…
I don't follow. |
Previously, ArniStarkware (Arnon Hod) wrote…
I do follow :) |
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.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ayeletstarkware and @giladchase)
This change is