-
Notifications
You must be signed in to change notification settings - Fork 30
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 resource bounds to transaction reference type #437
feat(mempool): add resource bounds to transaction reference type #437
Conversation
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 3 files reviewed, 1 unresolved discussion
a discussion (no related file):
This PR adds resource_bounds to the transaction reference; this field will be used to check the gas price.
As resource_bounds doesn't implement Copy
, I removed Copy
from TransactionReference
.
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 3 files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware, @elintul, and @MohammadNassar1)
a discussion (no related file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
This PR adds resource_bounds to the transaction reference; this field will be used to check the gas price.
As resource_bounds doesn't implementCopy
, I removedCopy
fromTransactionReference
.
Can you ping Dori about the Copy thing? i think Meshi started implementing Copy on ResourceBoundsMapping, and she told me the task was passed to Dori's team
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 3 files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware, @elintul, and @giladchase)
a discussion (no related file):
Previously, giladchase wrote…
Can you ping Dori about the Copy thing? i think Meshi started implementing Copy on ResourceBoundsMapping, and she told me the task was passed to Dori's team
Asked him, till then I think I can merge this PR.
Do you prefer deref on clone?
4cdc00b
to
fcb733d
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 3 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @ayeletstarkware, @giladchase, and @MohammadNassar1)
crates/mempool/src/mempool.rs
line 113 at r2 (raw file):
if self.tx_queue.get_nonce(address).is_none() { if let Some(tx) = self.tx_pool.get_by_address_and_nonce(address, next_nonce) {
Throughout the code (also in transaction_queue.rs
below); tx.clone()
should not appear.
Suggestion:
tx_reference
crates/mempool/src/mempool.rs
line 218 at r2 (raw file):
/// TODO(Mohammad): rename this struct to `ThinTransaction` once that name /// becomes available, to better reflect its purpose and usage. #[derive(Clone, Debug, Default, Eq, PartialEq)]
Add a TODO to restore the Copy
once ResourceBoundsMapping
implements it.
crates/mempool/src/mempool_test.rs
line 352 at r2 (raw file):
let pool_txs = [input_nonce_1.tx]; let queue_txs = [];
Why are these changes suddenly needed?
fcb733d
to
09556f8
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: all files reviewed, 4 unresolved discussions (waiting on @ayeletstarkware, @elintul, and @giladchase)
crates/mempool/src/mempool.rs
line 113 at r2 (raw file):
Previously, elintul (Elin) wrote…
Throughout the code (also in
transaction_queue.rs
below);tx.clone()
should not appear.
Why clone should not appear?
We cannot use deref as it doesn't imply copy.
crates/mempool/src/mempool.rs
line 218 at r2 (raw file):
Previously, elintul (Elin) wrote…
Add a TODO to restore the
Copy
onceResourceBoundsMapping
implements it.
Done.
crates/mempool/src/mempool_test.rs
line 352 at r2 (raw file):
Previously, elintul (Elin) wrote…
Why are these changes suddenly needed?
queue_txs is from the TransactionReference
type, and since it doesn't implement Copy, so I had to add a clone.
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 3 of 3 files at r3, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @ayeletstarkware, @giladchase, and @MohammadNassar1)
crates/mempool/src/mempool.rs
line 113 at r2 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
Why clone should not appear?
We cannot use deref as it doesn't imply copy.
I meant .clone()
should not be invoked on a variable named tx
if it's a transaction reference. It makes the reader think there's heavy-lifting being done.
crates/mempool/src/mempool_test.rs
line 352 at r2 (raw file):
Previously, MohammadNassar1 (mohammad-starkware) wrote…
queue_txs is from the
TransactionReference
type, and since it doesn't implement Copy, so I had to add a clone.
What happened before? It was Copy
ied implicitly?
crates/mempool/src/transaction_queue.rs
line 25 at r3 (raw file):
pub fn insert(&mut self, tx: TransactionReference) { assert_eq!( self.address_to_tx.insert(tx.sender_address, tx.clone()),
Suggestion:
tx_reference
09556f8
to
362f5e4
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, 4 unresolved discussions (waiting on @ayeletstarkware, @elintul, and @giladchase)
crates/mempool/src/mempool.rs
line 113 at r2 (raw file):
Previously, elintul (Elin) wrote…
I meant
.clone()
should not be invoked on a variable namedtx
if it's a transaction reference. It makes the reader think there's heavy-lifting being done.
I see.
I think we don't have tx.clone()
anymore.
crates/mempool/src/mempool_test.rs
line 352 at r2 (raw file):
Previously, elintul (Elin) wrote…
What happened before? It was
Copy
ied implicitly?
Exactly.
crates/mempool/src/transaction_queue.rs
line 25 at r3 (raw file):
pub fn insert(&mut self, tx: TransactionReference) { assert_eq!( self.address_to_tx.insert(tx.sender_address, tx.clone()),
Done.
362f5e4
to
f1559fc
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 3 of 3 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware and @giladchase)
This change is