diff --git a/Cargo.lock b/Cargo.lock index 76d53a4e80..535327bd7d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9787,7 +9787,7 @@ version = "0.1.0" [[package]] name = "starcoin-language-e2e-tests" -version = "1.13.5" +version = "1.13.7" dependencies = [ "anyhow", "bcs", @@ -10782,7 +10782,7 @@ dependencies = [ [[package]] name = "starcoin-transaction-benchmarks" -version = "1.13.5" +version = "1.13.7" dependencies = [ "criterion", "criterion-cpu-time", diff --git a/cmd/starcoin/src/dev/concurrency_level_cmd.rs b/cmd/starcoin/src/dev/concurrency_level_cmd.rs index 9a307f3c08..fca24958e7 100644 --- a/cmd/starcoin/src/dev/concurrency_level_cmd.rs +++ b/cmd/starcoin/src/dev/concurrency_level_cmd.rs @@ -11,21 +11,24 @@ use starcoin_logger::prelude::*; /// concurrency_level command option #[derive(Debug, Parser)] -#[clap(name = "concurrency_level")] -pub struct ConcurrencyLevelCommandOpt { +#[clap(name = "set_concurrency_level")] +pub struct SetConcurrencyLevelCommandOpt { #[clap(name = "level", help = "set vm concurrency_level")] level: usize, } -pub struct ConcurrencyLevelCommand; +pub struct SetConcurrencyLevelCommand; -impl CommandAction for ConcurrencyLevelCommand { +impl CommandAction for SetConcurrencyLevelCommand { type State = CliState; type GlobalOpt = StarcoinOpt; - type Opt = ConcurrencyLevelCommandOpt; + type Opt = SetConcurrencyLevelCommandOpt; type ReturnItem = String; - fn run(&self, ctx: &ExecContext) -> Result { + fn run( + &self, + ctx: &ExecContext, + ) -> Result { let opt = ctx.opt(); let client = ctx.state().client(); let concurrency_level = std::cmp::min(opt.level, num_cpus::get()); @@ -34,3 +37,27 @@ impl CommandAction for ConcurrencyLevelCommand { Ok(format!("set concurrency_level to {}", concurrency_level)) } } + +/// get_concurrency_level command option +#[derive(Debug, Parser)] +#[clap(name = "get_concurrency_level")] +pub struct GetConcurrencyLevelCommandOpt; + +pub struct GetConcurrencyLevelCommand; + +impl CommandAction for GetConcurrencyLevelCommand { + type State = CliState; + type GlobalOpt = StarcoinOpt; + type Opt = GetConcurrencyLevelCommandOpt; + type ReturnItem = String; + + fn run( + &self, + ctx: &ExecContext, + ) -> Result { + let client = ctx.state().client(); + let level = client.get_concurrency_level()?; + info!("client get vm concurrency_level {}", level); + Ok(format!("get concurrency_level is {}", level)) + } +} diff --git a/cmd/starcoin/src/lib.rs b/cmd/starcoin/src/lib.rs index 7fa6173e33..7b6a9c367f 100644 --- a/cmd/starcoin/src/lib.rs +++ b/cmd/starcoin/src/lib.rs @@ -142,7 +142,8 @@ pub fn add_command( .subcommand(dev::panic_cmd::PanicCommand) .subcommand(dev::sleep_cmd::SleepCommand) .subcommand(dev::gen_block_cmd::GenBlockCommand) - .subcommand(dev::ConcurrencyLevelCommand), + .subcommand(dev::SetConcurrencyLevelCommand) + .subcommand(dev::GetConcurrencyLevelCommand), ) .command(CustomCommand::with_name("contract").subcommand(contract::GetContractDataCommand)) } diff --git a/network/src/service.rs b/network/src/service.rs index 800de2f9e6..e4478f5a03 100644 --- a/network/src/service.rs +++ b/network/src/service.rs @@ -40,7 +40,7 @@ use std::ops::RangeInclusive; use std::sync::Arc; const BARNARD_HARD_FORK_PEER_VERSION_STRING_PREFIX: &str = "barnard_rollback_block_fix"; -const BARNARD_HARD_FORK_VERSION: [i32; 3] = [1, 12, 9]; +const BARNARD_HARD_FORK_VERSION: [i32; 3] = [1, 13, 7]; pub struct NetworkActorService { /// Worker and inner have ChainInfo instances separately. There might be some way to solve the problem. @@ -926,11 +926,11 @@ mod test { assert!(!greater_barnard_fork_version(&v1)); let v2 = String::from("starcoin 1.13.0-alpha (build:halley-v1.13.1-alpha-dirty)"); assert!(!greater_barnard_fork_version(&v2)); - let v3 = String::from("starcoin/1.13.0-alpha (build:v1.13.0-alpha) (kele01)"); - assert!(greater_barnard_fork_version(&v3)); + let v3 = String::from("starcoin/1.13.7 (build:v1.13.7) (kele01)"); + assert!(!greater_barnard_fork_version(&v3)); let v4 = String::from("starcoin/1.12.9 (build:v1.12.9) (kele01)"); assert!(!greater_barnard_fork_version(&v4)); - let v5 = String::from("starcoin/1.13.1 (build:v1.13.1) (kele01)"); + let v5 = String::from("starcoin/1.13.7 (build:v1.13.8-alpha) (kele01)"); assert!(greater_barnard_fork_version(&v5)); } } diff --git a/rpc/api/generated_rpc_schema/debug.json b/rpc/api/generated_rpc_schema/debug.json index ae93623e02..86ee32dc6b 100644 --- a/rpc/api/generated_rpc_schema/debug.json +++ b/rpc/api/generated_rpc_schema/debug.json @@ -161,6 +161,20 @@ "type": "null" } } + }, + { + "name": "debug.get_concurrency_level", + "params": [], + "result": { + "name": "usize", + "schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint", + "type": "integer", + "format": "uint", + "minimum": 0.0 + } + } } ] } \ No newline at end of file diff --git a/rpc/api/src/debug/mod.rs b/rpc/api/src/debug/mod.rs index c0c72bf2b3..74f07d27fa 100644 --- a/rpc/api/src/debug/mod.rs +++ b/rpc/api/src/debug/mod.rs @@ -32,6 +32,10 @@ pub trait DebugApi { /// Update vm concurrency level, level = min(level, num_cpus::get) #[rpc(name = "debug.set_concurrency_level")] fn set_concurrency_level(&self, level: usize) -> Result<()>; + + /// Get vm concurrency level + #[rpc(name = "debug.get_concurrency_level")] + fn get_concurrency_level(&self) -> Result; } #[test] fn test() { diff --git a/rpc/client/src/lib.rs b/rpc/client/src/lib.rs index 6f3d748c59..7b610fa1bd 100644 --- a/rpc/client/src/lib.rs +++ b/rpc/client/src/lib.rs @@ -736,6 +736,11 @@ impl RpcClient { .map_err(map_err) } + pub fn get_concurrency_level(&self) -> anyhow::Result { + self.call_rpc_blocking(|inner| inner.debug_client.get_concurrency_level()) + .map_err(map_err) + } + pub fn chain_id(&self) -> anyhow::Result { self.call_rpc_blocking(|inner| inner.chain_client.id()) .map_err(map_err) diff --git a/rpc/server/src/module/debug_rpc.rs b/rpc/server/src/module/debug_rpc.rs index 493c94d8a6..83f1fcbe1e 100644 --- a/rpc/server/src/module/debug_rpc.rs +++ b/rpc/server/src/module/debug_rpc.rs @@ -88,4 +88,8 @@ impl DebugApi for DebugRpcImpl { StarcoinVM::set_concurrency_level_once(level); Ok(()) } + + fn get_concurrency_level(&self) -> Result { + Ok(StarcoinVM::get_concurrency_level()) + } } diff --git a/scripts/nextest.sh b/scripts/nextest.sh index d21856e042..4c79df0fe2 100755 --- a/scripts/nextest.sh +++ b/scripts/nextest.sh @@ -14,7 +14,7 @@ ulimit -a # install cargo-nextest echo "Setup cargo-nextest." -cargo nextest -V >/dev/null 2>&1 || cargo install cargo-nextest --locked +cargo nextest -V >/dev/null 2>&1 || cargo install cargo-nextest --version "0.9.57" --locked # following options are tuned for current self hosted CI machine # --test-threads 12, proper test concurrency level, balance failure rate and test speed diff --git a/vm/e2e-tests/Cargo.toml b/vm/e2e-tests/Cargo.toml index 5e9797088d..6d765b7d62 100644 --- a/vm/e2e-tests/Cargo.toml +++ b/vm/e2e-tests/Cargo.toml @@ -4,7 +4,7 @@ authors = { workspace = true } edition = { workspace = true } license = { workspace = true } publish = { workspace = true } -version = "1.13.5" +version = "1.13.7" homepage = { workspace = true } repository = { workspace = true } rust-version = { workspace = true } diff --git a/vm/transaction-benchmarks/Cargo.toml b/vm/transaction-benchmarks/Cargo.toml index 3ef153809f..91546f9e2b 100644 --- a/vm/transaction-benchmarks/Cargo.toml +++ b/vm/transaction-benchmarks/Cargo.toml @@ -4,7 +4,7 @@ authors = { workspace = true } edition = { workspace = true } license = { workspace = true } publish = { workspace = true } -version = "1.13.5" +version = "1.13.7" homepage = { workspace = true } repository = { workspace = true } rust-version = { workspace = true }