-
Notifications
You must be signed in to change notification settings - Fork 359
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
Update security docs #794
Update security docs #794
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, sir! I left some comments, questions, and suggestions
src/security/pausable.cairo
Outdated
fn _pause(ref self: ComponentState<TContractState>) { | ||
fn pause(ref self: ComponentState<TContractState>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is for consistency, right? In the past, we followed the convention that underscored methods signified that it was potentially unsafe e.g. _mint
. We should probably prioritize defining the new standard moving forward so that cases like this are clear. I don't love the idea of changing this without said standard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point. Agree is better wait for that discussion to happen.
src/security/initializable.cairo
Outdated
trait ExternalTrait<TState> { | ||
fn is_initialized(self: @TState) -> bool; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strong opinions on including this trait. I suppose there may be cases where this is useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name IPausable sounds a bit misleading IMO (for an interface with just the is_paused
method), I think for this case is better to use a trait (like PublicKeyTrait in account), I selected the name ExternalTrait because no better name occurred to me for just is_paused. We should document this convention/pattern if we go along with it. What do you think @martriay ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name IPausable sounds a bit misleading IMO (for an interface with just the is_paused method)
Good point. Here, it'd be IInitializable
, but the point is the same. I can see it being misleading with just the getter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should document this convention/pattern if we go along with it.
I just wrote this recently in our style guide, which is something I recall we discussed maybe during a call. Let me know if you think it doesn't apply here
The name IPausable sounds a bit misleading IMO (for an interface with just the
is_paused
method)
I kindof see what you mean, but on the other hand "pausable" doesn't really mean I can pause it, but rather that it can be paused, so the getter is not really confusing to me. btw Contracts for Solidity's version has public pause/unpause methods
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
…lo/cairo-contracts into feat/update-security-docs-#565
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left one last suggestion. Assuming we all like ExternalTrait
in these instances, LGTM!
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
…lo/cairo-contracts into feat/update-security-docs-#565
…eat/update-security-docs-#565
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs look really good! Left some comments.
@@ -1,4 +1,4 @@ | |||
use openzeppelin::security::initializable::InitializableComponent::InternalImpl; | |||
use openzeppelin::security::InitializableComponent::{InitializableImpl, InternalImpl}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To call is_initialized
later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but why wasn't it failing?
src/security/initializable.cairo
Outdated
trait ExternalTrait<TState> { | ||
fn is_initialized(self: @TState) -> bool; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should document this convention/pattern if we go along with it.
I just wrote this recently in our style guide, which is something I recall we discussed maybe during a call. Let me know if you think it doesn't apply here
The name IPausable sounds a bit misleading IMO (for an interface with just the
is_paused
method)
I kindof see what you mean, but on the other hand "pausable" doesn't really mean I can pause it, but rather that it can be paused, so the getter is not really confusing to me. btw Contracts for Solidity's version has public pause/unpause methods
Co-authored-by: Martín Triay <martriay@gmail.com>
Co-authored-by: Martín Triay <martriay@gmail.com>
Co-authored-by: Martín Triay <martriay@gmail.com>
Co-authored-by: Martín Triay <martriay@gmail.com>
…lo/cairo-contracts into feat/update-security-docs-#565
Co-authored-by: Martín Triay <martriay@gmail.com>
Co-authored-by: Martín Triay <martriay@gmail.com>
Co-authored-by: Martín Triay <martriay@gmail.com>
Co-authored-by: Martín Triay <martriay@gmail.com>
Co-authored-by: Martín Triay <martriay@gmail.com>
…lo/cairo-contracts into feat/update-security-docs-#565
Fixes #565
PR Checklist