Skip to content

Commit

Permalink
Handle calls to self declared external functions (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
smonicas authored Sep 20, 2023
1 parent 39c3e90 commit 5bd2f19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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

0 comments on commit 5bd2f19

Please sign in to comment.