Skip to content

Commit a91b2dc

Browse files
authored
Updated validator topology (#420)
1 parent 7c04a10 commit a91b2dc

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

common/client-libs/validator-client/src/models/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ pub mod mixmining;
1717
pub mod mixnode;
1818
mod node;
1919
pub mod topology;
20+
pub mod validators;

common/client-libs/validator-client/src/models/topology.rs

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
use crate::models::gateway::RegisteredGateway;
1616
use crate::models::mixnode::RegisteredMix;
17+
use crate::models::validators::ValidatorsOutput;
1718
use log::*;
1819
use serde::{Deserialize, Serialize};
1920
use std::convert::TryInto;
@@ -25,6 +26,7 @@ use topology::{MixLayer, NymTopology};
2526
pub struct Topology {
2627
pub mix_nodes: Vec<RegisteredMix>,
2728
pub gateways: Vec<RegisteredGateway>,
29+
pub validators: ValidatorsOutput,
2830
}
2931

3032
// changed from `TryInto`. reason being is that we should not fail entire topology
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2020 Nym Technologies SA
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
use serde::{Deserialize, Serialize};
16+
17+
#[derive(Clone, Debug, Deserialize, Serialize)]
18+
pub struct ValidatorsOutput {
19+
pub(crate) block_height: i64,
20+
pub(crate) validators: Vec<ValidatorOutput>,
21+
}
22+
23+
#[derive(Clone, Debug, Deserialize, Serialize)]
24+
pub(crate) struct ValidatorOutput {
25+
pub(crate) address: String,
26+
pub(crate) pub_key: String,
27+
pub(crate) proposer_priority: i64,
28+
pub(crate) voting_power: i64,
29+
}

0 commit comments

Comments
 (0)