Skip to content

Commit d126653

Browse files
authored
[cleanup] Split move-stdlib natives into their own crate (#17164)
## Description - Made move-stdlib its own crate to future proof execution cut ## Test plan - CI --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK:
1 parent a20b0d1 commit d126653

File tree

65 files changed

+117
-158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+117
-158
lines changed

Cargo.lock

Lines changed: 24 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ members = [
1919
"move-execution/v1/crates/move-vm-runtime",
2020
"move-execution/v2/crates/move-vm-runtime",
2121
# "move-execution/$CUT/crates/move-vm-runtime",
22-
"move-execution/v0/crates/move-stdlib",
23-
"move-execution/v1/crates/move-stdlib",
24-
"move-execution/v2/crates/move-stdlib",
25-
# "move-execution/$CUT/crates/move-stdlib",
22+
"move-execution/v0/crates/move-stdlib-natives",
23+
"move-execution/v1/crates/move-stdlib-natives",
24+
"move-execution/v2/crates/move-stdlib-natives",
25+
# "move-execution/$CUT/crates/move-stdlib-natives",
2626
]
2727

2828
# Dependencies that should be kept in sync through the whole workspace
@@ -165,6 +165,7 @@ move-read-write-set-types = { path = "crates/move-read-write-set-types" }
165165
move-stackless-bytecode = { path = "crates/move-stackless-bytecode" }
166166
move-stackless-bytecode-interpreter = { path = "crates/move-stackless-bytecode-interpreter" }
167167
move-stdlib = { path = "crates/move-stdlib" }
168+
move-stdlib-natives = { path = "crates/move-stdlib-natives" }
168169
move-symbol-pool = { path = "crates/move-symbol-pool" }
169170
move-transactional-test-runner = { path = "crates/move-transactional-test-runner" }
170171
move-unit-test = { path = "crates/move-unit-test" }

crates/language-benchmarks/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ move-vm-test-utils.workspace = true
2121
move-vm-types.workspace = true
2222
move-binary-format.workspace = true
2323
move-stdlib.workspace = true
24+
move-stdlib-natives.workspace = true
2425

2526
[[bench]]
2627
name = "vm_benches"

crates/language-benchmarks/src/move_vm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ static MOVE_BENCH_SRC_PATH: Lazy<PathBuf> = Lazy::new(|| {
2525
/// Entry point for the bench, provide a function name to invoke in Module Bench in bench.move.
2626
pub fn bench<M: Measurement + 'static>(c: &mut Criterion<M>, fun: &str) {
2727
let modules = compile_modules();
28-
let move_vm = MoveVM::new(move_stdlib::natives::all_natives(
28+
let move_vm = MoveVM::new(move_stdlib_natives::all_natives(
2929
AccountAddress::from_hex_literal("0x1").unwrap(),
30-
move_stdlib::natives::GasParameters::zeros(),
30+
move_stdlib_natives::GasParameters::zeros(),
3131
))
3232
.unwrap();
3333
execute(c, &move_vm, modules, fun);

crates/move-cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ move-core-types.workspace = true
3232
move-ir-types.workspace = true
3333
move-compiler.workspace = true
3434
move-stdlib.workspace = true
35+
move-stdlib-natives.workspace = true
3536
move-vm-types.workspace = true
3637
move-vm-runtime.workspace = true
3738
move-vm-profiler.workspace = true

crates/move-cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use anyhow::Result;
66
use move_core_types::{account_address::AccountAddress, errmap::ErrorMapping};
7-
use move_stdlib::natives::{all_natives, nursery_natives, GasParameters, NurseryGasParameters};
7+
use move_stdlib_natives::{all_natives, nursery_natives, GasParameters, NurseryGasParameters};
88

99
fn main() -> Result<()> {
1010
let error_descriptions: ErrorMapping = bcs::from_bytes(move_stdlib::error_descriptions())?;

crates/move-stdlib-natives/Cargo.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[package]
2+
name = "move-stdlib-natives"
3+
version = "0.1.1"
4+
edition = "2021"
5+
authors = ["Diem Association <[email protected]>"]
6+
description = "Diem stdlib"
7+
repository = "https://github.com/diem/diem"
8+
homepage = "https://diem.com"
9+
license = "Apache-2.0"
10+
publish = false
11+
12+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
13+
[dependencies]
14+
move-vm-types.workspace = true
15+
move-binary-format.workspace = true
16+
move-core-types.workspace = true
17+
# referred to via path for execution versioning
18+
move-vm-runtime = { path = "../move-vm-runtime" }
19+
smallvec.workspace = true
20+
sha2.workspace = true
21+
sha3.workspace = true
22+
hex.workspace = true
23+
24+
[features]
25+
default = []
26+
testing = []

crates/move-stdlib/src/natives/bcs.rs renamed to crates/move-stdlib-natives/src/bcs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright (c) The Move Contributors
33
// SPDX-License-Identifier: Apache-2.0
44

5-
use crate::natives::helpers::make_module_natives;
5+
use crate::helpers::make_module_natives;
66
use move_binary_format::errors::PartialVMResult;
77
use move_core_types::{
88
gas_algebra::{InternalGas, InternalGasPerByte, NumBytes},

crates/move-stdlib/src/natives/debug.rs renamed to crates/move-stdlib-natives/src/debug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright (c) The Move Contributors
33
// SPDX-License-Identifier: Apache-2.0
44

5-
use crate::natives::helpers::make_module_natives;
5+
use crate::helpers::make_module_natives;
66
use move_binary_format::errors::PartialVMResult;
77
use move_core_types::{account_address::AccountAddress, gas_algebra::InternalGas};
88
use move_vm_runtime::native_functions::{NativeContext, NativeFunction};

move-execution/v0/crates/move-stdlib/src/natives/hash.rs renamed to crates/move-stdlib-natives/src/hash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright (c) The Move Contributors
33
// SPDX-License-Identifier: Apache-2.0
44

5-
use crate::natives::helpers::make_module_natives;
5+
use crate::helpers::make_module_natives;
66
use move_binary_format::errors::PartialVMResult;
77
use move_core_types::gas_algebra::{InternalGas, InternalGasPerByte, NumBytes};
88
use move_vm_runtime::{

0 commit comments

Comments
 (0)