-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat(zk_inception): Add ecosystem ports scanner #2849
base: main
Are you sure you want to change the base?
Changes from 34 commits
3b55ab2
14a28ca
3f6702a
27c346c
5d300eb
1526dbe
c77a5a9
36df52b
0d15f96
861284d
c75dfe3
3712aee
cab60bb
a72fe5e
d4e4529
c1330c8
d30bae0
04c7bbe
2ada84f
27723d7
7f0623c
54aec19
c93d467
30e57c6
bf19838
8574c17
03682ee
26188f7
52f3c5e
28272c6
cffe123
b0a673f
c314a46
c36c1fc
2eb62c5
550c5e4
5175c07
934c187
7074c7f
c1525aa
91ab676
364229c
1415e2d
6c9494c
f3d97d6
f13ff46
00a934c
2405919
e174c3b
9ed7664
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
use std::str::FromStr; | ||
|
||
use clap::Parser; | ||
use common::{forge::ForgeScriptArgs, Prompt}; | ||
use config::ChainConfig; | ||
|
@@ -13,35 +11,10 @@ use crate::{ | |
defaults::LOCAL_RPC_URL, | ||
messages::{ | ||
MSG_DEPLOY_PAYMASTER_PROMPT, MSG_GENESIS_ARGS_HELP, MSG_L1_RPC_URL_HELP, | ||
MSG_L1_RPC_URL_INVALID_ERR, MSG_L1_RPC_URL_PROMPT, MSG_PORT_OFFSET_HELP, | ||
MSG_L1_RPC_URL_INVALID_ERR, MSG_L1_RPC_URL_PROMPT, MSG_NO_PORT_REALLOCATION_HELP, | ||
}, | ||
}; | ||
|
||
#[derive(Clone, Debug, Serialize, Deserialize)] | ||
pub struct PortOffset(u16); | ||
|
||
impl PortOffset { | ||
pub fn from_chain_id(chain_id: u16) -> Self { | ||
Self((chain_id - 1) * 100) | ||
} | ||
} | ||
|
||
impl FromStr for PortOffset { | ||
type Err = String; | ||
|
||
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
s.parse::<u16>() | ||
.map(PortOffset) | ||
.map_err(|_| "Invalid port offset".to_string()) | ||
} | ||
} | ||
|
||
impl From<PortOffset> for u16 { | ||
fn from(port_offset: PortOffset) -> Self { | ||
port_offset.0 | ||
} | ||
} | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, Parser)] | ||
pub struct InitArgs { | ||
/// All ethereum environment related arguments | ||
|
@@ -55,8 +28,8 @@ pub struct InitArgs { | |
pub deploy_paymaster: Option<bool>, | ||
#[clap(long, help = MSG_L1_RPC_URL_HELP)] | ||
pub l1_rpc_url: Option<String>, | ||
#[clap(long, help = MSG_PORT_OFFSET_HELP)] | ||
pub port_offset: Option<PortOffset>, | ||
#[clap(long, help = MSG_NO_PORT_REALLOCATION_HELP, default_missing_value = "true", num_args = 0..=1)] | ||
pub no_port_reallocation: Option<bool>, | ||
} | ||
|
||
impl InitArgs { | ||
|
@@ -81,15 +54,14 @@ impl InitArgs { | |
.ask() | ||
}); | ||
|
||
let no_port_reallocation = self.no_port_reallocation.unwrap_or(false); | ||
|
||
InitArgsFinal { | ||
forge_args: self.forge_args, | ||
genesis_args: self.genesis_args.fill_values_with_prompt(config), | ||
deploy_paymaster, | ||
l1_rpc_url, | ||
port_offset: self | ||
.port_offset | ||
.unwrap_or(PortOffset::from_chain_id(config.id as u16)) | ||
.into(), | ||
no_port_reallocation, | ||
} | ||
} | ||
} | ||
|
@@ -100,5 +72,5 @@ pub struct InitArgsFinal { | |
pub genesis_args: GenesisArgsFinal, | ||
pub deploy_paymaster: bool, | ||
pub l1_rpc_url: String, | ||
pub port_offset: u16, | ||
pub no_port_reallocation: bool, | ||
matias-gonz marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we add --no-ports-reallocation instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the use-case? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for devops team. |
||
} |
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.
do we still need them?
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.
These are used for default port + offset allocation