From cd9a96a6bb238deee7a1603b37c33d565d4e85eb Mon Sep 17 00:00:00 2001 From: nk_ysg Date: Tue, 12 Sep 2023 11:06:58 +0800 Subject: [PATCH 01/10] fix version num --- Cargo.lock | 4 ++-- vm/e2e-tests/Cargo.toml | 2 +- vm/transaction-benchmarks/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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/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 } From 8c9b3915f19b9981358b75e6a22277dc331bb1cc Mon Sep 17 00:00:00 2001 From: nk_ysg Date: Tue, 26 Sep 2023 17:24:06 +0800 Subject: [PATCH 02/10] update set concurrency level and get concurrency level --- cmd/starcoin/src/dev/concurrency_level_cmd.rs | 39 ++++++++++++++++--- cmd/starcoin/src/lib.rs | 3 +- network/src/service.rs | 2 +- rpc/api/generated_rpc_schema/debug.json | 14 +++++++ rpc/api/src/debug/mod.rs | 4 ++ rpc/client/src/lib.rs | 5 +++ rpc/server/src/module/debug_rpc.rs | 4 ++ 7 files changed, 63 insertions(+), 8 deletions(-) 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..ca8a77851b 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. 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()) + } } From fa59bc26ec9f91d526c10dfb03fb1ed2e1dc4eef Mon Sep 17 00:00:00 2001 From: nk_ysg Date: Tue, 26 Sep 2023 17:41:11 +0800 Subject: [PATCH 03/10] update nextest.sh --- scripts/nextest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nextest.sh b/scripts/nextest.sh index d21856e042..c8ce449421 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 # following options are tuned for current self hosted CI machine # --test-threads 12, proper test concurrency level, balance failure rate and test speed From e3d317e0df3283c353d6fe82604bded0cd5e761c Mon Sep 17 00:00:00 2001 From: nk_ysg Date: Tue, 26 Sep 2023 18:03:39 +0800 Subject: [PATCH 04/10] revert nextest.sh --- scripts/nextest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nextest.sh b/scripts/nextest.sh index c8ce449421..d21856e042 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 +cargo nextest -V >/dev/null 2>&1 || cargo install cargo-nextest --locked # following options are tuned for current self hosted CI machine # --test-threads 12, proper test concurrency level, balance failure rate and test speed From 1936d9822a49e358c1a91f625f53e7dae7d2895c Mon Sep 17 00:00:00 2001 From: nk_ysg Date: Tue, 26 Sep 2023 18:31:06 +0800 Subject: [PATCH 05/10] update nextest.sh --- scripts/nextest.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/nextest.sh b/scripts/nextest.sh index d21856e042..1a377a1649 100755 --- a/scripts/nextest.sh +++ b/scripts/nextest.sh @@ -14,6 +14,7 @@ ulimit -a # install cargo-nextest echo "Setup cargo-nextest." +cargo install clap --locked cargo nextest -V >/dev/null 2>&1 || cargo install cargo-nextest --locked # following options are tuned for current self hosted CI machine From 67e2f2bfcd29d71dc6f52515cfe17474d2754e8e Mon Sep 17 00:00:00 2001 From: nk_ysg Date: Tue, 26 Sep 2023 18:50:41 +0800 Subject: [PATCH 06/10] update nextest.sh --- scripts/nextest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nextest.sh b/scripts/nextest.sh index 1a377a1649..650fb35b4f 100755 --- a/scripts/nextest.sh +++ b/scripts/nextest.sh @@ -14,7 +14,7 @@ ulimit -a # install cargo-nextest echo "Setup cargo-nextest." -cargo install clap --locked +cargo install clap --version "4.3.19" --locked cargo nextest -V >/dev/null 2>&1 || cargo install cargo-nextest --locked # following options are tuned for current self hosted CI machine From 8749892e42a8b038f1330e442e8f55a10d061076 Mon Sep 17 00:00:00 2001 From: nk_ysg Date: Tue, 26 Sep 2023 19:06:24 +0800 Subject: [PATCH 07/10] update nextest.sh --- scripts/nextest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nextest.sh b/scripts/nextest.sh index 650fb35b4f..1a903bdd51 100755 --- a/scripts/nextest.sh +++ b/scripts/nextest.sh @@ -14,7 +14,7 @@ ulimit -a # install cargo-nextest echo "Setup cargo-nextest." -cargo install clap --version "4.3.19" --locked +cargo install nextest-runner --version "0.45.0" --locked cargo nextest -V >/dev/null 2>&1 || cargo install cargo-nextest --locked # following options are tuned for current self hosted CI machine From 2aa8ca02387be9699bf65c4d3926352c3c3bbc91 Mon Sep 17 00:00:00 2001 From: nk_ysg Date: Tue, 26 Sep 2023 19:11:59 +0800 Subject: [PATCH 08/10] update nextest.sh --- scripts/nextest.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/nextest.sh b/scripts/nextest.sh index 1a903bdd51..4c79df0fe2 100755 --- a/scripts/nextest.sh +++ b/scripts/nextest.sh @@ -14,8 +14,7 @@ ulimit -a # install cargo-nextest echo "Setup cargo-nextest." -cargo install nextest-runner --version "0.45.0" --locked -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 From 6753e4953ca0441f8df8488662a20ad6bc6db2e6 Mon Sep 17 00:00:00 2001 From: nk_ysg Date: Tue, 26 Sep 2023 19:43:56 +0800 Subject: [PATCH 09/10] update barnard fork version test --- network/src/service.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/network/src/service.rs b/network/src/service.rs index ca8a77851b..c0f0db140c 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, 13, 7]; +const BARNARD_HARD_FORK_VERSION: [i32; 3] = [1, 13, 8]; 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)); } } From 3498cedb907628d6b957c53acc7cd32d115d3335 Mon Sep 17 00:00:00 2001 From: nk_ysg Date: Tue, 26 Sep 2023 19:44:26 +0800 Subject: [PATCH 10/10] update barnard fork version test --- network/src/service.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network/src/service.rs b/network/src/service.rs index c0f0db140c..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, 13, 8]; +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.