-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set the gas parameter in the native function.
add license info add missed license info remove unused code update the git version of the Move library cargo fmt update Cargo.lock
- Loading branch information
stevenlaw123
committed
Sep 4, 2023
1 parent
d4bb08f
commit 8a12eaa
Showing
38 changed files
with
1,192 additions
and
104 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::natives::gas_parameter::native::MUL; | ||
use crate::natives::rooch_framework::account::GasParameters; | ||
|
||
crate::natives::gas_parameter::native::define_gas_parameters_for_natives!(GasParameters, "account", [ | ||
[.create_signer.base, "create_signer.base", (5 + 1) * MUL], | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::natives::gas_parameter::native::MUL; | ||
use moveos_stdlib::natives::moveos_stdlib::bcs::GasParameters; | ||
|
||
crate::natives::gas_parameter::native::define_gas_parameters_for_natives!(GasParameters, "bcd", [ | ||
[.from_bytes.base, "from_bytes.base", (5 + 1) * MUL], | ||
]); |
10 changes: 10 additions & 0 deletions
10
crates/rooch-framework/src/natives/gas_parameter/decoding.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::natives::gas_parameter::native::MUL; | ||
use crate::natives::rooch_framework::crypto::decoding::GasParameters; | ||
|
||
crate::natives::gas_parameter::native::define_gas_parameters_for_natives!(GasParameters, "decoding", [ | ||
[.base58.base, "base58.base", (5 + 1) * MUL], | ||
[.base58check.base, "base58check.base", (5 + 1) * MUL], | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::natives::gas_parameter::native::MUL; | ||
use crate::natives::rooch_framework::crypto::ecdsa_k1::GasParameters; | ||
|
||
crate::natives::gas_parameter::native::define_gas_parameters_for_natives!(GasParameters, "ecdsa_k1", [ | ||
[.verify.base, "verify.base", (5 + 1) * MUL], | ||
]); |
11 changes: 11 additions & 0 deletions
11
crates/rooch-framework/src/natives/gas_parameter/ecdsa_k1_recoverable.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::natives::gas_parameter::native::MUL; | ||
use crate::natives::rooch_framework::crypto::ecdsa_k1_recoverable::GasParameters; | ||
|
||
crate::natives::gas_parameter::native::define_gas_parameters_for_natives!(GasParameters, "ecdsa_k1_recoverable", [ | ||
[.verify.base, "verify.base", (5 + 1) * MUL], | ||
[.ecrecover.base, "ecrecover.base", (5 + 1) * MUL], | ||
[.decompress_pubkey.base, "decompress_pubkey.base", (5 + 1) * MUL], | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::natives::gas_parameter::native::MUL; | ||
use crate::natives::rooch_framework::crypto::ed25519::GasParameters; | ||
|
||
crate::natives::gas_parameter::native::define_gas_parameters_for_natives!(GasParameters, "ed25519", [ | ||
[.verify.base, "verify.base", (5 + 1) * MUL], | ||
]); |
13 changes: 13 additions & 0 deletions
13
crates/rooch-framework/src/natives/gas_parameter/encoding.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::natives::gas_parameter::native::MUL; | ||
use crate::natives::rooch_framework::crypto::encoding::GasParameters; | ||
|
||
crate::natives::gas_parameter::native::define_gas_parameters_for_natives!(GasParameters, "encoding", [ | ||
[.base58.base, "base58.base", (5 + 1) * MUL], | ||
[.base58check.base, "base58check.base", (5 + 1) * MUL], | ||
[.bech32.base, "bech32.base", (5 + 1) * MUL], | ||
[.p2pkh.base, "p2pkh.base", (5 + 1) * MUL], | ||
[.p2sh.base, "p2sh.base", (5 + 1) * MUL], | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::natives::gas_parameter::native::MUL; | ||
use moveos_stdlib::natives::moveos_stdlib::event::GasParameters; | ||
|
||
crate::natives::gas_parameter::native::define_gas_parameters_for_natives!(GasParameters, "events", [ | ||
[.emit.base, "emit.base", (52 + 1) * MUL], | ||
]); |
26 changes: 26 additions & 0 deletions
26
crates/rooch-framework/src/natives/gas_parameter/gas_member.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use std::collections::BTreeMap; | ||
|
||
/// A trait for converting from a map representation of the on-chain gas schedule. | ||
pub trait FromOnChainGasSchedule: Sized { | ||
/// Constructs a value of this type from a map representation of the on-chain gas schedule. | ||
/// `None` should be returned when the gas schedule is missing some required entries. | ||
/// Unused entries should be safely ignored. | ||
fn from_on_chain_gas_schedule(gas_schedule: &BTreeMap<String, u64>) -> Option<Self>; | ||
} | ||
|
||
/// A trait for converting to a list of entries of the on-chain gas schedule. | ||
pub trait ToOnChainGasSchedule { | ||
/// Converts `self` into a list of entries of the on-chain gas schedule. | ||
/// Each entry is a key-value pair where the key is a string representing the name of the | ||
/// parameter, where the value is the gas parameter itself. | ||
fn to_on_chain_gas_schedule(&self) -> Vec<(String, u64)>; | ||
} | ||
|
||
/// A trait for defining an initial value to be used in the genesis. | ||
pub trait InitialGasSchedule: Sized { | ||
/// Returns the initial value of this type, which is used in the genesis. | ||
fn initial() -> Self; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::natives::gas_parameter::native::MUL; | ||
use crate::natives::rooch_framework::crypto::hash::GasParameters; | ||
|
||
crate::natives::gas_parameter::native::define_gas_parameters_for_natives!(GasParameters, "hash", [ | ||
[.keccak256.base, "keccak256.base", (5 + 1) * MUL], | ||
[.blake2b256.base, "blake2b256.base", (5 + 1) * MUL], | ||
[.ripemd160.base, "ripemd160.base", (5 + 1) * MUL], | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
mod account; | ||
mod bcd; | ||
mod decoding; | ||
mod ecdsa_k1; | ||
mod ecdsa_k1_recoverable; | ||
mod ed25519; | ||
mod encoding; | ||
mod events; | ||
pub mod gas_member; | ||
mod hash; | ||
mod move_module; | ||
pub mod move_std; | ||
pub mod native; | ||
pub mod nursery; | ||
mod rlp; | ||
mod schnorr; | ||
mod signer; | ||
mod table_extension; | ||
mod test_helper; | ||
mod type_info; |
16 changes: 16 additions & 0 deletions
16
crates/rooch-framework/src/natives/gas_parameter/move_module.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::natives::gas_parameter::native::MUL; | ||
use moveos_stdlib::natives::moveos_stdlib::move_module::GasParameters; | ||
|
||
crate::natives::gas_parameter::native::define_gas_parameters_for_natives!(GasParameters, "move_module", [ | ||
[.module_name_inner.base, "module_name_inner.base", (5 + 1) * MUL], | ||
[.module_name_inner.per_byte_in_str, "module_name_inner.per_byte_in_str", (5 + 1) * MUL], | ||
[.verify_modules_inner.base, "verify_modules_inner.base", (5 + 1) * MUL], | ||
[.verify_modules_inner.per_byte, "verify_modules_inner.per_byte", (5 + 1) * MUL], | ||
[.request_init_functions.base, "request_init_functions.base", (5 + 1) * MUL], | ||
[.request_init_functions.per_byte, "request_init_functions.per_byte", (5 + 1) * MUL], | ||
[.check_compatibililty_inner.base, "check_compatibililty_inner.base", (5 + 1) * MUL], | ||
[.check_compatibililty_inner.per_byte, "check_compatibililty_inner.per_byte", (5 + 1) * MUL], | ||
]); |
32 changes: 32 additions & 0 deletions
32
crates/rooch-framework/src/natives/gas_parameter/move_std.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::natives::gas_parameter::native::MUL; | ||
use move_stdlib::natives::GasParameters; | ||
|
||
// modify should with impl From<VMConfig> for GasSchedule | ||
crate::natives::gas_parameter::native::define_gas_parameters_for_natives!(GasParameters, "move_stdlib", [ | ||
[.bcs.to_bytes.per_byte_serialized, "bcs.to_bytes.per_byte_serialized", (181 + 1) * MUL], | ||
[.bcs.to_bytes.failure, "bcs.to_bytes.failure", (181 + 1) * MUL], | ||
[.bcs.to_bytes.legacy_min_output_size, "bcs.to_bytes.legacy_min_output_size", MUL], | ||
|
||
[.hash.sha2_256.per_byte, "hash.sha2_256.per_byte", (21 + 1) * MUL], | ||
[.hash.sha2_256.legacy_min_input_len, "hash.sha2_256.legacy_min_input_len", MUL], | ||
[.hash.sha3_256.per_byte, "hash.sha3_256.per_byte", (64 + 1) * MUL], | ||
[.hash.sha3_256.legacy_min_input_len, "hash.sha3_256.legacy_min_input_len", MUL], | ||
|
||
[.signer.borrow_address.base, "signer.borrow_address.base", (353 + 1) * MUL], | ||
|
||
[.string.check_utf8.per_byte, optional "string.check_utf8.per_byte", (4 + 1) * MUL], | ||
[.string.is_char_boundary.base, optional "string.is_char_boundary.base", (4 + 1) * MUL], | ||
[.string.sub_string.per_byte, optional "string.sub_string.per_byte", (4 + 1) * MUL], | ||
[.string.index_of.per_byte_searched, optional "string.index_of.per_byte_searched", (4 + 1) * MUL], | ||
|
||
[.vector.length.base, "vector.length.base", (98 + 1) * MUL], | ||
[.vector.empty.base, "vector.empty.base", (84 + 1) * MUL], | ||
[.vector.borrow.base, "vector.borrow.base", (1334 + 1) * MUL], | ||
[.vector.push_back.legacy_per_abstract_memory_unit, "vector.push_back.legacy_per_abstract_memory_unit", (53 + 1) * MUL], | ||
[.vector.pop_back.base, "vector.pop_back.base", (227 + 1) * MUL], | ||
[.vector.destroy_empty.base, "vector.destroy_empty.base", (572 + 1) * MUL], | ||
[.vector.swap.base, "vector.swap.base", (1436 + 1) * MUL], | ||
], allow_unmapped = 2); |
Oops, something went wrong.