Skip to content

Commit

Permalink
[vm] upgrade to release 1.2 (#2387)
Browse files Browse the repository at this point in the history
* [vm] upgrade to release 1.2
  - update rustc to 1.51
  - update x tool
  - update move prover
  • Loading branch information
guangyuz authored Apr 13, 2021
1 parent 452762d commit a23a8f7
Show file tree
Hide file tree
Showing 86 changed files with 650 additions and 677 deletions.
723 changes: 409 additions & 314 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions chain/api/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ pub enum ConnectBlockError {
VerifyBlockFailed(VerifyBlockField, Error),
}

#[allow(clippy::from_over_into)]
impl Into<ReputationChange> for &ConnectBlockError {
fn into(self) -> ReputationChange {
match self {
Expand Down
1 change: 1 addition & 0 deletions chain/api/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ impl ServiceRequest for ChainRequest {
type Response = Result<ChainResponse>;
}

#[allow(clippy::upper_case_acronyms)]
pub enum ChainResponse {
BlockTemplate(Box<BlockTemplate>),
Block(Box<Block>),
Expand Down
6 changes: 6 additions & 0 deletions chain/tests/test_block_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ fn product_a_block(branch: &BlockChain, miner: &AccountInfo, uncles: Vec<BlockHe
}

#[stest::test(timeout = 120)]
#[allow(clippy::vec_init_then_push)]
fn test_uncle() {
let (mut mock_chain, _, uncle_block_header) = gen_uncle();
let miner = mock_chain.miner();
Expand All @@ -224,6 +225,7 @@ fn test_uncle() {
}

#[stest::test(timeout = 120)]
#[allow(clippy::vec_init_then_push)]
fn test_uncle_exist() {
let (mut mock_chain, _, uncle_block_header) = gen_uncle();
let miner = mock_chain.miner().clone();
Expand All @@ -249,6 +251,7 @@ fn test_uncle_exist() {
}

#[stest::test(timeout = 120)]
#[allow(clippy::vec_init_then_push)]
fn test_uncle_son() {
let (mut mock_chain, mut fork_block_chain, _) = gen_uncle();
let miner = mock_chain.miner();
Expand All @@ -266,6 +269,7 @@ fn test_uncle_son() {
}

#[stest::test(timeout = 120)]
#[allow(clippy::vec_init_then_push)]
fn test_random_uncle() {
let (mut mock_chain, _, _) = gen_uncle();
let miner = mock_chain.miner();
Expand All @@ -279,6 +283,7 @@ fn test_random_uncle() {
}

#[stest::test(timeout = 480)]
#[allow(clippy::vec_init_then_push)]
fn test_switch_epoch() {
let (mut mock_chain, _, uncle_block_header) = gen_uncle();
let miner = mock_chain.miner().clone();
Expand Down Expand Up @@ -317,6 +322,7 @@ fn test_switch_epoch() {
}

#[stest::test(timeout = 480)]
#[allow(clippy::vec_init_then_push)]
fn test_uncle_in_diff_epoch() {
let (mut mock_chain, _, uncle_block_header) = gen_uncle();
let miner = mock_chain.miner().clone();
Expand Down
4 changes: 2 additions & 2 deletions cmd/starcoin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ starcoin-genesis = { path = "../../genesis" }
starcoin-resource-viewer = { path = "../../vm/resource-viewer" }
starcoin-service-registry = { path = "../../commons/service-registry" }
starcoin-move-explain = { path = "../../vm/move-explain" }
errmapgen = { git = "https://github.com/starcoinorg/diem", rev="f71f37c1b0ba5b24fa8c88893d3aa2adaf08a425" }
errmapgen = { git = "https://github.com/starcoinorg/diem", rev="bfd7b336d14858d288e908636853949693642bcf" }
network-api = {path = "../../network/api", package="network-api"}
starcoin-network-rpc-api = {path = "../../network-rpc/api"}
short-hex-str = { git = "https://github.com/starcoinorg/diem", rev="f71f37c1b0ba5b24fa8c88893d3aa2adaf08a425" }
short-hex-str = { git = "https://github.com/starcoinorg/diem", rev="bfd7b336d14858d288e908636853949693642bcf" }


[dev-dependencies]
Expand Down
2 changes: 2 additions & 0 deletions cmd/starcoin/src/chain/stat/tps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ use structopt::StructOpt;
/// Get stat of tps for an epoch.
#[derive(Debug, StructOpt)]
#[structopt(name = "tps")]
#[allow(clippy::upper_case_acronyms)]
pub struct TPSOpt {}

#[allow(clippy::upper_case_acronyms)]
pub struct StatTPSCommand;

impl CommandAction for StatTPSCommand {
Expand Down
2 changes: 2 additions & 0 deletions cmd/starcoin/src/chain/tps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use structopt::StructOpt;
/// Get tps for an epoch.
#[derive(Debug, StructOpt)]
#[structopt(name = "tps")]
#[allow(clippy::upper_case_acronyms)]
pub struct TPSOpt {
#[structopt(
name = "number",
Expand All @@ -24,6 +25,7 @@ pub struct TPSOpt {
number: Option<BlockNumber>,
}

#[allow(clippy::upper_case_acronyms)]
pub struct TPSCommand;

impl CommandAction for TPSCommand {
Expand Down
5 changes: 2 additions & 3 deletions cmd/starcoin/src/chain/uncle/epoch_uncle_summary_by_number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ impl CommandAction for EpochUncleSummaryByNumberCommand {
&self,
ctx: &ExecContext<Self::State, Self::GlobalOpt, Self::Opt>,
) -> Result<Self::ReturnItem> {
Ok(ctx
.state()
ctx.state()
.client()
.epoch_uncle_summary_by_number(ctx.opt().number)?)
.epoch_uncle_summary_by_number(ctx.opt().number)
}
}
2 changes: 1 addition & 1 deletion cmd/starcoin/src/debug/txpool_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ impl CommandAction for TxPoolStatusCommand {
ctx: &ExecContext<Self::State, Self::GlobalOpt, Self::Opt>,
) -> Result<Self::ReturnItem> {
let client = ctx.state().client();
Ok(client.txpool_status()?)
client.txpool_status()
}
}
2 changes: 1 addition & 1 deletion cmd/starcoin/src/dev/get_coin_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@ impl CommandAction for GetCoinCommand {
if !opt.no_blocking {
ctx.state().watch_txn(id)?;
}
Ok(txn.try_into()?)
txn.try_into()
}
}
4 changes: 2 additions & 2 deletions cmd/starcoin/src/dev/sign_txn_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn get_dao_config(cli_state: &CliState) -> Result<DaoConfig> {
let client = cli_state.client();
let chain_state_reader = RemoteStateReader::new(client)?;
let account_state_reader = AccountStateReader::new(&chain_state_reader);
Ok(account_state_reader
account_state_reader
.get_on_chain_config::<DaoConfig>()?
.ok_or_else(|| format_err!("DaoConfig not exist on chain."))?)
.ok_or_else(|| format_err!("DaoConfig not exist on chain."))
}
2 changes: 1 addition & 1 deletion cmd/starcoin/src/txpool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ impl CommandAction for TxPoolStatusCommand {
ctx: &ExecContext<Self::State, Self::GlobalOpt, Self::Opt>,
) -> Result<Self::ReturnItem> {
let client = ctx.state().client();
Ok(client.txpool_status()?)
client.txpool_status()
}
}
2 changes: 1 addition & 1 deletion commons/accumulator/src/inmemory/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl InMemoryAccumulator {
current_num_leaves += remaining_new_leaves;
current_subtree_roots.extend(subtree_iter);

Ok(Self::new(current_subtree_roots, current_num_leaves)?)
Self::new(current_subtree_roots, current_num_leaves)
}

/// Returns the root hash of the accumulator.
Expand Down
1 change: 1 addition & 0 deletions commons/bcs_ext/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ where
bcs::from_bytes(bytes).map_err(|e| e.into())
}

#[allow(clippy::upper_case_acronyms)]
pub trait BCSCodec<'a>: Sized {
fn encode(&self) -> Result<Vec<u8>>;
fn decode(bytes: &'a [u8]) -> Result<Self>;
Expand Down
4 changes: 2 additions & 2 deletions commons/crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ serde = { version = "1.0.125" }
serde_bytes = "0.11.5"
hex = "0.4.3"
anyhow = "1.0"
diem-crypto = { package="diem-crypto", git = "https://github.com/starcoinorg/diem", rev="f71f37c1b0ba5b24fa8c88893d3aa2adaf08a425", features = ["fuzzing"] }
diem-crypto-derive = { package="diem-crypto-derive", git = "https://github.com/starcoinorg/diem", rev="f71f37c1b0ba5b24fa8c88893d3aa2adaf08a425" }
diem-crypto = { package="diem-crypto", git = "https://github.com/starcoinorg/diem", rev="bfd7b336d14858d288e908636853949693642bcf", features = ["fuzzing"] }
diem-crypto-derive = { package="diem-crypto-derive", git = "https://github.com/starcoinorg/diem", rev="bfd7b336d14858d288e908636853949693642bcf" }
bcs-ext = { package="bcs-ext", path = "../bcs_ext" }
crypto-macro = { package="starcoin-crypto-macro", path = "./crypto-macro"}
rand = "0.8.3"
Expand Down
3 changes: 3 additions & 0 deletions commons/crypto/src/multi_ed25519/multi_shard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ impl MultiEd25519KeyShard {

impl ValidCryptoMaterial for MultiEd25519KeyShard {
/// Serialize a MultiEd25519PrivateKeyShard.
#[allow(clippy::vec_init_then_push)]
fn to_bytes(&self) -> Vec<u8> {
let mut bytes: Vec<u8> = vec![];
bytes.push(self.public_keys.len() as u8);
Expand Down Expand Up @@ -320,6 +321,7 @@ impl MultiEd25519SignatureShard {
}
}

#[allow(clippy::from_over_into)]
impl Into<Vec<(Ed25519Signature, u8)>> for &MultiEd25519SignatureShard {
fn into(self) -> Vec<(Ed25519Signature, u8)> {
let signatures = self.signature.signatures();
Expand All @@ -339,6 +341,7 @@ impl Into<Vec<(Ed25519Signature, u8)>> for &MultiEd25519SignatureShard {
}
}

#[allow(clippy::from_over_into)]
impl Into<MultiEd25519Signature> for MultiEd25519SignatureShard {
fn into(self) -> MultiEd25519Signature {
self.signature
Expand Down
2 changes: 1 addition & 1 deletion commons/forkable-jellyfish-merkle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ where
} else {
// Else create the new leaf node with the same address but new blob content.
tree_cache.delete_node(&node_key, true /* is_leaf */);
return Ok(Self::create_leaf_node(key, blob, tree_cache)?);
return Self::create_leaf_node(key, blob, tree_cache);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ impl NaiveInternalNode {
BinaryTreeNode::new_internal(begin, width, left, right)
}

#[allow(clippy::vec_init_then_push)]
fn get_child_with_siblings(&self, n: u8) -> (Option<NodeKey>, Vec<HashValue>) {
let mut current_node = Rc::clone(&self.root);
let mut siblings = Vec::new();
Expand Down
1 change: 1 addition & 0 deletions commons/forkable-jellyfish-merkle/src/tree_cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ where
}
}

#[allow(clippy::from_over_into)]
impl<'a, R, K> Into<(Vec<HashValue>, TreeUpdateBatch<K>)> for TreeCache<'a, R, K>
where
R: 'a + TreeReader<K>,
Expand Down
2 changes: 1 addition & 1 deletion commons/logger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ pub fn init_with_default_level(
let config = build_config(arg.clone()).expect("build log config fail.");
let handle = match log4rs::init_config(config) {
Ok(handle) => handle,
Err(e) => panic!(e.to_string()),
Err(e) => panic!("{}", e.to_string()),
};
let logger_handle = LoggerHandle::new(arg, handle);

Expand Down
2 changes: 1 addition & 1 deletion commons/proptest-helpers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2018"

[dependencies]
crossbeam = "0.7.3"
diem-proptest-helpers = { package="diem-proptest-helpers", git = "https://github.com/starcoinorg/diem", rev="f71f37c1b0ba5b24fa8c88893d3aa2adaf08a425" }
diem-proptest-helpers = { package="diem-proptest-helpers", git = "https://github.com/starcoinorg/diem", rev="bfd7b336d14858d288e908636853949693642bcf" }

proptest = "1.0.0"
proptest-derive = "0.3.0"
1 change: 1 addition & 0 deletions commons/scmd/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use serde_json::{json, Value};
use std::str::FromStr;

#[derive(Copy, Clone, Debug)]
#[allow(clippy::upper_case_acronyms)]
pub enum OutputFormat {
JSON,
TABLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::collections::HashMap;
use std::sync::{Arc, Mutex};

#[derive(Default)]
#[allow(clippy::upper_case_acronyms)]
pub struct DB {
data: Mutex<HashMap<String, String>>,
}
Expand Down
2 changes: 1 addition & 1 deletion config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ starcoin-vm-types = { path = "../vm/types" }
starcoin-uint = { path = "../types/uint" }
network-p2p-types = { path = "../network-p2p/types"}
starcoin-logger = {path = "../commons/logger", package="starcoin-logger"}
diem-temppath = { git = "https://github.com/starcoinorg/diem", rev="f71f37c1b0ba5b24fa8c88893d3aa2adaf08a425" }
diem-temppath = { git = "https://github.com/starcoinorg/diem", rev="bfd7b336d14858d288e908636853949693642bcf" }
starcoin-system = {path = "../commons/system", package="starcoin-system"}
network-api = {path = "../network/api", package="network-api"}
stdlib = { path = "../vm/stdlib"}
3 changes: 3 additions & 0 deletions config/src/genesis_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ use std::sync::Arc;
Serialize,
)]
#[repr(u8)]
#[allow(clippy::upper_case_acronyms)]
pub enum BuiltinNetworkID {
/// A ephemeral network just for unit test.
Test = 255,
Expand Down Expand Up @@ -195,6 +196,7 @@ impl From<BuiltinNetworkID> for ChainNetwork {
}

#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[allow(clippy::upper_case_acronyms)]
pub struct CustomNetworkID {
chain_name: String,
chain_id: ChainId,
Expand Down Expand Up @@ -238,6 +240,7 @@ impl FromStr for CustomNetworkID {
}

#[derive(Clone, Debug, PartialEq)]
#[allow(clippy::upper_case_acronyms)]
pub enum ChainNetworkID {
Builtin(BuiltinNetworkID),
Custom(CustomNetworkID),
Expand Down
1 change: 1 addition & 0 deletions config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ where
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[allow(clippy::upper_case_acronyms)]
pub enum Connect {
/// Connect by ipc file path, if Path is absent, use default ipc file.
IPC(Option<PathBuf>),
Expand Down
1 change: 1 addition & 0 deletions config/src/network_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ impl FromStr for Seeds {
Ok(Seeds(seeds))
}
}
#[allow(clippy::from_over_into)]
impl Into<Vec<MultiaddrWithPeerId>> for Seeds {
fn into(self) -> Vec<MultiaddrWithPeerId> {
self.0
Expand Down
1 change: 1 addition & 0 deletions config/src/rpc_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ impl ListenAddress {
}
}

#[allow(clippy::from_over_into)]
impl Into<SocketAddr> for ListenAddress {
fn into(self) -> SocketAddr {
SocketAddr::new(self.address, self.port)
Expand Down
8 changes: 4 additions & 4 deletions devtools/x/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ globset = "0.4.6"
regex = "1.4.3"
rayon = "1.5.0"
indexmap = "1.6.2"
x-core = { package="x-core", git = "https://github.com/starcoinorg/diem", rev="f71f37c1b0ba5b24fa8c88893d3aa2adaf08a425" }
x-lint = { package="x-lint", git = "https://github.com/starcoinorg/diem", rev="f71f37c1b0ba5b24fa8c88893d3aa2adaf08a425" }
diem-workspace-hack = { package="diem-workspace-hack", git = "https://github.com/starcoinorg/diem", rev="f71f37c1b0ba5b24fa8c88893d3aa2adaf08a425" }
diem-x = { package="x", git = "https://github.com/starcoinorg/diem", rev="f71f37c1b0ba5b24fa8c88893d3aa2adaf08a425" }
x-core = { package="x-core", git = "https://github.com/starcoinorg/diem", rev="bfd7b336d14858d288e908636853949693642bcf" }
x-lint = { package="x-lint", git = "https://github.com/starcoinorg/diem", rev="bfd7b336d14858d288e908636853949693642bcf" }
diem-workspace-hack = { package="diem-workspace-hack", git = "https://github.com/starcoinorg/diem", rev="bfd7b336d14858d288e908636853949693642bcf" }
diem-x = { package="x", git = "https://github.com/starcoinorg/diem", rev="bfd7b336d14858d288e908636853949693642bcf" }
8 changes: 8 additions & 0 deletions devtools/x/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ pub mod playground {
}
pub mod test;

pub mod nextest {
pub use diem_x::nextest::*;
}

pub mod cargo {
pub use diem_x::cargo::*;
}
Expand Down Expand Up @@ -105,6 +109,9 @@ enum Command {
#[structopt(name = "test")]
/// Run tests
Test(test::Args),
#[structopt(name = "nextest")]
/// Run tests with new test runner
Nextest(nextest::Args),
#[structopt(name = "tools")]
/// Run tests
Tools(tools::Args),
Expand Down Expand Up @@ -148,6 +155,7 @@ fn main() -> Result<()> {
match args.cmd {
Command::Tools(args) => tools::run(args, xctx),
Command::Test(args) => test::run(args, xctx),
Command::Nextest(args) => nextest::run(args, xctx),
Command::Build(args) => build::run(args, xctx),
Command::ChangedSince(args) => changed_since::run(args, xctx),
Command::Check(args) => check::run(args, xctx),
Expand Down
Loading

0 comments on commit a23a8f7

Please sign in to comment.