Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codechain/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

pub const DEFAULT_CONFIG_PATH: &'static str = "codechain/config/presets/config.dev.toml";
pub const DEFAULT_KEYS_PATH: &'static str = "keys";
pub const DEFAULT_NETWORK_ID: u64 = 0x11;
pub const DEFAULT_NETWORK_ID: u32 = 0x11;
4 changes: 2 additions & 2 deletions core/src/client/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl TestBlockChainClient {
let parcel = Parcel {
nonce: U256::zero(),
fee: U256::from(10),
network_id: 0u64,
network_id: 0,
action: Action::ChangeShardState {
transactions: vec![],
changes: vec![],
Expand Down Expand Up @@ -266,7 +266,7 @@ impl TestBlockChainClient {
let parcel = Parcel {
nonce: U256::zero(),
fee: U256::from(10),
network_id: 0u64,
network_id: 0,
action: Action::ChangeShardState {
transactions,
changes: vec![],
Expand Down
2 changes: 1 addition & 1 deletion core/src/miner/local_parcels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ mod tests {
changes: vec![],
signatures: vec![],
},
network_id: 0u64,
network_id: 0,
};
SignedParcel::new_with_sign(parcel, keypair.private())
}
Expand Down
5 changes: 3 additions & 2 deletions core/src/spec/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub struct CommonParams {
/// Maximum size of metadata.
pub max_metadata_size: usize,
/// Network id.
pub network_id: u64,
pub network_id: u32,
/// Minimum parcel cost.
pub min_parcel_cost: U256,
/// Maximum size of block body.
Expand All @@ -62,10 +62,11 @@ pub struct CommonParams {

impl From<cjson::spec::Params> for CommonParams {
fn from(p: cjson::spec::Params) -> Self {
let network_id: u64 = p.network_id.into();
Self {
max_extra_data_size: p.max_extra_data_size.into(),
max_metadata_size: p.max_metadata_size.into(),
network_id: p.network_id.into(),
network_id: network_id as u32,
min_parcel_cost: p.min_parcel_cost.into(),
max_body_size: p.max_body_size.into(),
snapshot_period: p.snapshot_period.into(),
Expand Down
4 changes: 2 additions & 2 deletions docs/parcel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ A parcel would look something like this:
pub struct Parcel {
pub nonce: U256,
pub fee: U256,
pub network_id: u64,
pub network_id: u32,
pub action: Action,
}

Expand All @@ -46,4 +46,4 @@ A parcel would look something like this:
}

The fee of the parcel would determine its priority, meaning, how quickly it gets processed. In addition, there is
also a minimum fee that can be set. The nonce property exists for the purpose of preventing replay attacks.
also a minimum fee that can be set. The nonce property exists for the purpose of preventing replay attacks.
2 changes: 1 addition & 1 deletion key/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub struct FullAddress {
}

impl FullAddress {
pub fn create_version0(network_id: u64, address: Address) -> Result<Self, Error> {
pub fn create_version0(network_id: u32, address: Address) -> Result<Self, Error> {
let network = match network_id {
// FIXME: 0x11 is the network id for SOLO
0x11 => Network::Mainnet,
Expand Down
4 changes: 2 additions & 2 deletions rpc/src/v1/impls/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ use super::super::traits::Account;

pub struct AccountClient {
account_provider: Arc<AccountProvider>,
network_id: u64,
network_id: u32,
}

impl AccountClient {
pub fn new(ap: &Arc<AccountProvider>, network_id: u64) -> Self {
pub fn new(ap: &Arc<AccountProvider>, network_id: u32) -> Self {
AccountClient {
account_provider: ap.clone(),
network_id,
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/v1/impls/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ where
}
}

fn get_network_id(&self) -> Result<u64> {
fn get_network_id(&self) -> Result<u32> {
Ok(self.client.common_params().network_id)
}

Expand Down
2 changes: 1 addition & 1 deletion rpc/src/v1/traits/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ build_rpc_trait! {

/// Return the network id that is used in this chain.
# [rpc(name = "chain_getNetworkId")]
fn get_network_id(&self) -> Result<u64>;
fn get_network_id(&self) -> Result<u32>;

/// Execute Transactions
# [rpc(name = "chain_executeTransactions")]
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/v1/types/parcel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct Parcel {
pub parcel_index: Option<usize>,
pub nonce: U256,
pub fee: U256,
pub network_id: u64,
pub network_id: u32,
pub action: Action,
pub hash: H256,
pub sig: Signature,
Expand Down
4 changes: 2 additions & 2 deletions spec/Parcel.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct Parcel {
expiration_time: Option<Timestamp>,
nonce: U256,
fee: U256,
network_id: u64,
network_id: u32,
action: Action,
}

Expand Down Expand Up @@ -68,7 +68,7 @@ enum Transaction {

```rust
AssetMint {
network_id: u64,
network_id: u32,
shard_id: u32,
metadata: String,
registrar: Option<Address>,
Expand Down
2 changes: 1 addition & 1 deletion state/src/impls/top_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ impl TopLevelState {
fn apply_action(
&mut self,
action: &Action,
network_id: &u64,
network_id: &u32,
fee_payer: &Address,
fee_payer_public: &Public,
) -> StateResult<ParcelInvoice> {
Expand Down
2 changes: 1 addition & 1 deletion types/src/parcel/parcel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub struct Parcel {
/// Amount of CCC to be paid as a cost for distributing this parcel to the network.
pub fee: U256,
/// Mainnet or Testnet
pub network_id: u64,
pub network_id: u32,

pub action: Action,
}
Expand Down
10 changes: 5 additions & 5 deletions types/src/transaction/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@ pub struct AssetTransferOutput {
pub enum Transaction {
#[serde(rename_all = "camelCase")]
CreateWorld {
network_id: u64,
network_id: u32,
shard_id: ShardId,
nonce: u64,
owners: Vec<Address>,
},
#[serde(rename_all = "camelCase")]
SetWorldOwners {
network_id: u64,
network_id: u32,
shard_id: ShardId,
world_id: WorldId,
nonce: u64,
owners: Vec<Address>,
},
#[serde(rename_all = "camelCase")]
AssetMint {
network_id: u64,
network_id: u32,
shard_id: ShardId,
metadata: String,
registrar: Option<Address>,
Expand All @@ -83,7 +83,7 @@ pub enum Transaction {
},
#[serde(rename_all = "camelCase")]
AssetTransfer {
network_id: u64,
network_id: u32,
burns: Vec<AssetTransferInput>,
inputs: Vec<AssetTransferInput>,
outputs: Vec<AssetTransferOutput>,
Expand Down Expand Up @@ -145,7 +145,7 @@ impl Transaction {
blake256(&*self.without_script().rlp_bytes())
}

pub fn network_id(&self) -> u64 {
pub fn network_id(&self) -> u32 {
match self {
Transaction::CreateWorld {
network_id,
Expand Down