-
Notifications
You must be signed in to change notification settings - Fork 8
feat: permissioned evm #100
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d8c57b6
permissioned
tac0turtle 603ec51
Merge branch 'main' into marko/permissioned
tac0turtle 4b19e48
produce document
tac0turtle 541a4c1
comments
tac0turtle ab50c54
Merge branch 'main' into marko/permissioned
tac0turtle 8c7fc50
switch to allow empty to allow everyone
tac0turtle 999be30
Merge branch 'main' into marko/permissioned
tac0turtle 9decf14
wording fix
tac0turtle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| //! Deploy allowlist settings for contract creation control. | ||
|
|
||
| use alloy_primitives::Address; | ||
| use std::sync::Arc; | ||
|
|
||
| /// Settings for gating contract deployment by caller allowlist. | ||
| #[derive(Debug, Clone)] | ||
| pub struct DeployAllowlistSettings { | ||
| allowlist: Arc<[Address]>, | ||
| activation_height: u64, | ||
| } | ||
|
|
||
| impl DeployAllowlistSettings { | ||
| /// Creates a new deploy allowlist configuration. | ||
| /// An empty allowlist disables gating and allows all callers. | ||
| pub fn new(allowlist: Vec<Address>, activation_height: u64) -> Self { | ||
| let mut allowlist = allowlist; | ||
| allowlist.sort_unstable(); | ||
| Self { | ||
| allowlist: Arc::from(allowlist), | ||
| activation_height, | ||
| } | ||
| } | ||
|
|
||
| /// Returns the activation height for deploy allowlist enforcement. | ||
| pub const fn activation_height(&self) -> u64 { | ||
| self.activation_height | ||
| } | ||
|
|
||
| /// Returns the allowlisted caller addresses. | ||
| pub fn allowlist(&self) -> &[Address] { | ||
| &self.allowlist | ||
| } | ||
|
|
||
| /// Returns true if the allowlist is active at the given block number. | ||
| pub const fn is_active(&self, block_number: u64) -> bool { | ||
| block_number >= self.activation_height | ||
| } | ||
|
|
||
| /// Returns true if the caller is in the allowlist. | ||
| pub fn is_allowed(&self, caller: Address) -> bool { | ||
| if self.allowlist.is_empty() { | ||
| return true; | ||
| } | ||
| self.allowlist.binary_search(&caller).is_ok() | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.