Skip to content

Commit

Permalink
Fix precompiled lib (#4342)
Browse files Browse the repository at this point in the history
* build precompiled lib with new framework

* add compiler features

* update starcoin-framework named addresses

* fix compiling errors

* update auto-generated files

* increase wait time to improve the sucess rate
  • Loading branch information
simonjiao authored Dec 12, 2024
1 parent 3a11c18 commit f13c92c
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 14 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cmd/starcoin/src/state/get_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ModuleId>,
#[clap(long, short = 'n')]
/// Get state at a special block height.
Expand All @@ -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<StructTag>,
#[clap(long, short = 'n')]
/// Get state at a special block height.
Expand Down
Binary file modified genesis/generated/barnard/genesis
Binary file not shown.
Binary file modified genesis/generated/halley/genesis
Binary file not shown.
Binary file modified genesis/generated/main/genesis
Binary file not shown.
Binary file modified genesis/generated/proxima/genesis
Binary file not shown.
Binary file modified genesis/generated/vega/genesis
Binary file not shown.
2 changes: 1 addition & 1 deletion test-helper/src/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub async fn start_txpool_with_miner(
}
//registry.register::<MinerService>().await.unwrap();
let pool_actor = registry.register::<TxPoolActorService>().await.unwrap();
Delay::new(Duration::from_millis(300)).await;
Delay::new(Duration::from_millis(1000)).await;
let txpool_service = registry.get_shared::<TxPoolService>().await.unwrap();

(
Expand Down
7 changes: 7 additions & 0 deletions vm/compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,15 @@ pub fn starcoin_framework_named_addresses() -> BTreeMap<String, NumericalAddress
("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()
Expand Down
6 changes: 4 additions & 2 deletions vm/move-package-manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())?;
Expand Down
3 changes: 2 additions & 1 deletion vm/starcoin-transactional-test-harness/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ 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 }
starcoin-framework = { workspace = true }
starcoin-cached-packages = { workspace = true }

[dev-dependencies]
datatest-stable = { workspace = true }
Expand Down
14 changes: 7 additions & 7 deletions vm/starcoin-transactional-test-harness/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -81,7 +80,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;
Expand Down Expand Up @@ -1072,8 +1071,7 @@ impl<'a> MoveTestAdapter<'a> for StarcoinTestAdapter<'a> {
}

fn known_attributes(&self) -> &BTreeSet<String> {
// KnownAttribute::get_all_attribute_names()
extended_checks::get_all_attribute_names()
starcoin_framework::extended_checks::get_all_attribute_names()
}

fn init(
Expand Down Expand Up @@ -1506,7 +1504,9 @@ pub fn print_help(task_name: Option<String>) -> Result<()> {
//TODO(simon): construct PackagePaths properly
pub static G_PRECOMPILED_STARCOIN_FRAMEWORK: Lazy<(FullyCompiledProgram, Vec<PackagePaths>)> =
Lazy::new(|| {
let sources = stdlib_files();
let sources = starcoin_cached_packages::head_release_bundle()
.files()
.unwrap();
let package_paths = vec![PackagePaths {
name: None,
paths: sources,
Expand All @@ -1515,8 +1515,8 @@ pub static G_PRECOMPILED_STARCOIN_FRAMEWORK: Lazy<(FullyCompiledProgram, Vec<Pac
let program_res = construct_pre_compiled_lib(
package_paths,
None,
move_compiler::Flags::empty(),
&BTreeSet::new(),
move_compiler::Flags::empty().set_sources_shadow_deps(false),
starcoin_framework::extended_checks::get_all_attribute_names(),
)
.unwrap();
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit f13c92c

Please sign in to comment.