Skip to content

Commit

Permalink
Put the gas profiling in moveos repo
Browse files Browse the repository at this point in the history
  • Loading branch information
shelmesky committed Sep 18, 2024
1 parent 45a2789 commit c79e00b
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 19 deletions.
31 changes: 16 additions & 15 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ members = [
"moveos/raw-store",
"moveos/smt",
"moveos/moveos-eventbus",
"moveos/moveos-gas-profiling",
"crates/data_verify",
"crates/rooch",
"crates/rooch-benchmarks",
Expand Down Expand Up @@ -49,7 +50,6 @@ members = [
"crates/rooch-event",
"crates/testsuite",
"crates/rooch-ord",
"crates/rooch-gas-profiling",
"frameworks/bitcoin-move",
"frameworks/framework-builder",
"frameworks/framework-release",
Expand Down Expand Up @@ -97,6 +97,7 @@ moveos-object-runtime = { path = "moveos/moveos-object-runtime" }
moveos-compiler = { path = "moveos/moveos-compiler" }
moveos-eventbus = { path = "moveos/moveos-eventbus" }
accumulator = { path = "moveos/moveos-commons/accumulator" }
moveos-gas-profiling = { path = "moveos/moveos-gas-profiling" }

# crates for Rooch
rooch = { path = "crates/rooch" }
Expand Down Expand Up @@ -130,7 +131,6 @@ data-verify = { path = "crates/data_verify" }
rooch-db = { path = "crates/rooch-db" }
rooch-event = { path = "crates/rooch-event" }
rooch-ord = { path = "crates/rooch-ord" }
rooch-gas-profiling = { path = "crates/rooch-gas-profiling" }

# frameworks
framework-types = { path = "frameworks/framework-types" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "rooch-gas-profiling"
name = "moveos-gas-profiling"

# Workspace inherited keys
version = { workspace = true }
Expand All @@ -20,4 +20,6 @@ anyhow = { workspace = true }
regex = { workspace = true }
serde_json = { workspace = true }
smallvec = { workspace = true }
handlebars = { workspace = true }
handlebars = { workspace = true }

moveos-types = { workspace = true }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use move_core_types::language_storage::{ModuleId, TypeTag};
use move_vm_types::gas::{GasMeter, SimpleInstruction};
use move_vm_types::natives::function::PartialVMResult;
use move_vm_types::views::{TypeView, ValueView};
use moveos_types::transaction::{VerifiedMoveAction, VerifiedMoveOSTransaction};

pub struct GasProfiler<G> {
base: G,
Expand Down Expand Up @@ -426,3 +427,25 @@ impl<G: GasMeter> GasProfiler<G> {
}
}
}

pub fn new_gas_profiler<G>(tx: VerifiedMoveOSTransaction, base_gas_meter: G) -> GasProfiler<G> {
match tx.action {
VerifiedMoveAction::Script { .. } => {
unreachable!(
"Script payload is not supported yet"
)
}
VerifiedMoveAction::Function {
call,
bypass_visibility: _,
} => GasProfiler::new_function(
base_gas_meter,
call.function_id.module_id,
call.function_id.function_name,
call.ty_args,
),
VerifiedMoveAction::ModuleBundle { .. } => {
unreachable!("ModuleBundle payload is not supported yet")
}
}
}
File renamed without changes.
File renamed without changes.

0 comments on commit c79e00b

Please sign in to comment.