-
Notifications
You must be signed in to change notification settings - Fork 3
feat(via_verifier): separate the verifier task from the withdrawal task #301
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -4,4 +4,5 @@ use serde::{Deserialize, Serialize}; | |
| pub enum ViaNodeRole { | ||
| Verifier, | ||
| Coordinator, | ||
| VerifierAndProcessor, | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,22 +27,22 @@ pub struct ViaVerifierConfig { | |
| pub poll_interval: u64, | ||
|
|
||
| /// Port to which the coordinator server is listening. | ||
| pub coordinator_port: u16, | ||
| pub coordinator_port: Option<u16>, | ||
|
|
||
| /// The coordinator url. | ||
| pub coordinator_http_url: String, | ||
| pub coordinator_http_url: Option<String>, | ||
|
|
||
| /// Verifier Request Timeout (in seconds) | ||
| pub verifier_request_timeout: u8, | ||
| pub verifier_request_timeout: Option<u8>, | ||
|
|
||
| /// The verifier btc wallet address. | ||
| pub wallet_address: String, | ||
| pub wallet_address: Option<String>, | ||
|
|
||
| /// The bridge address merkle root. | ||
| pub bridge_address_merkle_root: Option<String>, | ||
|
|
||
| /// The session timeout. | ||
| pub session_timeout: u64, | ||
| pub session_timeout: Option<u64>, | ||
|
|
||
| /// Transaction weight limit. | ||
| pub max_tx_weight: Option<u64>, | ||
|
|
@@ -54,13 +54,16 @@ impl ViaVerifierConfig { | |
| } | ||
|
|
||
| pub fn wallet_address(&self) -> anyhow::Result<Address> { | ||
| Ok(Address::from_str(&self.wallet_address)?.assume_checked()) | ||
| Ok(Address::from_str(&self.wallet_address.clone().unwrap())?.assume_checked()) | ||
| } | ||
|
Comment on lines
56
to
58
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. Calling pub fn wallet_address(&self) -> anyhow::Result<Address> {
let address = self.wallet_address.as_ref().context("wallet_address is not set in ViaVerifierConfig")?;
Ok(Address::from_str(address)?.assume_checked())
} |
||
| } | ||
|
|
||
| impl ViaVerifierConfig { | ||
| pub fn bind_addr(&self) -> SocketAddr { | ||
| SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), self.coordinator_port) | ||
| SocketAddr::new( | ||
| IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), | ||
| self.coordinator_port(), | ||
| ) | ||
| } | ||
|
|
||
| pub fn max_tx_weight(&self) -> u64 { | ||
|
|
@@ -72,15 +75,31 @@ impl ViaVerifierConfig { | |
| .unwrap_or((MAX_STANDARD_TX_WEIGHT - 20000).into()) | ||
| } | ||
|
|
||
| pub fn coordinator_port(&self) -> u16 { | ||
| self.coordinator_port.unwrap_or_default() | ||
| } | ||
|
Comment on lines
+78
to
+80
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. Using pub fn coordinator_port(&self) -> u16 {
self.coordinator_port.expect("coordinator_port is not set in ViaVerifierConfig")
} |
||
|
|
||
| pub fn coordinator_http_url(&self) -> String { | ||
| self.coordinator_http_url.clone().unwrap_or_default() | ||
| } | ||
|
Comment on lines
+82
to
+84
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. Using pub fn coordinator_http_url(&self) -> String {
self.coordinator_http_url.clone().expect("coordinator_http_url is not set in ViaVerifierConfig")
} |
||
|
|
||
| pub fn verifier_request_timeout(&self) -> u8 { | ||
| self.verifier_request_timeout.unwrap_or(60) | ||
| } | ||
|
|
||
| pub fn session_timeout(&self) -> u64 { | ||
| self.session_timeout.unwrap_or(300) | ||
| } | ||
|
|
||
| pub fn for_tests() -> Self { | ||
| Self { | ||
| role: ViaNodeRole::Verifier, | ||
| poll_interval: 1000, | ||
| coordinator_http_url: "http://localhost:3000".into(), | ||
| coordinator_port: 3000, | ||
| verifier_request_timeout: 10, | ||
| wallet_address: "".into(), | ||
| session_timeout: 30, | ||
| coordinator_http_url: None, | ||
| coordinator_port: None, | ||
| verifier_request_timeout: None, | ||
| wallet_address: None, | ||
| session_timeout: None, | ||
| max_tx_weight: None, | ||
| bridge_address_merkle_root: None, | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| __imports__ = ["base", "l2-inits/via_verifier_1.init.env"] | ||
|
|
||
| [via_verifier] | ||
| # The verifier role. | ||
| role = "Verifier" | ||
|
|
||
| [via_btc_sender] | ||
| # The wallet used in the btc sender. | ||
| private_key = "cNgSiSJnL76tCs2gFdXeLMC2CcB553qThyVnodbgyjFFYtb4NLT6" | ||
| wallet_address = "bcrt1qynr9a3cxue43kluh0v2yaxp4cyhfanna7se755" |
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 comment for
via-restart-verifier-1seems to be a copy-paste fromvia-verifier-1and doesn't reflect that it's a restart command. Additionally, a restart command typically shouldn't runinit(which is part of thebasetarget). For consistency withvia-restart-verifier, it would be better to useenv-softwhich is more appropriate for a restart operation.