-
Notifications
You must be signed in to change notification settings - Fork 365
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
refactor(sdk): Remove NetworkArg
+ Make functions that accept Network
methods of Network
#1598
Conversation
NetworkArg
+ Make functions that accept Network
methods of Network
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.
Nice!
pub enum Network { | ||
Devnet, | ||
Holesky, | ||
HoleskyStage, | ||
Mainnet, | ||
} | ||
|
||
impl Network { | ||
pub fn get_batcher_payment_service_address(&self) -> ethers::types::H160 { |
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.
Nit: pass by copy:
pub fn get_batcher_payment_service_address(&self) -> ethers::types::H160 { | |
pub fn get_batcher_payment_service_address(self) -> ethers::types::H160 { |
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.
Great catch! @Oppen
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.
Now that Custom(String, String)
it's no longer a good idea to pass by copy. That's also true for is_proof_verified
.
} | ||
} | ||
|
||
pub fn get_aligned_service_manager_address(&self) -> ethers::types::H160 { |
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.
Nit: pass by copy:
pub fn get_aligned_service_manager_address(&self) -> ethers::types::H160 { | |
pub fn get_aligned_service_manager_address(self) -> ethers::types::H160 { |
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.
Great catch! @Oppen
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.
- It would be better for NetworkArg, requiring clap in the SDK is a bit overkill
- There needs to be a way to use values that are not the default ones, so in case we lunch another network we can use it without changing the code (Either through a config where you load network names and addresses, or some different input, may need to think a bit this)
Maybe a |
pub const BATCHER_PAYMENT_SERVICE_ADDRESS_MAINNET: &str = | ||
"0xb0567184A52cB40956df6333510d6eF35B89C8de"; | ||
/// AlignedServiceManager | ||
pub const ALIGNED_SERVICE_MANAGER_DEVNET: &str = "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8"; |
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.
Shouldn't it be 0x851356ae760d987E095750cCeb3bC6014560891C
?
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.
addressed
pub const ALIGNED_SERVICE_MANAGER_HOLESKY: &str = "0x58F280BeBE9B34c9939C3C39e0890C81f163B623"; | ||
pub const ALIGNED_SERVICE_MANAGER_HOLESKY_STAGE: &str = | ||
"0x9C5231FC88059C086Ea95712d105A2026048c39B"; | ||
pub const ALIGNED_SERVICE_MANAGER_HOLESKY_MAINNET: &str = |
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.
pub const ALIGNED_SERVICE_MANAGER_HOLESKY_MAINNET: &str = | |
pub const ALIGNED_SERVICE_MANAGER_MAINNET: &str = |
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.
addressed
} | ||
let parts: Vec<&str> = s.split_whitespace().collect(); | ||
|
||
if parts.len() == 3 { |
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 also enforce custom
to be parts[0]
.
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.
addressed
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.
Should update documentation to add new custom
network parameter on docs/3_guides/0_submitting_proofs.md
We should also update |
For now the deployment of a custom network will be complete via stating "custom BATCHER_PAYMENT_SERVICE ALIGNED_SERVICE_MANAGER" in quotes. This solution is not ideal and we will discuss and implement a better solution in a follow up pr. |
70b2e30
to
413aada
Compare
Closing in favor of #1730 |
Important
Closed in favour of #1730
Refactor Network Arg
Description
Refactors the Network struct in the sdk to:
ValueEnum
and thus remove the need forNetworkArg
Network
and return addresses to be methods ofNetwork
.Type of change
Please delete options that are not relevant.
Checklist
testnet
, everything else tostaging