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

Reentrancy modifier questions #67

Open
deuszx opened this issue May 25, 2023 · 0 comments
Open

Reentrancy modifier questions #67

deuszx opened this issue May 25, 2023 · 0 comments
Assignees

Comments

@deuszx
Copy link

deuszx commented May 25, 2023

Given the code https://github.com/Brushfam/openbrush-contracts/blob/main/contracts/src/security/reentrancy_guard/mod.rs#L56

I have the following questions:

Should we really require the whole T: Storable bound on:

T: Storage<Data> + Storable

given that what we store is not T but Data:

    ink::env::set_contract_storage::<Key, Data>(&Default::default(), &instance.data());

And secondly, is Default::default() key safe to use in

ink::env::set_contract_storage::<Key, Data>(&Default::default(), &instance.data());

Key type here is ink::primitives::Key type (u32 alias) and defaults to 0. It could mean that if some other part of the contract, tries to store anything under that key (0) then it overwrites the instance.data(). Or vice versa - instance.data() may overwrite anything that was already stored there.

@coreggon11 coreggon11 self-assigned this Jun 28, 2023
@Artemka374 Artemka374 reopened this Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants