-
Notifications
You must be signed in to change notification settings - Fork 89
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(JSON-RPC): get_transaction_receipt supports pending #1284
feat(JSON-RPC): get_transaction_receipt supports pending #1284
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.
+reviewer:@Yael-Starkware
Reviewable status: 0 of 8 files reviewed, all discussions resolved (waiting on @dan-starkware, @Yael-Starkware, and @yair-starkware)
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 8 files reviewed, all discussions resolved (waiting on @dan-starkware, @Yael-Starkware, and @yair-starkware)
a discussion (no related file):
LMK if this PR is too big and you prefer I split it
Codecov Report
@@ Coverage Diff @@
## rpc_pending #1284 +/- ##
===============================================
- Coverage 72.94% 72.54% -0.40%
===============================================
Files 84 84
Lines 8156 8349 +193
Branches 8156 8349 +193
===============================================
+ Hits 5949 6057 +108
- Misses 1240 1300 +60
- Partials 967 992 +25
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
5f03912
to
d547fc3
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 8 files reviewed, all discussions resolved (waiting on @dan-starkware, @Yael-Starkware, and @yair-starkware)
crates/papyrus_rpc/resources/V0_4_0/starknet_api_openrpc.json
line 2202 at r2 (raw file):
] }, "PENDING_INVOKE_TXN_RECEIPT": {
This is taken from the latest version of the specs. I talked to @ArielElp and he prefers we deviate from the specs than fixing v0.4.0 on something that's already fixed in a later version
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 4 of 8 files at r1, 3 of 4 files at r2, all commit messages.
Reviewable status: 7 of 8 files reviewed, 3 unresolved discussions (waiting on @dan-starkware, @ShahakShama, and @Yael-Starkware)
crates/papyrus_rpc/src/v0_4_0/transaction.rs
line 396 at r2 (raw file):
#[derive(Debug, Clone, Eq, PartialEq, Hash, Deserialize, Serialize, PartialOrd, Ord)] #[serde(untagged)] pub enum GeneralTransactionReceipt {
Why do the pending transactions need their own receipt type?
crates/papyrus_rpc/src/v0_4_0/api/api_impl.rs
line 407 at r2 (raw file):
}; let block_number = transaction_index.0;
IIUC this code is the continuation of the non-pending transaction flow.
Consider changing to if-let and keep the whole code together.
crates/papyrus_rpc/src/v0_4_0/api/test.rs
line 745 at r2 (raw file):
// Ask for a pending transaction. let mut rng = get_rng();
Why randomness?
Can you explain what you are doing here?
d547fc3
to
327a439
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: 7 of 8 files reviewed, 3 unresolved discussions (waiting on @dan-starkware, @Yael-Starkware, and @yair-starkware)
crates/papyrus_rpc/src/v0_4_0/transaction.rs
line 396 at r2 (raw file):
Previously, yair-starkware (Yair) wrote…
Why do the pending transactions need their own receipt type?
Because they have no block_hash/number, and their output and finality are more prohibiting
crates/papyrus_rpc/src/v0_4_0/api/api_impl.rs
line 407 at r2 (raw file):
Previously, yair-starkware (Yair) wrote…
IIUC this code is the continuation of the non-pending transaction flow.
Consider changing to if-let and keep the whole code together.
Where's the common code that I'll be saving? I don't see any intersection
crates/papyrus_rpc/src/v0_4_0/api/test.rs
line 745 at r2 (raw file):
Previously, yair-starkware (Yair) wrote…
Why randomness?
Can you explain what you are doing here?
I'll explain, in function :)
605d628
to
67982e1
Compare
327a439
to
c3c786d
Compare
Previously, ShahakShama wrote…
Make the pending data hard-coded instead of random |
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 5 of 8 files at r8, 3 of 5 files at r9, all commit messages.
Reviewable status: 8 of 10 files reviewed, 2 unresolved discussions (waiting on @dan-starkware, @ShahakShama, and @Yael-Starkware)
c3c786d
to
6697fbc
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 r10, all commit messages.
Reviewable status: 9 of 10 files reviewed, 3 unresolved discussions (waiting on @dan-starkware, @ShahakShama, and @Yael-Starkware)
crates/papyrus_rpc/src/v0_4_0/api/api_impl.rs
line 407 at r2 (raw file):
Previously, ShahakShama wrote…
Where's the common code that I'll be saving? I don't see any intersection
discussed
crates/papyrus_rpc/src/v0_4_0/api/test.rs
line 770 at r10 (raw file):
assert_eq!(res.output.execution_status(), &TransactionExecutionStatus::Succeeded); // Ask for a pending transaction.
// Add a pending transaction and ask for its receipt.
Code quote:
// Ask for a pending transaction.
crates/papyrus_rpc/src/v0_4_0/api/test.rs
line 1270 at r10 (raw file):
let mut client_transaction_receipt = ClientTransactionReceipt::get_test_instance(rng); client_transaction_receipt.transaction_hash = pending_transaction_hash; let (mut client_transaction, output) = loop {
Add a comment explaining this loop.
Code quote:
let (mut client_transaction, output) = loop {
crates/papyrus_rpc/src/v0_4_0/api/test.rs
line 1276 at r10 (raw file):
.into_starknet_api_transaction_output(&client_transaction); let maybe_output = PendingTransactionOutput::try_from(TransactionOutput::from(starknet_api_output));
This code is repeated in multiple in api_impl. Consider creating a function.
Code quote:
let starknet_api_output = client_transaction_receipt
.clone()
.into_starknet_api_transaction_output(&client_transaction);
let maybe_output =
PendingTransactionOutput::try_from(TransactionOutput::from(starknet_api_output));
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: 9 of 10 files reviewed, 2 unresolved discussions (waiting on @dan-starkware, @Yael-Starkware, and @yair-starkware)
crates/papyrus_rpc/src/v0_4_0/api/test.rs
line 770 at r10 (raw file):
Previously, yair-starkware (Yair) wrote…
// Add a pending transaction and ask for its receipt.
Done.
crates/papyrus_rpc/src/v0_4_0/api/test.rs
line 1270 at r10 (raw file):
Previously, yair-starkware (Yair) wrote…
Add a comment explaining this loop.
Done.
6697fbc
to
df8169b
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 r11, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @dan-starkware and @Yael-Starkware)
This change is