Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rename starcoin-natives to starcoin-frameworks #4189

Merged
merged 3 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 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 @@ -71,7 +71,7 @@ members = [
"rpc/server",
"vm/types",
"vm/vm-runtime",
"vm/natives",
"vm/frameworks",
"vm/stdlib",
"vm/compiler",
"vm/move-prover",
Expand Down Expand Up @@ -183,7 +183,7 @@ default-members = [
"rpc/server",
"vm/types",
"vm/vm-runtime",
"vm/natives",
"vm/frameworks",
"vm/stdlib",
"vm/compiler",
"vm/move-prover",
Expand Down Expand Up @@ -465,7 +465,7 @@ starcoin-move-compiler = { path = "vm/compiler" }
starcoin-move-explain = { path = "vm/move-explain" }
starcoin-gas-algebra-ext = { path = "vm/gas-algebra-ext" }
starcoin-gas-meter = { path = "vm/starcoin-gas-meter" }
starcoin-natives = { path = "vm/natives" }
starcoin-frameworks = { path = "vm/frameworks" }
starcoin-network = { path = "network" }
starcoin-network-rpc = { path = "network-rpc" }
starcoin-network-rpc-api = { path = "network-rpc/api" }
Expand Down
2 changes: 1 addition & 1 deletion vm/natives/Cargo.toml → vm/frameworks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ testing = ["move-stdlib/testing"]
[package]
authors = { workspace = true }
edition = { workspace = true }
name = "starcoin-natives"
name = "starcoin-frameworks"
version = "2.0.1"
homepage = { workspace = true }
license = { workspace = true }
Expand Down
2 changes: 2 additions & 0 deletions vm/frameworks/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// ref aptos-core/aptos-move/framework/src/lib.rs
pub mod natives;
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,5 @@ pub fn make_all(gas_params: GasParameters) -> impl Iterator<Item = (String, Nati
),
];

crate::helpers::make_module_natives(natives)
crate::natives::helpers::make_module_natives(natives)
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::util::make_native_from_func;
use crate::natives::util::make_native_from_func;
use move_binary_format::errors::{PartialVMError, PartialVMResult};
use move_core_types::gas_algebra::{InternalGas, InternalGasPerByte, NumBytes};
use move_core_types::vm_status::StatusCode;
Expand Down Expand Up @@ -73,5 +73,5 @@ pub fn make_all(gas_params: GasParameters) -> impl Iterator<Item = (String, Nati
"from_bytes",
make_native_from_func(gas_params, native_from_bytes),
)];
crate::helpers::make_module_natives(natives)
crate::natives::helpers::make_module_natives(natives)
}
8 changes: 4 additions & 4 deletions vm/natives/src/hash.rs → vm/frameworks/src/natives/hash.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::util::make_native_from_func;
use crate::natives::util::make_native_from_func;
use move_binary_format::errors::PartialVMResult;
use move_core_types::gas_algebra::{InternalGas, InternalGasPerByte, NumBytes};
use move_vm_runtime::native_functions::{NativeContext, NativeFunction};
Expand Down Expand Up @@ -38,7 +38,7 @@ pub fn native_keccak_256(

let cost = gas_params.base + gas_params.per_byte * NumBytes::new(input_arg.len() as u64);

let output = crate::ecrecover::keccak(input_arg.as_slice());
let output = crate::natives::ecrecover::keccak(input_arg.as_slice());

Ok(NativeResult::ok(cost, smallvec![Value::vector_u8(output)]))
}
Expand Down Expand Up @@ -100,7 +100,7 @@ pub fn make_all(gas_params: GasParameters) -> impl Iterator<Item = (String, Nati
),
];

crate::helpers::make_module_natives(natives)
crate::natives::helpers::make_module_natives(natives)
}

#[cfg(test)]
Expand All @@ -111,7 +111,7 @@ mod test {
#[test]
fn test_keccak() {
let input: Vec<u8> = FromHex::from_hex("616263").unwrap();
let output = crate::ecrecover::keccak(input.as_slice());
let output = crate::natives::ecrecover::keccak(input.as_slice());
let expect_output: Vec<u8> =
FromHex::from_hex("4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45")
.unwrap();
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
**************************************************************************************************/

use crate::util::make_native_from_func;
use crate::natives::util::make_native_from_func;
use move_binary_format::errors::PartialVMResult;
use move_core_types::gas_algebra::{InternalGas, InternalGasPerArg, NumArgs};
use move_vm_runtime::native_functions::{NativeContext, NativeFunction};
Expand Down Expand Up @@ -102,5 +102,5 @@ pub fn make_all(gas_params: GasParameters) -> impl Iterator<Item = (String, Nati
make_native_from_func(gas_params, native_ecdsa_recover),
)];

crate::helpers::make_module_natives(natives)
crate::natives::helpers::make_module_natives(natives)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::ecrecover::{make_native_ecrecover, EcrecoverGasParameters};
use crate::natives::ecrecover::{make_native_ecrecover, EcrecoverGasParameters};
use move_binary_format::errors::PartialVMResult;
use move_core_types::gas_algebra::{InternalGas, InternalGasPerByte, NumBytes};
use move_vm_runtime::native_functions::{NativeContext, NativeFunction};
Expand Down Expand Up @@ -131,5 +131,5 @@ pub fn make_all(gas_params: GasParameters) -> impl Iterator<Item = (String, Nati
),
];

crate::helpers::make_module_natives(natives)
crate::natives::helpers::make_module_natives(natives)
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub struct GasParameters {
pub fn make_all(gas_params: GasParameters) -> impl Iterator<Item = (String, NativeFunction)> {
let natives = [("name_of", make_native_token_name_of(gas_params.name_of))];

crate::helpers::make_module_natives(natives)
crate::natives::helpers::make_module_natives(natives)
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions vm/natives/src/u256.rs → vm/frameworks/src/natives/u256.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::util::make_native_from_func;
use crate::natives::util::make_native_from_func;
use move_binary_format::errors::{PartialVMError, PartialVMResult};
use move_core_types::gas_algebra::{InternalGas, InternalGasPerByte, NumBytes};
use move_core_types::vm_status::StatusCode;
Expand Down Expand Up @@ -215,5 +215,5 @@ pub fn make_all(gas_params: GasParameters) -> impl Iterator<Item = (String, Nati
),
];

crate::helpers::make_module_natives(natives)
crate::natives::helpers::make_module_natives(natives)
}
File renamed without changes.
2 changes: 1 addition & 1 deletion vm/gas-algebra-ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ move-stdlib = { workspace = true }
move-table-extension = { workspace = true }
move-vm-types = { workspace = true }
move-vm-test-utils = { workspace = true }
starcoin-natives = { workspace = true }
starcoin-frameworks = { workspace = true }
serde = { workspace = true }


Expand Down
2 changes: 1 addition & 1 deletion vm/gas-algebra-ext/src/starcoin_framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use crate::gas_meter::EXECUTION_GAS_MULTIPLIER as MUL;
use starcoin_natives::GasParameters;
use starcoin_frameworks::natives::GasParameters;

// see starcoin/vm/types/src/on_chain_config/genesis_gas_schedule.rs
// same order as from https://github.com/starcoinorg/starcoin-framework/blob/main/sources/VMConfig.move#native_schedule
Expand Down
2 changes: 1 addition & 1 deletion vm/starcoin-gas-meter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ move-core-types = { workspace = true }
move-stdlib = { workspace = true }
move-table-extension = { workspace = true }
move-vm-types = { workspace = true }
starcoin-natives = { workspace = true }
starcoin-frameworks = { workspace = true }
starcoin-logger = { workspace = true }

[package]
Expand Down
4 changes: 2 additions & 2 deletions vm/starcoin-gas-meter/src/gas_meter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const MIN_EXISTS_DATA_SIZE: AbstractMemorySize = AbstractMemorySize::new(100);
pub struct NativeGasParameters {
pub move_stdlib: move_stdlib::natives::GasParameters,
pub nursery: move_stdlib::natives::NurseryGasParameters,
pub starcoin_natives: starcoin_natives::GasParameters,
pub starcoin_natives: starcoin_frameworks::natives::GasParameters,
pub table: move_table_extension::GasParameters,
}

Expand Down Expand Up @@ -70,7 +70,7 @@ impl NativeGasParameters {
Self {
move_stdlib: move_stdlib::natives::GasParameters::zeros(),
nursery: move_stdlib::natives::NurseryGasParameters::zeros(),
starcoin_natives: starcoin_natives::GasParameters::zeros(),
starcoin_natives: starcoin_frameworks::natives::GasParameters::zeros(),
table: move_table_extension::GasParameters::zeros(),
}
}
Expand Down
4 changes: 2 additions & 2 deletions vm/vm-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ num_enum = { workspace = true }
rand = { workspace = true }
rand_core = { default-features = false, workspace = true }
starcoin-logger = { workspace = true }
starcoin-natives = { workspace = true }
starcoin-frameworks = { workspace = true }
starcoin-types = { workspace = true }
starcoin-vm-types = { workspace = true }
move-stdlib = { workspace = true }
Expand All @@ -44,5 +44,5 @@ stdlib = { workspace = true }
[features]
default = ["metrics"]
metrics = ["starcoin-metrics"]
testing = ["move-stdlib/testing", "starcoin-natives/testing"]
testing = ["move-stdlib/testing", "starcoin-frameworks/testing"]
force-deploy = []
14 changes: 7 additions & 7 deletions vm/vm-runtime/src/natives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ pub fn starcoin_natives(gas_params: NativeGasParameters) -> NativeFunctionTable
);
add_natives_from_module!(
"Hash",
starcoin_natives::hash::make_all(gas_params.starcoin_natives.hash)
starcoin_frameworks::natives::hash::make_all(gas_params.starcoin_natives.hash)
);
add_natives_from_module!(
"BCS",
move_stdlib::natives::bcs::make_all(gas_params.move_stdlib.bcs)
);
add_natives_from_module!(
"FromBCS",
starcoin_natives::from_bcs::make_all(gas_params.starcoin_natives.from_bcs)
starcoin_frameworks::natives::from_bcs::make_all(gas_params.starcoin_natives.from_bcs)
);
add_natives_from_module!(
"Signature",
starcoin_natives::signature::make_all(gas_params.starcoin_natives.signature)
starcoin_frameworks::natives::signature::make_all(gas_params.starcoin_natives.signature)
);
add_natives_from_module!(
"Vector",
Expand All @@ -53,19 +53,19 @@ pub fn starcoin_natives(gas_params: NativeGasParameters) -> NativeFunctionTable
);
add_natives_from_module!(
"Account",
starcoin_natives::account::make_all(gas_params.starcoin_natives.account)
starcoin_frameworks::natives::account::make_all(gas_params.starcoin_natives.account)
);
add_natives_from_module!(
"Signer",
move_stdlib::natives::signer::make_all(gas_params.move_stdlib.signer)
);
add_natives_from_module!(
"Token",
starcoin_natives::token::make_all(gas_params.starcoin_natives.token)
starcoin_frameworks::natives::token::make_all(gas_params.starcoin_natives.token)
);
add_natives_from_module!(
"U256",
starcoin_natives::u256::make_all(gas_params.starcoin_natives.u256)
starcoin_frameworks::natives::u256::make_all(gas_params.starcoin_natives.u256)
);
#[cfg(feature = "testing")]
add_natives_from_module!(
Expand All @@ -82,7 +82,7 @@ pub fn starcoin_natives(gas_params: NativeGasParameters) -> NativeFunctionTable
);
add_natives_from_module!(
"Secp256k1",
starcoin_natives::secp256k1::make_all(gas_params.starcoin_natives.secp256k1)
starcoin_frameworks::natives::secp256k1::make_all(gas_params.starcoin_natives.secp256k1)
);

let natives = make_table_from_iter(CORE_CODE_ADDRESS, natives);
Expand Down
Loading