Skip to content
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

Handle calls to self declared external functions #50

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/analysis/reentrancy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ impl ReentrancyAnalysis {
Type::Event => {
inner_state.events.insert(basic_block.clone());
}
Type::Private | Type::Loop => {
// External and View are needed because it's possible to call self declared external functions within a private function
Type::Private | Type::Loop | Type::External | Type::View => {
if let GenStatement::Invocation(invoc) =
instruction.get_statement()
{
Expand Down
6 changes: 4 additions & 2 deletions src/core/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub struct Function {
storage_vars_written: Vec<SierraStatement>,
/// Core functions called
core_functions_calls: Vec<SierraStatement>,
/// Private functions called
/// Private functions called + calls to self declared External/View functions
private_functions_calls: Vec<SierraStatement>,
/// Events emitted (NOTE it doesn't have events emitted using the syscall directly)
events_emitted: Vec<SierraStatement>,
Expand Down Expand Up @@ -235,7 +235,9 @@ impl Function {
}
Type::Event => self.events_emitted.push(s.clone()),
Type::Core => self.core_functions_calls.push(s.clone()),
Type::Private => self.private_functions_calls.push(s.clone()),
Type::Private | Type::External | Type::View => {
self.private_functions_calls.push(s.clone())
}
Type::AbiCallContract => {
self.external_functions_calls.push(s.clone())
}
Expand Down