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

dev: do all call restriction checks (only owner etc.) in contracts #1094

Open
ClementWalter opened this issue Apr 10, 2024 · 4 comments
Open
Assignees

Comments

@ClementWalter
Copy link
Member

ClementWalter commented Apr 10, 2024

In a lot of places, we currently do in the contract

@external
func foo{
    syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr
}(bar: felt) {
    return Library.foo(bar);
}

and in the associated library

func foo{
    syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr
}(bar: felt) {
    Ownable.assert_only_owner();
    // ...
}

The check Ownable.assert_only_owner(); shouldn't be in the library because it belongs to a contract logic (who is the caller) and not a library logic (what is the function actually doing).

This issue is consequently about moving all these checks (not only only_owner but similar semantic) at the contract level

@emilamaj
Copy link

Do you mind assigning it to me ?

@ClementWalter ClementWalter assigned emilamaj and unassigned emilamaj Apr 17, 2024
@enitrat enitrat self-assigned this Apr 26, 2024
@stevencartavia
Copy link
Contributor

Hi, can I try this one?

@enitrat enitrat assigned stevencartavia and unassigned enitrat Jun 1, 2024
@enitrat
Copy link
Collaborator

enitrat commented Jun 3, 2024

@stevencartavia how are things going?

@stevencartavia
Copy link
Contributor

I am still figuring out some things

enitrat added a commit that referenced this issue Jun 7, 2024
<!--- Please provide a general summary of your changes in the title
above -->

<!-- Give an estimate of the time you spent on this PR in terms of work
days.
Did you spend 0.5 days on this PR or rather 2 days?  -->

Time spent on this PR: 0.7 days

## Pull request type

<!-- Please try to limit your pull request to one type,
submit multiple pull requests if needed. -->

Please check the type of change your PR introduces:

- [x] Refactoring (no functional changes, no api changes)

## What is the current behavior?

<!-- Please describe the current behavior that you are modifying,
or link to a relevant issue. -->

Resolves #<Issue number> #1094 

## What is the new behavior?

<!-- Please describe the behavior or changes that are being added by
this PR. -->
all call restriction checks (only owner etc.) in contracts

<!-- Reviewable:start -->
- - -
This change is [<img src="https://reviewable.io/review_button.svg"
height="34" align="absmiddle"
alt="Reviewable"/>](https://reviewable.io/reviews/kkrt-labs/kakarot/1179)
<!-- Reviewable:end -->

---------

Co-authored-by: enitrat <msaug@protonmail.com>
Co-authored-by: Clément Walter <clement0walter@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 Backlog
Development

No branches or pull requests

4 participants