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

Gas Profiling Implementation #2616

Merged
merged 8 commits into from
Sep 24, 2024

Conversation

steelgeek091
Copy link
Collaborator

No description provided.

Copy link

vercel bot commented Sep 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rooch-portal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 24, 2024 2:27am
rooch-portal-v2.1 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 24, 2024 2:27am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
rooch ⬜️ Ignored (Inspect) Visit Preview Sep 24, 2024 2:27am

enable the gas event recording

finish the gas profiling

convert linear gas event list to stacked

implement flamegraph for execution

cargo clippy

render html template

add the content of the execution trace

Put the gas profiling in moveos repo

implement ClassifiedGasMeter and SwitchableGasMeter for GasProfiler

cargo fmt

add function execute_tx_locally

add an command line argument for getStates command

integrate gas profiler into the tx execution flow
@@ -146,7 +146,12 @@ impl Handler<StatesMessage> for ReaderExecutorActor {
msg: StatesMessage,
_ctx: &mut ActorContext,
) -> Result<Vec<Option<ObjectState>>, anyhow::Error> {
let resolver = RootObjectResolver::new(self.root.clone(), &self.moveos_store);
let resolver = if let Some(state_root) = msg.state_root {
let root_object_meta = ObjectMeta::root_metadata(state_root, 55);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How should we handle the size parameter?
Should it be passed from the client or retrieved from Node?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way to implement it is to modify the state_resolver StateReader trait to support get_states and list_states by state root, so there is no need to construct a new RootObject

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the read-only case, the VM do not use the size param, it can be zero.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is workable to implement this by directly setting the RootObject size to 0, but is there any ambiguity in constructing the RootObject for any state root query, such as the state root of a child object tree?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The size is used by the ObjectRuntime; if the contract removes an element, the size will reduce. We do not record all Global root objects. This is a workaround solution; we will need to refactor in the future.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not need to record all Global root objects , just modify the state_resolver StateReader trait to support get_states and list_states by state root , and it can elegantly solve the querying arbitrary state root scenarios.
It can be put in the subsequent refactor.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a StatelessResolver, which supports get_states by root; StateResolver is for the pin on a state_root and get states many times.

@@ -146,7 +146,12 @@ impl Handler<StatesMessage> for ReaderExecutorActor {
msg: StatesMessage,
_ctx: &mut ActorContext,
) -> Result<Vec<Option<ObjectState>>, anyhow::Error> {
let resolver = RootObjectResolver::new(self.root.clone(), &self.moveos_store);
let resolver = if let Some(state_root) = msg.state_root {
let root_object_meta = ObjectMeta::root_metadata(state_root, 55);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the read-only case, the VM do not use the size param, it can be zero.

@steelgeek091 steelgeek091 merged commit 1ca6eb3 into rooch-network:main Sep 24, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants