Auto-updater improvements (#8078)
* updater: refactor updater flow into state machine * updater: delay update randomly within max range * updater: configurable update delay * updater: split polling and updater state machine step * updater: drop state to avoid deadlocking * updater: fix fetch backoff * updater: fix overflow in update delay calculation * updater: configurable update check frequency * updater: fix update policy frequency comparison * updater: use lazy_static for platform and platform_id_hash * updater: refactor operations contract calls into OperationsClient * updater: make updater generic over operations and fetch client * updater: fix compilation * updater: add testing infrastructure and minimal test * updater: fix minor grumbles * updater: add test for successful updater flow * updater: add test for update delay * updater: add test for update check frequency * updater: mock time and rng for deterministic tests * updater: test backoff on failure * updater: add test for backoff short-circuit on new release * updater: refactor to increase readability * updater: cap maximum backoff to one month * updater: add test for detecting already downloaded update * updater: add test for updater disable on fatal errors * updater: add test for pending outdated fetch * updater: test auto install of updates * updater: add test for capability updates * updater: fix capability update * updater: use ethabi to create event topic filter * updater: decrease maximum backoff to 1 day * updater: cap maximum update delay with upcoming fork block number * updater: receive state mutex guard in updater_step * updater: overload execute_upgrade to take state mutex guard * updater: remove unnecessary clone of latest operations info * updater: remove latest operations info clone when triggering fetch
This commit is contained in:
@@ -280,6 +280,14 @@ usage! {
|
||||
"--auto-update=[SET]",
|
||||
"Set a releases set to automatically update and install. SET can be one of: all - All updates in the our release track; critical - Only consensus/security updates; none - No updates will be auto-installed.",
|
||||
|
||||
ARG arg_auto_update_delay: (u16) = 100u16, or |c: &Config| c.parity.as_ref()?.auto_update_delay.clone(),
|
||||
"--auto-update-delay=[NUM]",
|
||||
"Specify the maximum number of blocks used for randomly delaying updates.",
|
||||
|
||||
ARG arg_auto_update_check_frequency: (u16) = 20u16, or |c: &Config| c.parity.as_ref()?.auto_update_check_frequency.clone(),
|
||||
"--auto-update-check-frequency=[NUM]",
|
||||
"Specify the number of blocks between each auto-update check.",
|
||||
|
||||
ARG arg_release_track: (String) = "current", or |c: &Config| c.parity.as_ref()?.release_track.clone(),
|
||||
"--release-track=[TRACK]",
|
||||
"Set which release track we should use for updates. TRACK can be one of: stable - Stable releases; beta - Beta releases; nightly - Nightly releases (unstable); testing - Testing releases (do not use); current - Whatever track this executable was released on.",
|
||||
@@ -1012,6 +1020,8 @@ struct Operating {
|
||||
mode_timeout: Option<u64>,
|
||||
mode_alarm: Option<u64>,
|
||||
auto_update: Option<String>,
|
||||
auto_update_delay: Option<u16>,
|
||||
auto_update_check_frequency: Option<u16>,
|
||||
release_track: Option<String>,
|
||||
public_node: Option<bool>,
|
||||
no_download: Option<bool>,
|
||||
@@ -1454,6 +1464,8 @@ mod tests {
|
||||
arg_mode_timeout: 300u64,
|
||||
arg_mode_alarm: 3600u64,
|
||||
arg_auto_update: "none".into(),
|
||||
arg_auto_update_delay: 200u16,
|
||||
arg_auto_update_check_frequency: 50u16,
|
||||
arg_release_track: "current".into(),
|
||||
flag_public_node: false,
|
||||
flag_no_download: false,
|
||||
@@ -1711,6 +1723,8 @@ mod tests {
|
||||
mode_timeout: Some(15u64),
|
||||
mode_alarm: Some(10u64),
|
||||
auto_update: None,
|
||||
auto_update_delay: None,
|
||||
auto_update_check_frequency: None,
|
||||
release_track: None,
|
||||
public_node: None,
|
||||
no_download: None,
|
||||
|
||||
Reference in New Issue
Block a user