New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[types] add ChainID to user txn #4969
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ use libra_secure_storage::{CryptoStorage, KVStorage, Storage, Value}; | |
use libra_secure_time::{RealTimeService, TimeService}; | ||
use libra_types::{ | ||
account_address::{self, AccountAddress}, | ||
chain_id::ChainId, | ||
transaction::{RawTransaction, SignedTransaction, Transaction}, | ||
}; | ||
use std::{convert::TryFrom, time::Duration}; | ||
|
@@ -38,6 +39,8 @@ pub struct ValidatorConfig { | |
fullnode_address: NetworkAddress, | ||
#[structopt(flatten)] | ||
backends: SecureBackends, | ||
#[structopt(long)] | ||
chain_id: ChainId, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is quite right, as it's essentially setting a chainID on a single transaction used during the genesis process (this transaction is submitted by each validator operator). Instead, my feeling is that we'll probably want to have the association determine the ID and set it in genesis once, before bootstrapping the network. However, from reading the comments it seems like there's still a lot of on-going discussions about how this should actually work.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (If this is something that the association is going to decide at genesis, we may want to setup a sync with @davidiw, to figure out the best place to do this for the management tool) |
||
} | ||
|
||
impl ValidatorConfig { | ||
|
@@ -122,6 +125,7 @@ impl ValidatorConfig { | |
constants::GAS_UNIT_PRICE, | ||
constants::GAS_CURRENCY_CODE.to_owned(), | ||
Duration::from_secs(expiration_time), | ||
self.chain_id, | ||
); | ||
let signature = local_storage | ||
.sign(OPERATOR_KEY, &raw_transaction) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::config::{Error, LoggerConfig, PersistableConfig, SecureBackend}; | ||
use libra_types::chain_id::{self, ChainId}; | ||
use serde::{Deserialize, Serialize}; | ||
use std::path::{Path, PathBuf}; | ||
|
||
|
@@ -21,6 +22,8 @@ pub struct KeyManagerConfig { | |
pub secure_backend: SecureBackend, | ||
pub sleep_period_secs: u64, | ||
pub txn_expiration_secs: u64, | ||
#[serde(deserialize_with = "chain_id::deserialize_config_chain_id")] | ||
pub chain_id: ChainId, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
impl Default for KeyManagerConfig { | ||
|
@@ -32,6 +35,7 @@ impl Default for KeyManagerConfig { | |
secure_backend: SecureBackend::InMemoryStorage, | ||
sleep_period_secs: DEFAULT_SLEEP_PERIOD_SECS, | ||
txn_expiration_secs: DEFAULT_TXN_EXPIRATION_SECS, | ||
chain_id: ChainId::test(), | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1058,6 +1058,14 @@ User submitted transaction. | |||||
<td>Sequence number of this transaction corresponding to sender's account | ||||||
</td> | ||||||
</tr> | ||||||
<tr> | ||||||
<td>chain_id | ||||||
</td> | ||||||
<td>u64 | ||||||
</td> | ||||||
<td>Chain ID of the network this transaction is intended for | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
</td> | ||||||
</tr> | ||||||
<tr> | ||||||
<td>max_gas_amount | ||||||
</td> | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.