Skip to content

Commit

Permalink
[move] Remove move-explain and errmapgen
Browse files Browse the repository at this point in the history
  • Loading branch information
tzakian committed Jun 10, 2024
1 parent 92d3f5f commit 0a9cb04
Show file tree
Hide file tree
Showing 27 changed files with 17 additions and 496 deletions.
14 changes: 0 additions & 14 deletions Cargo.lock

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

27 changes: 0 additions & 27 deletions external-crates/move/Cargo.lock

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

1 change: 0 additions & 1 deletion external-crates/move/crates/move-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ move-binary-format.workspace = true
move-package.workspace = true
move-prover.workspace = true
move-unit-test.workspace = true
move-errmapgen.workspace = true
move-bytecode-viewer.workspace = true

[dev-dependencies]
Expand Down
50 changes: 0 additions & 50 deletions external-crates/move/crates/move-cli/src/base/errmap.rs

This file was deleted.

1 change: 0 additions & 1 deletion external-crates/move/crates/move-cli/src/base/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pub mod build;
pub mod coverage;
pub mod disassemble;
pub mod docgen;
pub mod errmap;
pub mod info;
pub mod migrate;
pub mod new;
Expand Down
35 changes: 8 additions & 27 deletions external-crates/move/crates/move-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// SPDX-License-Identifier: Apache-2.0

use base::{
build::Build, coverage::Coverage, disassemble::Disassemble, docgen::Docgen, errmap::Errmap,
info::Info, migrate::Migrate, new::New, test::Test,
build::Build, coverage::Coverage, disassemble::Disassemble, docgen::Docgen, info::Info,
migrate::Migrate, new::New, test::Test,
};
use move_package::BuildConfig;

Expand All @@ -19,9 +19,7 @@ pub const DEFAULT_BUILD_DIR: &str = ".";

use anyhow::Result;
use clap::Parser;
use move_core_types::{
account_address::AccountAddress, errmap::ErrorMapping, identifier::Identifier,
};
use move_core_types::{account_address::AccountAddress, identifier::Identifier};
use move_vm_runtime::native_functions::NativeFunction;
use move_vm_test_utils::gas_schedule::CostTable;
use std::path::PathBuf;
Expand Down Expand Up @@ -62,7 +60,6 @@ pub enum Command {
Coverage(Coverage),
Disassemble(Disassemble),
Docgen(Docgen),
Errmap(Errmap),
Info(Info),
Migrate(Migrate),
New(New),
Expand All @@ -82,7 +79,6 @@ pub enum Command {
pub fn run_cli(
natives: Vec<NativeFunctionRecord>,
cost_table: &CostTable,
error_descriptions: &ErrorMapping,
move_args: Move,
cmd: Command,
) -> Result<()> {
Expand All @@ -98,7 +94,6 @@ pub fn run_cli(
c.execute(move_args.package_path.as_deref(), move_args.build_config)
}
Command::Docgen(c) => c.execute(move_args.package_path.as_deref(), move_args.build_config),
Command::Errmap(c) => c.execute(move_args.package_path.as_deref(), move_args.build_config),
Command::Info(c) => c.execute(move_args.package_path.as_deref(), move_args.build_config),
Command::Migrate(c) => c.execute(move_args.package_path.as_deref(), move_args.build_config),
Command::New(c) => c.execute_with_defaults(move_args.package_path.as_deref()),
Expand All @@ -108,27 +103,13 @@ pub fn run_cli(
natives,
Some(cost_table.clone()),
),
Command::Sandbox { storage_dir, cmd } => cmd.handle_command(
natives,
cost_table,
error_descriptions,
&move_args,
&storage_dir,
),
Command::Sandbox { storage_dir, cmd } => {
cmd.handle_command(natives, cost_table, &move_args, &storage_dir)
}
}
}

pub fn move_cli(
natives: Vec<NativeFunctionRecord>,
cost_table: &CostTable,
error_descriptions: &ErrorMapping,
) -> Result<()> {
pub fn move_cli(natives: Vec<NativeFunctionRecord>, cost_table: &CostTable) -> Result<()> {
let args = MoveCLI::parse();
run_cli(
natives,
cost_table,
error_descriptions,
args.move_args,
args.cmd,
)
run_cli(natives, cost_table, args.move_args, args.cmd)
}
5 changes: 2 additions & 3 deletions external-crates/move/crates/move-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
// SPDX-License-Identifier: Apache-2.0

use anyhow::Result;
use move_core_types::{account_address::AccountAddress, errmap::ErrorMapping};
use move_core_types::account_address::AccountAddress;
use move_stdlib_natives::{all_natives, nursery_natives, GasParameters, NurseryGasParameters};

fn main() -> Result<()> {
let error_descriptions: ErrorMapping = bcs::from_bytes(move_stdlib::error_descriptions())?;
let cost_table = &move_vm_test_utils::gas_schedule::INITIAL_COST_SCHEDULE;
let addr = AccountAddress::from_hex_literal("0x1").unwrap();
let natives = all_natives(addr, GasParameters::zeros())
Expand All @@ -19,5 +18,5 @@ fn main() -> Result<()> {
))
.collect();

move_cli::move_cli(natives, cost_table, &error_descriptions)
move_cli::move_cli(natives, cost_table)
}
5 changes: 1 addition & 4 deletions external-crates/move/crates/move-cli/src/sandbox/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ use crate::{
use anyhow::Result;
use clap::Parser;
use move_core_types::{
errmap::ErrorMapping, language_storage::TypeTag, parser,
transaction_argument::TransactionArgument,
language_storage::TypeTag, parser, transaction_argument::TransactionArgument,
};
use move_package::compilation::package_layout::CompiledPackageLayout;
use move_vm_test_utils::gas_schedule::CostTable;
Expand Down Expand Up @@ -188,7 +187,6 @@ impl SandboxCommand {
&self,
natives: Vec<NativeFunctionRecord>,
cost_table: &CostTable,
error_descriptions: &ErrorMapping,
move_args: &Move,
storage_dir: &Path,
) -> Result<()> {
Expand Down Expand Up @@ -229,7 +227,6 @@ impl SandboxCommand {
sandbox::commands::run(
natives,
cost_table,
error_descriptions,
&state,
context.package(),
module_file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use move_binary_format::file_format::CompiledModule;
use move_command_line_common::files::try_exists;
use move_core_types::{
account_address::AccountAddress,
errmap::ErrorMapping,
identifier::IdentStr,
language_storage::TypeTag,
runtime_value::MoveValue,
Expand All @@ -28,7 +27,6 @@ use std::{fs, path::Path};
pub fn run(
natives: impl IntoIterator<Item = NativeFunctionRecord>,
cost_table: &CostTable,
error_descriptions: &ErrorMapping,
state: &OnDiskStateView,
_package: &CompiledPackage,
module_file: &Path,
Expand Down Expand Up @@ -108,7 +106,6 @@ pub fn run(

if let Err(err) = res {
explain_execution_error(
error_descriptions,
err,
state,
&script_type_parameters,
Expand Down
15 changes: 1 addition & 14 deletions external-crates/move/crates/move-cli/src/sandbox/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use move_compiler::diagnostics::{self, report_diagnostics, Diagnostic, Diagnosti
use move_core_types::{
account_address::AccountAddress,
effects::{ChangeSet, Op},
errmap::ErrorMapping,
language_storage::{ModuleId, TypeTag},
transaction_argument::TransactionArgument,
vm_status::{StatusCode, StatusType},
Expand Down Expand Up @@ -280,7 +279,6 @@ pub(crate) fn explain_publish_error(

/// Explain an execution error
pub(crate) fn explain_execution_error(
error_descriptions: &ErrorMapping,
error: VMError,
state: &OnDiskStateView,
script_type_parameters: &[AbilitySet],
Expand All @@ -292,21 +290,10 @@ pub(crate) fn explain_execution_error(
use StatusCode::*;
match (error.location(), error.major_status(), error.sub_status()) {
(Location::Module(module_id), StatusCode::ABORTED, Some(abort_code)) => {
// try to use move-explain to explain the abort

print!(
println!(
"Execution aborted with code {} in module {}.",
abort_code, module_id
);

if let Some(error_desc) = error_descriptions.get_explanation(module_id, abort_code) {
println!(
" Abort code details:\nName: {}\nDescription:{}",
error_desc.code_name, error_desc.code_description,
)
} else {
println!()
}
}
(location, status_code, _) if error.status_type() == StatusType::Execution => {
let (function, code_offset) = error.offsets()[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Commands:
coverage Inspect test coverage for this package. A previous test run with the `--coverage` flag must have previously been run
disassemble Disassemble the Move bytecode pointed to
docgen Generate javadoc style documentation for Move packages
errmap Generate error map for the package and its dependencies at `path` for use by the Move explanation tool
info Print address information
migrate Migrate to Move 2024 for the package at `path`. If no path is provided defaults to current directory
new Create a new Move package with name `name` at `path`. If `path` is not provided the package will be created in the directory `name`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ B0:

}
}
Command `errmap`:
Command `info`:
PackageBasics
├── std:0x1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ coverage summary --summarize-functions
coverage source --module AModule
coverage bytecode --module AModule
disassemble --package MoveStdlib --name signer
errmap
info
test double_two
test one_one
11 changes: 5 additions & 6 deletions external-crates/move/crates/move-cli/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ Move has a number of tools associated with it. This directory contains all,
or almost all of them. The following crates in this directory are libraries
that are used by the [`move-cli`](./move-cli) `package` subcommand:

* `move-bytecode-viewer`
* `move-disassembler`
* `move-explain`
* `move-unit-test`
* `move-package`
* `move-coverage`
- `move-bytecode-viewer`
- `move-disassembler`
- `move-unit-test`
- `move-package`
- `move-coverage`

In this sense each of these crates defines the core logic for a specific
package command, e.g., how to run and report unit tests, or collect and
Expand Down
Loading

0 comments on commit 0a9cb04

Please sign in to comment.