Skip to content

Commit

Permalink
feat: add indication related definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
raindust committed Feb 27, 2024
1 parent 04e6333 commit b5b030f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
2 changes: 2 additions & 0 deletions codecs/runtime-codec/proto/tokenstate-provider.proto
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,13 @@ message StatePing {
Checkpoint checkpoint = 1;
ExecCursor execCursor = 2;
replica.ValidatorsState validatorsState = 3;
bytes indicatorsData = 4;
}
message StatePong {
Checkpoint checkpoint = 1;
ExecCursor execCursor = 2;
replica.ValidatorsState validatorsState = 3;
bytes indicatorsData = 4;
}
message Checkpoint {
int64 timestamp = 1;
Expand Down
26 changes: 25 additions & 1 deletion codecs/runtime-codec/src/vmh/env.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::solc::ContractAddresses;
use crate::tapp::seat::SeatId;
use crate::tapp::Hash;
use crate::tapp::{Hash, TimestampShort};
use crate::vmh::error::VmhGeneralErrors;
use crate::vmh::io::RegistryKey;
use crate::vmh::{
Expand Down Expand Up @@ -93,6 +93,30 @@ pub enum AppCommand {
Version,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum EnvIndication {
Chrony(ChronyTracking),
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ChronyTracking {
pub reference_id: u32,
pub ip_addr: String,
pub stratum: u16,
pub ref_time: String,
/// system time relative to NTP server
pub system_time: f64,
pub last_offset: f64,
pub rms_offset: f64,
pub frequency_ppm: f64,
pub residual_freq: f64,
pub skew_ppm: f64,
pub root_delay: f64,
pub root_dispersion: f64,
pub last_update_interval: f64,
pub leap_status: String,
}

impl std::fmt::Display for AppCommand {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Expand Down
2 changes: 2 additions & 0 deletions codecs/runtime-codec/src/vmh/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ pub enum RegistryKey {
ThirdApiOutbound,

NitroOutbound,

EnvInbound,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down
10 changes: 10 additions & 0 deletions system-actors/src/env/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use tea_codec::pricing::Priced;
use tea_codec::serde::TypeId;
use tea_runtime_codec::solc::{BlockNumber, ContractAddresses};
use tea_runtime_codec::tapp::Hash;
use tea_runtime_codec::vmh::env::ChronyTracking;
use tea_runtime_codec::vmh::io::VersionInfo;

/// Actor name for env native actor.
Expand Down Expand Up @@ -228,6 +229,15 @@ pub struct RuntimeInitializedRequest;
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct RuntimeInitializedResponse(pub bool);

#[doc(hidden)]
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
pub struct ChronyTrackingRequest;

#[doc(hidden)]
#[derive(Debug, Clone, Serialize, Deserialize, TypeId)]
pub struct ChronyTrackingResponse(pub Option<ChronyTracking>);

#[doc(hidden)]
#[derive(Debug, Clone, Serialize, Deserialize, TypeId, Priced)]
#[price(10000)]
Expand Down

0 comments on commit b5b030f

Please sign in to comment.