Skip to content

Commit

Permalink
Change Stake type to u64 (MystenLabs/narwhal#969)
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfind authored Sep 13, 2022
1 parent bc3ade0 commit e962cac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion narwhal/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub trait Export: Serialize {

impl<S: Serialize> Export for S {}

pub type Stake = u32;
pub type Stake = u64;
pub type WorkerId = u32;

/// Holds all the node properties. An example is provided to
Expand Down
2 changes: 1 addition & 1 deletion narwhal/node/tests/staged/narwhal.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
Authority:
STRUCT:
- stake: U32
- stake: U64
- primary_address: BYTES
- network_key:
TYPENAME: Ed25519PublicKey
Expand Down
5 changes: 3 additions & 2 deletions narwhal/primary/src/grpc_server/configuration.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use config::SharedCommittee;

use config::{SharedCommittee, Stake};
use crypto::PublicKey;
use fastcrypto::traits::ToFromBytes;
use multiaddr::Multiaddr;
Expand Down Expand Up @@ -98,7 +99,7 @@ impl Configuration for NarwhalConfiguration {
for validator in validators.iter() {
let public_key = self.get_public_key(validator.public_key.as_ref())?;

let stake_weight: u32 = validator
let stake_weight: Stake = validator
.stake_weight
.try_into()
.map_err(|_| Status::invalid_argument("Invalid stake weight"))?;
Expand Down

0 comments on commit e962cac

Please sign in to comment.