From b2bee72b339aa6766adb22c1c3f993cce9ab51be Mon Sep 17 00:00:00 2001 From: simonjiao Date: Tue, 10 Dec 2024 11:52:32 +0800 Subject: [PATCH 1/6] build test with new framework --- Cargo.lock | 1 + cmd/starcoin/src/state/get_cmd.rs | 4 ++-- vm/starcoin-transactional-test-harness/Cargo.toml | 1 + vm/starcoin-transactional-test-harness/src/lib.rs | 7 +++++-- .../tests/cases/call_api_cmd.move | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e632a3c085..29be5b2bca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12068,6 +12068,7 @@ dependencies = [ "serde_json", "starcoin-abi-decoder", "starcoin-accumulator", + "starcoin-cached-packages", "starcoin-chain-api", "starcoin-config", "starcoin-crypto", diff --git a/cmd/starcoin/src/state/get_cmd.rs b/cmd/starcoin/src/state/get_cmd.rs index 9a39957c3a..a71f4644c8 100644 --- a/cmd/starcoin/src/state/get_cmd.rs +++ b/cmd/starcoin/src/state/get_cmd.rs @@ -21,7 +21,7 @@ use starcoin_vm_types::language_storage::{ModuleId, StructTag}; #[clap(name = "get")] pub enum GetOpt { Code { - #[clap(help = "module id like: 0x1::Account")] + #[clap(help = "module id like: 0x1::account")] module_id: StrView, #[clap(long, short = 'n')] /// Get state at a special block height. @@ -30,7 +30,7 @@ pub enum GetOpt { Resource { #[clap(help = "account address")] address: AccountAddress, - #[clap(help = "resource struct tag,", default_value = "0x1::Account::Account")] + #[clap(help = "resource struct tag,", default_value = "0x1::account::Account")] resource_type: StrView, #[clap(long, short = 'n')] /// Get state at a special block height. diff --git a/vm/starcoin-transactional-test-harness/Cargo.toml b/vm/starcoin-transactional-test-harness/Cargo.toml index c6b3a44b0a..ce304da4ef 100644 --- a/vm/starcoin-transactional-test-harness/Cargo.toml +++ b/vm/starcoin-transactional-test-harness/Cargo.toml @@ -66,6 +66,7 @@ starcoin-framework = { workspace = true } stdlib = { workspace = true } starcoin-dag = { workspace = true } bytes = { workspace = true } +starcoin-cached-packages = { workspace = true } [dev-dependencies] datatest-stable = { workspace = true } diff --git a/vm/starcoin-transactional-test-harness/src/lib.rs b/vm/starcoin-transactional-test-harness/src/lib.rs index 75f21879de..1b068f4fe2 100644 --- a/vm/starcoin-transactional-test-harness/src/lib.rs +++ b/vm/starcoin-transactional-test-harness/src/lib.rs @@ -81,7 +81,7 @@ use std::io::{Read, Write}; use std::path::PathBuf; use std::sync::Mutex; use std::{collections::BTreeMap, convert::TryInto, path::Path, str::FromStr}; -use stdlib::{starcoin_framework_named_addresses, stdlib_files}; +use stdlib::starcoin_framework_named_addresses; use tempfile::{NamedTempFile, TempDir}; pub mod context; @@ -1506,7 +1506,10 @@ pub fn print_help(task_name: Option) -> Result<()> { //TODO(simon): construct PackagePaths properly pub static G_PRECOMPILED_STARCOIN_FRAMEWORK: Lazy<(FullyCompiledProgram, Vec)> = Lazy::new(|| { - let sources = stdlib_files(); + let sources = starcoin_cached_packages::head_release_bundle() + .files() + .unwrap(); + eprintln!("sources {:?} {:?}", sources[0], sources[1]); let package_paths = vec![PackagePaths { name: None, paths: sources, diff --git a/vm/starcoin-transactional-test-harness/tests/cases/call_api_cmd.move b/vm/starcoin-transactional-test-harness/tests/cases/call_api_cmd.move index d7a7dc48c9..aacc2501a2 100644 --- a/vm/starcoin-transactional-test-harness/tests/cases/call_api_cmd.move +++ b/vm/starcoin-transactional-test-harness/tests/cases/call_api_cmd.move @@ -6,7 +6,7 @@ //# call-api chain.get_block_by_number [1] -//# call-api state.get_with_proof_by_root_raw ["0x1/1/0x1::Account::Account","{{$.call-api[0].header.state_root}}"] +//# call-api state.get_with_proof_by_root_raw ["0x1/1/0x1::account::Account","{{$.call-api[0].header.state_root}}"] //# run --signers creator --args {{$.call-api[0].header.number}}u64 --args "{{$.call-api[0].header.block_hash}}" --args "{{$.call-api[1]}}" script{ From 35e329ce4726002a77e1950c01ad6c83c6c7eb78 Mon Sep 17 00:00:00 2001 From: simonjiao Date: Thu, 12 Dec 2024 12:46:52 +0800 Subject: [PATCH 2/6] add compiler features --- vm/starcoin-transactional-test-harness/Cargo.toml | 1 + vm/starcoin-transactional-test-harness/src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/vm/starcoin-transactional-test-harness/Cargo.toml b/vm/starcoin-transactional-test-harness/Cargo.toml index ce304da4ef..26d55c9188 100644 --- a/vm/starcoin-transactional-test-harness/Cargo.toml +++ b/vm/starcoin-transactional-test-harness/Cargo.toml @@ -66,6 +66,7 @@ starcoin-framework = { workspace = true } stdlib = { workspace = true } starcoin-dag = { workspace = true } bytes = { workspace = true } +starcoin-framework = { workspace = true } starcoin-cached-packages = { workspace = true } [dev-dependencies] diff --git a/vm/starcoin-transactional-test-harness/src/lib.rs b/vm/starcoin-transactional-test-harness/src/lib.rs index 1b068f4fe2..000ea0b9b2 100644 --- a/vm/starcoin-transactional-test-harness/src/lib.rs +++ b/vm/starcoin-transactional-test-harness/src/lib.rs @@ -1518,8 +1518,8 @@ pub static G_PRECOMPILED_STARCOIN_FRAMEWORK: Lazy<(FullyCompiledProgram, Vec Date: Thu, 12 Dec 2024 13:24:18 +0800 Subject: [PATCH 3/6] update starcoin-framework named addresses --- vm/compiler/src/lib.rs | 11 +++++++---- vm/starcoin-transactional-test-harness/src/lib.rs | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/vm/compiler/src/lib.rs b/vm/compiler/src/lib.rs index caae2cd986..752d59fac1 100644 --- a/vm/compiler/src/lib.rs +++ b/vm/compiler/src/lib.rs @@ -50,12 +50,15 @@ pub mod shared { pub fn starcoin_framework_named_addresses() -> BTreeMap { let mapping = [ - ("VMReserved", "0x0"), - ("Genesis", "0x1"), - ("StarcoinFramework", "0x1"), - ("StarcoinAssociation", "0xA550C18"), + ("vm", "0x0"), + ("vm_reserved", "0x0"), ("std", "0x1"), ("starcoin_std", "0x1"), + ("starcoin_framework", "0x1"), + ("starcoin_fungible_asset", "0x1"), + ("starcoin_token", "0x1"), + ("starcoin_token_objects", "0x1"), + ("core_resources", "0xA550C18"), ]; mapping .iter() diff --git a/vm/starcoin-transactional-test-harness/src/lib.rs b/vm/starcoin-transactional-test-harness/src/lib.rs index 000ea0b9b2..d7e1cdea1b 100644 --- a/vm/starcoin-transactional-test-harness/src/lib.rs +++ b/vm/starcoin-transactional-test-harness/src/lib.rs @@ -1509,7 +1509,6 @@ pub static G_PRECOMPILED_STARCOIN_FRAMEWORK: Lazy<(FullyCompiledProgram, Vec Date: Thu, 12 Dec 2024 18:32:26 +0800 Subject: [PATCH 4/6] fix compiling errors --- vm/compiler/src/lib.rs | 4 ++++ vm/move-package-manager/src/lib.rs | 6 ++++-- vm/starcoin-transactional-test-harness/Cargo.toml | 1 - vm/starcoin-transactional-test-harness/src/lib.rs | 4 +--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/vm/compiler/src/lib.rs b/vm/compiler/src/lib.rs index 752d59fac1..39e5bdf1ce 100644 --- a/vm/compiler/src/lib.rs +++ b/vm/compiler/src/lib.rs @@ -50,6 +50,10 @@ pub mod shared { pub fn starcoin_framework_named_addresses() -> BTreeMap { let mapping = [ + ("VMReserved", "0x0"), + ("Genesis", "0x1"), + ("StarcoinFramework", "0x1"), + ("StarcoinAssociation", "0xA550C18"), ("vm", "0x0"), ("vm_reserved", "0x0"), ("std", "0x1"), diff --git a/vm/move-package-manager/src/lib.rs b/vm/move-package-manager/src/lib.rs index a1129717b8..0585aa8dec 100644 --- a/vm/move-package-manager/src/lib.rs +++ b/vm/move-package-manager/src/lib.rs @@ -136,8 +136,10 @@ pub fn run_integration_test(move_arg: Move, cmd: IntegrationTestCommand) -> Resu // force move to rebuild all packages, so that we can use compile_driver to generate the full compiled program. let mut build_config = move_arg.build_config; build_config.force_recompilation = true; - build_config.compiler_config.known_attributes = - starcoin_framework::extended_checks::get_all_attribute_names().clone(); + build_config + .compiler_config + .known_attributes + .clone_from(starcoin_framework::extended_checks::get_all_attribute_names()); let resolved_graph = build_config .clone() .resolution_graph_for_package(&rerooted_path, &mut std::io::stdout())?; diff --git a/vm/starcoin-transactional-test-harness/Cargo.toml b/vm/starcoin-transactional-test-harness/Cargo.toml index 26d55c9188..19230c0ae2 100644 --- a/vm/starcoin-transactional-test-harness/Cargo.toml +++ b/vm/starcoin-transactional-test-harness/Cargo.toml @@ -62,7 +62,6 @@ starcoin-vm-runtime = { workspace = true } starcoin-vm-types = { workspace = true } starcoin-gas-meter = { workspace = true } starcoin-gas-schedule = { workspace = true } -starcoin-framework = { workspace = true } stdlib = { workspace = true } starcoin-dag = { workspace = true } bytes = { workspace = true } diff --git a/vm/starcoin-transactional-test-harness/src/lib.rs b/vm/starcoin-transactional-test-harness/src/lib.rs index d7e1cdea1b..df96775dc9 100644 --- a/vm/starcoin-transactional-test-harness/src/lib.rs +++ b/vm/starcoin-transactional-test-harness/src/lib.rs @@ -37,7 +37,6 @@ use starcoin_config::{genesis_key_pair, BuiltinNetworkID}; use starcoin_crypto::hash::PlainCryptoHash; use starcoin_crypto::HashValue; use starcoin_dev::playground::call_contract; -use starcoin_framework::extended_checks; use starcoin_gas_meter::StarcoinGasParameters; use starcoin_gas_schedule::FromOnChainGasSchedule; use starcoin_rpc_api::types::{ @@ -1072,8 +1071,7 @@ impl<'a> MoveTestAdapter<'a> for StarcoinTestAdapter<'a> { } fn known_attributes(&self) -> &BTreeSet { - // KnownAttribute::get_all_attribute_names() - extended_checks::get_all_attribute_names() + starcoin_framework::extended_checks::get_all_attribute_names() } fn init( From ff9a3ed2298071aac70d738fe828a932004f9675 Mon Sep 17 00:00:00 2001 From: simonjiao Date: Thu, 12 Dec 2024 18:47:22 +0800 Subject: [PATCH 5/6] update auto-generated files --- genesis/generated/barnard/genesis | Bin 271527 -> 271176 bytes genesis/generated/halley/genesis | Bin 269239 -> 268888 bytes genesis/generated/main/genesis | Bin 271576 -> 271225 bytes genesis/generated/proxima/genesis | Bin 272925 -> 272574 bytes genesis/generated/vega/genesis | Bin 271576 -> 271225 bytes 5 files changed, 0 insertions(+), 0 deletions(-) diff --git a/genesis/generated/barnard/genesis b/genesis/generated/barnard/genesis index ed58c8f07a165b988da0e0eeeb1ded604196eeac..3ac93c32ad4b792eaf04a9eaec167a07d0be6760 100644 GIT binary patch delta 215 zcmV;|04V>b$q>lK5RgJ3@J%M8QKFNx#@VsCdse@Dkjr4_7j6FY7uUa+kdruokzyhs z$tBf+-%Y>KLCg1SmFWeA;RIlau2zno0+cQ1#iA(^lfj%Ek-!ZgJb**;C{YeRSskHgFrgyMx`R>LqTV~D;y}x#L)U4-=&WSD1J8C{LNl8I* zPVeXW))(c^Oe&L(cXD1H^{q1B>J?9wYDR%*_L170$p`1iOgzA=urNjIoBnLCCwT%h zAL*LTb^rT((fqi-EFgCGm+VDMdUWMnQIbQe{bMu>goumS2*YmmXh` zU!GdToR?b80#e2SQ^JERJ$<(*qhc%r&^bV7GqbaDa4~T*gPhO6%Fe*f2=Wma2r)1* zf<#%k83Y(am_W+GY(^0#W*D1Egoy>LlbeB?k(&vq1*nLTp*>cZ5r~<9n0b4wFv}`_ z$4?%=uPbkw<<6=7_qo!kUmQ7-)~yCzdA$?faDOwuTrw-DI05RgJ3V{))$^;~~a(!~f(x4*~rr6NzOwg_P@$>mi2#^zcpkzyhs z*N1@b`7#Q9Yd|^6Ng7;Lyd~$zN6eC!$|5=;_GN)Alfj%Ek-!ZgHY@OaMo}t_Ib4sH zoySB?AqZMJ*o;aN{le#YA85nOk?k}Ac7q}Tw;}-nJrak$6ak066at676a%-u6a=^i zL3ug{bOlCy_K$A9DX} z5AdJgIn}4S__smi@5t9I^S+*4<{#xY@vRACd9xDZb|pqeTcP^9ObcaRbF(opFmN$4 zFflQ)FtbUr%8RfY*KurQ6kt2ZD8_Z2k&EXcqbKhwCXg~lb_NC}21W)3W+r9^1{Nk3 z1_o9pRt5$(HlP?I2LmG;5VJCJF)=bTvvM&pOOz$%WTqsR%wG3TY0vw)Owz?ASHOHbb|%BUF20CWz}+05*$99&GC%pm78u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f0x4r;XJBArU}RumW@2VwU}0im zU|?lpWnf@q1Bx+nFfg(KF)Je%6C*P-D;E>9L|I}^W=dj7eo=gKeqM2EUU6x0d}dx+ zzE~JgA^|Mp43qE#inFJrrX`l4C#ucQwhJcVdy5}Ka4v<+MXY|tmKWTxyB57DRSMkg@-O>*RMEsFB?bLt zGw*%OXA^e)6l(Nd`DlVt?>@)NN%xY9(%DMcuFRh_`QRLxi3fNUf{YY)W#ay3WYO^N`V#cNG&z86!Ib0}}%y0|PS?GXnz)6AJ?a zD-$aN0~;GqjFE$ZkqwAh8M&AknVDI+n3yHX5_2+B5=-)n;*<09ic|B7ON-+(^V0Ig z!hjM9U>RqageOp(JtZ|Qu{5WIBR#bwJ~1VwhzG5{`v4C}QGjKC#6)`fj#|kq7F%u9oZ;usbxy|o5 z|E+JJeNl$q#5vQh{rY|VO|%a8+e1~$p6`!Y`$^`{JKG-%E2oD^++5Ay+uGl$7xmTr VmFemYul(+RlswtA Date: Thu, 12 Dec 2024 19:11:33 +0800 Subject: [PATCH 6/6] increase wait time to improve the sucess rate --- test-helper/src/txpool.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-helper/src/txpool.rs b/test-helper/src/txpool.rs index 26ea89d8f9..1b58cb0b31 100644 --- a/test-helper/src/txpool.rs +++ b/test-helper/src/txpool.rs @@ -73,7 +73,7 @@ pub async fn start_txpool_with_miner( } //registry.register::().await.unwrap(); let pool_actor = registry.register::().await.unwrap(); - Delay::new(Duration::from_millis(300)).await; + Delay::new(Duration::from_millis(1000)).await; let txpool_service = registry.get_shared::().await.unwrap(); (