Skip to content

Commit

Permalink
refactor: move starcoin-force-upgrade (#4236)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkysg authored Oct 12, 2024
1 parent ea56f4a commit f4d3234
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 24 deletions.
4 changes: 1 addition & 3 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ members = [
"chain",
"chain/api",
"chain/open-block",
"chain/force-upgrade",
"vm/force-upgrade",
"chain/mock",
"chain/chain-notify",
"chain/service",
Expand Down Expand Up @@ -154,7 +154,7 @@ default-members = [
"chain",
"chain/api",
"chain/open-block",
"chain/force-upgrade",
"vm/force-upgrade",
"chain/mock",
"chain/chain-notify",
"chain/service",
Expand Down Expand Up @@ -472,7 +472,7 @@ starcoin-network-rpc-api = { path = "network-rpc/api" }
starcoin-node = { path = "node" }
starcoin-node-api = { path = "node/api" }
starcoin-open-block = { path = "chain/open-block" }
starcoin-force-upgrade = { path = "chain/force-upgrade" }
starcoin-force-upgrade = { path = "vm/force-upgrade" }
starcoin-resource-viewer = { path = "vm/resource-viewer" }
starcoin-rpc-api = { path = "rpc/api" }
starcoin-rpc-client = { path = "rpc/client" }
Expand Down
1 change: 0 additions & 1 deletion benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ starcoin-state-store-api = { workspace = true }
starcoin-state-tree = { workspace = true }
starcoin-storage = { workspace = true }
starcoin-transaction-builder = { workspace = true }
starcoin-vm-runtime = { workspace = true }
starcoin-vm-types = { workspace = true }
starcoin-types = { workspace = true }
starcoin-executor-benchmark = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ starcoin-force-upgrade = { workspace = true }
[features]
default = []
fuzzing = ["proptest", "proptest-derive", "starcoin-types/fuzzing"]
force-deploy = ["starcoin-vm-runtime/force-deploy", "starcoin-vm-runtime", "starcoin-executor/force-deploy"]
force-deploy = ["starcoin-force-upgrade/force-deploy", "starcoin-executor/force-deploy"]

[package]
authors = { workspace = true }
Expand Down
1 change: 0 additions & 1 deletion chain/open-block/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ starcoin-statedb = { workspace = true }
starcoin-storage = { workspace = true }
starcoin-types = { workspace = true }
starcoin-vm-types = { workspace = true }
starcoin-vm-runtime = { workspace = true }
starcoin-force-upgrade = { workspace = true }

[dev-dependencies]
Expand Down
7 changes: 3 additions & 4 deletions chain/open-block/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ use std::{convert::TryInto, sync::Arc};

#[cfg(feature = "force-deploy")]
use {
starcoin_force_upgrade::ForceUpgrade,
starcoin_types::{account::DEFAULT_EXPIRATION_TIME, identifier::Identifier},
starcoin_vm_runtime::force_upgrade_management::{
get_force_upgrade_account, get_force_upgrade_block_number,
starcoin_force_upgrade::force_upgrade_management::{
get_force_upgrade_account, get_force_upgrade_block_number, ForceUpgrade,
},
starcoin_types::{account::DEFAULT_EXPIRATION_TIME, identifier::Identifier},
starcoin_vm_types::{
access_path::AccessPath,
account_config::{genesis_address, ModuleUpgradeStrategy},
Expand Down
4 changes: 2 additions & 2 deletions chain/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ use starcoin_dag::consensusdb::consenses_state::DagState;
use starcoin_dag::consensusdb::prelude::StoreError;
use starcoin_dag::consensusdb::schemadb::GhostdagStoreReader;
use starcoin_executor::VMMetrics;
#[cfg(feature = "force-deploy")]
use starcoin_force_upgrade::force_upgrade_management::get_force_upgrade_block_number;
use starcoin_logger::prelude::*;
use starcoin_open_block::OpenedBlock;
use starcoin_state_api::{AccountStateReader, ChainStateReader, ChainStateWriter};
Expand All @@ -40,8 +42,6 @@ use starcoin_types::{
transaction::{SignedUserTransaction, Transaction},
U256,
};
#[cfg(feature = "force-deploy")]
use starcoin_vm_runtime::force_upgrade_management::get_force_upgrade_block_number;
use starcoin_vm_types::access_path::AccessPath;
use starcoin_vm_types::account_config::genesis_address;
use starcoin_vm_types::genesis_config::{ChainId, ConsensusStrategy};
Expand Down
2 changes: 1 addition & 1 deletion chain/tests/test_force_upgrade.rs.ignored
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use starcoin_consensus::Consensus;
use starcoin_statedb::ChainStateDB;
use starcoin_transaction_builder::{build_transfer_from_association, DEFAULT_EXPIRATION_TIME};
use starcoin_types::account_address::AccountAddress;
use starcoin_vm_runtime::force_upgrade_management::get_force_upgrade_block_number;
use starcoin_force_upgrade::force_upgrade_management::get_force_upgrade_block_number;
use starcoin_vm_types::genesis_config::StdlibVersion;
use starcoin_vm_types::on_chain_config::Version;
use starcoin_vm_types::{account_config, state_view::StateReaderExt};
Expand Down
3 changes: 1 addition & 2 deletions executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ starcoin-transaction-builder = { workspace = true }
starcoin-state-tree = { workspace = true }
starcoin-statedb = { workspace = true }
starcoin-vm-runtime = { workspace = true }
starcoin-force-upgrade = { workspace = true }
stdlib = { workspace = true }
stest = { workspace = true }
tempfile = { workspace = true }
Expand All @@ -38,7 +37,7 @@ move-transactional-test-runner = { workspace = true }
[features]
default = []
fuzzing = ["starcoin-types/fuzzing"]
force-deploy = ["starcoin-vm-runtime/force-deploy"]
force-deploy = ["starcoin-force-upgrade/force-deploy"]

[package]
authors = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions executor/src/block_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ use {
crate::execute_transactions,
anyhow::bail,
log::info,
starcoin_force_upgrade::force_upgrade_management::{
get_force_upgrade_account, get_force_upgrade_block_number,
},
starcoin_force_upgrade::ForceUpgrade,
starcoin_types::account::DEFAULT_EXPIRATION_TIME,
starcoin_types::identifier::Identifier,
starcoin_vm_runtime::force_upgrade_management::{
get_force_upgrade_account, get_force_upgrade_block_number,
},
starcoin_vm_types::{
access_path::AccessPath,
account_config::{genesis_address, ModuleUpgradeStrategy},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ starcoin-statedb = { workspace = true }
starcoin-storage = { workspace = true }
starcoin-types = { workspace = true }
starcoin-vm-types = { workspace = true }
starcoin-vm-runtime = { workspace = true }
starcoin-move-compiler = { workspace = true }
stdlib = { workspace = true }
include_dir = { workspace = true }
hex = "0.4.3"

[dev-dependencies]
starcoin-genesis = { workspace = true }
stest = { workspace = true }

[features]
force-deploy = []
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ use starcoin_vm_types::{
};
use stdlib::COMPILED_MOVE_CODE_DIR;

#[cfg(feature = "force-deploy")]
pub mod force_upgrade_management;

pub struct ForceUpgrade;

impl ForceUpgrade {
Expand Down
2 changes: 0 additions & 2 deletions vm/vm-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ use move_core_types::vm_status::VMStatus;
pub use move_vm_runtime::{move_vm, session};
mod access_path_cache;
mod errors;
#[cfg(feature = "force-deploy")]
pub mod force_upgrade_management;
pub mod move_vm_ext;
pub mod parallel_executor;
mod verifier;
Expand Down

0 comments on commit f4d3234

Please sign in to comment.