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

test: Improve tests of exchange_router contract. #555

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
1 change: 0 additions & 1 deletion src/deposit/deposit_utils.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ fn create_deposit(
) -> felt252 {
validate_account(account);

//let market = data_store.get_market(data_store,params.market);
let market = market_utils::get_enabled_market(data_store, params.market);
market_utils::validate_swap_path(data_store, params.long_token_swap_path);
market_utils::validate_swap_path(data_store, params.short_token_swap_path);
Expand Down
4 changes: 2 additions & 2 deletions src/router/exchange_router.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,13 @@ mod ExchangeRouter {

fn create_deposit(ref self: ContractState, params: CreateDepositParams) -> felt252 {
let data_store = self.data_store.read();
global_reentrancy_guard::non_reentrant_before(data_store);
// global_reentrancy_guard::non_reentrant_before(data_store);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The global_reentrancy_guard::non_reentrant_before function is also called in the create_deposit function.
So I think there's one call too many, please, can you check if it's really this call that should be removed and not the one from the create_deposit function?


let account = get_caller_address();

let key = self.deposit_handler.read().create_deposit(account, params);

global_reentrancy_guard::non_reentrant_after(data_store);
// global_reentrancy_guard::non_reentrant_after(data_store);

key
}
Expand Down
1 change: 1 addition & 0 deletions tests/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ mod role {
}
mod router {
mod test_router;
mod test_exchange_router;
}
mod swap {
mod test_swap_handler;
Expand Down
Loading
Loading