-
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: support catching EntryPointNotFound #1248
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 7 files reviewed, 1 unresolved discussion (waiting on @Yoni-Starkware)
crates/blockifier/src/execution/entry_point.rs
line 170 at r1 (raw file):
resources: Default::default(), inner_calls: vec![], tracked_resource: TrackedResource::SierraGas,
what should I put here?
Code quote:
tracked_resource: TrackedResource::SierraGas
eca748a
to
74a20e1
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1248 +/- ##
==========================================
- Coverage 74.18% 65.19% -8.99%
==========================================
Files 359 163 -196
Lines 36240 22051 -14189
Branches 36240 22051 -14189
==========================================
- Hits 26886 14377 -12509
+ Misses 7220 6537 -683
+ Partials 2134 1137 -997
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
9b7a672
to
5aa6bfe
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 7 files at r1, 1 of 4 files at r2.
Reviewable status: 3 of 9 files reviewed, 4 unresolved discussions (waiting on @ilyalesokhin-starkware)
crates/blockifier/src/execution/entry_point.rs
line 170 at r1 (raw file):
Previously, ilyalesokhin-starkware wrote…
what should I put here?
Move this code inside execute_entry_point_call_wrapper
and take context.tracked_resource_stack.last()
crates/blockifier/src/execution/entry_point.rs
line 174 at r2 (raw file):
accessed_storage_keys: Default::default(), }), res => res,
Suggestion:
let orig_call = self.clone();
match execute_entry_point_call_wrapper(self, contract_class, state, resources, context) {
Err(EntryPointExecutionError::PreExecutionError(
PreExecutionError::EntryPointNotFound(_),
)) if context.versioned_constants().enable_reverts => Ok(CallInfo {
call: self.clone(),
execution: CallExecution {
retdata: Retdata(vec![Felt::from_hex(ENTRYPOINT_NOT_FOUND_ERROR).unwrap()]),
failed: true,
..CallExecution::default()
},
tracked_resource: TrackedResource::SierraGas,
..CallInfo::default()
}),
res => res,
crates/blockifier/src/execution/entry_point_test.rs
line 168 at r2 (raw file):
CallEntryPoint { entry_point_selector, ..trivial_external_entry_point_new(test_contract) }; let call_info = entry_point_call.execute_directly(&mut state).unwrap(); assert!(call_info.execution.failed);
Can you check the retdata format?
Code quote:
assert!(call_info.execution.failed);
crates/papyrus_rpc/src/v0_8/execution_test.rs
line 293 at r2 (raw file):
let entry_point_not_found_error = felt!("0x000000000000000000000000454e545259504f494e545f4e4f545f464f554e44"); assert_eq!(call, [entry_point_not_found_error]);
Not sure this is the right behavior here. A reverted call should result in an error.
Code quote:
// Calling a non-existent entry point.
let call = module
.call::<_, Vec<Felt>>(
"starknet_V0_8_call",
(
CallRequest {
contract_address: *DEPRECATED_CONTRACT_ADDRESS,
entry_point_selector: selector_from_name("aaa"),
calldata: calldata![key, value],
},
BlockId::HashOrNumber(BlockHashOrNumber::Number(BlockNumber(0))),
),
)
.await
.unwrap();
let entry_point_not_found_error =
felt!("0x000000000000000000000000454e545259504f494e545f4e4f545f464f554e44");
assert_eq!(call, [entry_point_not_found_error]);
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.
What if the missing selector is coming from Cairo 0?
Reviewable status: 3 of 9 files reviewed, 4 unresolved discussions (waiting on @ilyalesokhin-starkware)
this is also the default, is there a reason you left it? |
self was consume by |
5aa6bfe
to
cbd2953
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: 3 of 9 files reviewed, 3 unresolved discussions (waiting on @Yoni-Starkware)
crates/blockifier/src/execution/entry_point_test.rs
line 168 at r2 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
Can you check the retdata format?
Done.
cbd2953
to
db62294
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 4 of 8 files at r3, all commit messages.
Reviewable status: 5 of 10 files reviewed, 4 unresolved discussions (waiting on @ilyalesokhin-starkware)
crates/blockifier/src/execution/execution_utils.rs
line 60 at r3 (raw file):
context: &mut EntryPointExecutionContext, ) -> EntryPointExecutionResult<CallInfo> { let tracked_resource = contract_class
Suggestion:
contract_tracked_resource = contract_class
crates/blockifier/src/execution/execution_utils.rs
line 91 at r3 (raw file):
res } }
To be on the safe side - you might add more cases here and forget to pop it.
Suggestion:
let orig_call = call.clone();
let res = execute_entry_point_call(call, contract_class, state, resources, context);
let current_tracked_resource = context.tracked_resource_stack.pop().expect("Unexpected empty tracked resource.")
match res {
Err(EntryPointExecutionError::PreExecutionError(
PreExecutionError::EntryPointNotFound(_),
)) if context.versioned_constants().enable_reverts => Ok(CallInfo {
call: orig_call,
execution: CallExecution {
retdata: Retdata(vec![Felt::from_hex(ENTRYPOINT_NOT_FOUND_ERROR).unwrap()]),
failed: true,
gas_consumed: 0,
..CallExecution::default()
},
tracked_resource: current_tracked_resource,
..CallInfo::default()
}),
res => res;
}
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: 5 of 10 files reviewed, 4 unresolved discussions (waiting on @ilyalesokhin-starkware)
crates/blockifier/src/execution/entry_point.rs
line 174 at r2 (raw file):
this is also the default, is there a reason you left it?
I deleted it
db62294
to
1bb039d
Compare
Benchmark movements: |
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 7 files at r4, all commit messages.
Reviewable status: 5 of 14 files reviewed, 4 unresolved discussions (waiting on @ilyalesokhin-starkware)
1bb039d
to
38155fb
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 r5, all commit messages.
Reviewable status: 5 of 14 files reviewed, 4 unresolved discussions (waiting on @ilyalesokhin-starkware)
38155fb
to
19c936e
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 7 of 10 files at r6, all commit messages.
Reviewable status: 9 of 14 files reviewed, 2 unresolved discussions (waiting on @ilyalesokhin-starkware)
19c936e
to
c577ee3
Compare
Previously, Yoni-Starkware (Yoni) wrote…
fixed |
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 14 files reviewed, 1 unresolved discussion (waiting on @Yoni-Starkware)
crates/blockifier/src/execution/execution_utils.rs
line 91 at r3 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
To be on the safe side - you might add more cases here and forget to pop it.
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 7 files at r4, 2 of 10 files at r6, 3 of 3 files at r7, all commit messages.
Reviewable status: 13 of 14 files reviewed, all discussions resolved
c577ee3
to
8fde36c
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 5 of 5 files at r8, all commit messages.
Reviewable status: 13 of 14 files reviewed, all discussions resolved
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 7 files at r4.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware)
eefa1b2
to
7b1f7bd
Compare
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.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware)
7b1f7bd
to
969415f
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 r9, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware)
969415f
to
f8a00d6
Compare
f8a00d6
to
02c1b7d
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 r10, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware)
This change is