fe6c685ab1
* Rename function/variables mixnodes->set * Stub utility interface * Rewarded set contract interface * Move epoch to common, epoch to contract * Move epoch to the chain * Rewarded set validator-api * [ci skip] Generate TS types * Epoch queries * Moved new code to a new module * Restored cosmwasm dependencies to their beta.3 versions for better compatibility with the rest of the codebase * Rewarded set write reorganisation * Stub for validator api module responsible for rewarded set updates * Reorganised validator api cache * Pending contract changes * Relevant updates to the validator client * Updating rewarded set based on contract state * Advancing/Setting current epoch in the contract * Using blocktime as 'now' at startup * Adjusted validator-api side rewarding code * Contract cleanup + query for epoch rewarded set heights * [ci skip] Generate TS types * Simplified rewarder processing loop and initial sync * [ci skip] Generate TS types * Fixed EXISTING query-related unit tests * Fixed existing unit tests for rewarding-related transactions * Cargo fmt * Removed some dead code * Using cosmwasm 1.0.0-beta3 for compatibility [with cw-storage-plus and rest of codebase] * Missing TryInto import * Additional storage and query related unit tests + a bug fix * Transaction-related unit tests + bug fixes * Required migration code * Update common/cosmwasm-smart-contracts/mixnet-contract/src/msg.rs Co-authored-by: Drazen Urch <drazen@urch.eu> * Update common/cosmwasm-smart-contracts/mixnet-contract/src/msg.rs Co-authored-by: Drazen Urch <drazen@urch.eu> * Constant renaming * Changed determining previous epoch return type to Option<Epoch> if they would precede the genesis * Exposed the new endpoint to the wallet * Epoch-related unit tests fixes * Recommended #[must_use] on next_epoch method * Renamed all epoch occurences to interval As they refer to the 'rewarding interval' Co-authored-by: Jędrzej Stuczyński <jedrzej.stuczynski@gmail.com> Co-authored-by: jstuczyn <jstuczyn@users.noreply.github.com>
51 lines
1.6 KiB
Rust
51 lines
1.6 KiB
Rust
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
use rocket::fairing::AdHoc;
|
|
use std::time::Duration;
|
|
|
|
pub(crate) mod local_guard;
|
|
pub(crate) mod models;
|
|
pub(crate) mod routes;
|
|
pub(crate) mod uptime_updater;
|
|
pub(crate) mod utils;
|
|
|
|
pub(crate) const FIFTEEN_MINUTES: Duration = Duration::from_secs(900);
|
|
pub(crate) const ONE_HOUR: Duration = Duration::from_secs(3600);
|
|
pub(crate) const ONE_DAY: Duration = Duration::from_secs(86400);
|
|
|
|
pub(crate) fn stage_full() -> AdHoc {
|
|
AdHoc::on_ignite("Node Status API Stage", |rocket| async {
|
|
rocket.mount(
|
|
"/v1/status",
|
|
routes![
|
|
routes::mixnode_report,
|
|
routes::gateway_report,
|
|
routes::mixnode_uptime_history,
|
|
routes::gateway_uptime_history,
|
|
routes::mixnode_core_status_count,
|
|
routes::gateway_core_status_count,
|
|
routes::get_mixnode_status,
|
|
routes::get_mixnode_reward_estimation,
|
|
routes::get_mixnode_stake_saturation,
|
|
routes::get_mixnode_inclusion_probability,
|
|
],
|
|
)
|
|
})
|
|
}
|
|
|
|
// in the minimal variant we would not have access to endpoints relying on existence
|
|
// of the network monitor and the associated storage
|
|
pub(crate) fn stage_minimal() -> AdHoc {
|
|
AdHoc::on_ignite("Node Status API Stage", |rocket| async {
|
|
rocket.mount(
|
|
"/v1/status",
|
|
routes![
|
|
routes::get_mixnode_status,
|
|
routes::get_mixnode_stake_saturation,
|
|
routes::get_mixnode_inclusion_probability,
|
|
],
|
|
)
|
|
})
|
|
}
|