Skip to content

Commit

Permalink
changed behaviour of egress node validitiy
Browse files Browse the repository at this point in the history
  • Loading branch information
jstuczyn committed Jan 16, 2025
1 parent 5861f95 commit 9437da6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
1 change: 0 additions & 1 deletion common/client-core/config-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,6 @@ pub struct Topology {

/// Specifies whether this client should attempt to retrieve all available network nodes
/// as opposed to just active mixnodes/gateways.
/// Useless without `ignore_epoch_roles = true`
pub use_extended_topology: bool,

/// Specifies whether this client should ignore the current epoch role of the target egress node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ impl Role {
pub fn is_standby(&self) -> bool {
matches!(self, Role::Standby)
}

pub fn is_mixnode(&self) -> bool {
matches!(self, Role::Layer1 | Role::Layer2 | Role::Layer3)
}
}

impl Display for Role {
Expand Down
19 changes: 8 additions & 11 deletions common/topology/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,20 +401,17 @@ impl NymTopology {
});
};

// a 'valid' egress is one assigned to either entry role (i.e. entry for another client)
// or exit role (as a service provider)
// a 'valid' egress is one that is currently **not** acting as a mixnode
if !ignore_epoch_roles {
let Some(role) = self.rewarded_set.role(node.node_id) else {
return Err(NymTopologyError::InvalidEgressRole {
node_identity: Box::new(node_identity),
});
};
if !matches!(role, Role::EntryGateway | Role::ExitGateway) {
return Err(NymTopologyError::InvalidEgressRole {
node_identity: Box::new(node_identity),
});
if let Some(role) = self.rewarded_set.role(node.node_id) {
if role.is_mixnode() {
return Err(NymTopologyError::InvalidEgressRole {
node_identity: Box::new(node_identity),
});
}
}
}

Ok(node)
}

Expand Down
1 change: 0 additions & 1 deletion common/wasm/client-core/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ pub struct TopologyWasm {

/// Specifies whether this client should attempt to retrieve all available network nodes
/// as opposed to just active mixnodes/gateways.
/// Useless without `ignore_epoch_roles = true`
pub use_extended_topology: bool,

/// Specifies whether this client should ignore the current epoch role of the target egress node
Expand Down
1 change: 0 additions & 1 deletion common/wasm/client-core/src/config/override.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ pub struct TopologyWasmOverride {

/// Specifies whether this client should attempt to retrieve all available network nodes
/// as opposed to just active mixnodes/gateways.
/// Useless without `ignore_epoch_roles = true`
#[tsify(optional)]
pub use_extended_topology: Option<bool>,

Expand Down

0 comments on commit 9437da6

Please sign in to comment.