Skip to content

Address POV Underestimations and remove base cost#243

Closed
TarekkMA wants to merge 22 commits intomoonbeam-polkadot-stable2409from
tarekkma/remove-base-cost
Closed

Address POV Underestimations and remove base cost#243
TarekkMA wants to merge 22 commits intomoonbeam-polkadot-stable2409from
tarekkma/remove-base-cost

Conversation

@TarekkMA
Copy link
Copy Markdown

No description provided.

@TarekkMA TarekkMA force-pushed the tarekkma/remove-base-cost branch from b06e9eb to 3588cb9 Compare March 28, 2025 14:21
@TarekkMA TarekkMA requested a review from Copilot April 8, 2025 11:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (3)

frame/evm/src/runner/stack.rs:316

  • By directly assigning actual_proof_size from measured_proof_size_after without subtracting any prior value, the previous proof cost is entirely dropped; please verify that this behavior correctly implements the intended removal of the base cost.
let actual_proof_size = measured_proof_size_after;

frame/ethereum/src/lib.rs:404

  • [nitpick] Consider adding a comment here to explain why the condition 'weight_limit.proof_size() > 0' is used to determine transaction eligibility, which would help clarify the rationale behind transitioning to proof_size_pre_execution.
if weight_limit.proof_size() > 0 {

frame/evm/src/tests.rs:103

  • [nitpick] Tests have been updated to pass 0 instead of Some(0); please ensure that there are also test cases covering scenarios where a non-zero proof_size_pre_execution is provided to validate the new logic.
weight_limit, 0,

@TarekkMA TarekkMA force-pushed the moonbeam-polkadot-stable2409 branch from 541643c to 5fdde97 Compare April 9, 2025 13:44
),
_ => (None, None),
);
let proof_size_pre_execution = get_proof_size().unwrap_or_default();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

get_proof_size return the proof size consumed buy the whole block so far, it's not per transaction (expect at tax validation). So, tests with one transaction might pass but it will not work with several transactions

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is the proof_size pre execution, used later to compute the PoV difference between after and before evm call. The base cost should no longer be necessary after paritytech/polkadot-sdk#4765

Context: polkadot-evm#1490 (comment)

Copy link
Copy Markdown

@librelois librelois left a comment

Choose a reason for hiding this comment

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

The host function get_proof_size return the current PoV consumed buy the block under construction, so we can't use it to measure the pov consumed by the transaction pre execution.

Copy link
Copy Markdown

@librelois librelois left a comment

Choose a reason for hiding this comment

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

proof_size_pre_execution seeems to be never used, you should use it to compute the actual_proof_size

Copy link
Copy Markdown

@librelois librelois left a comment

Choose a reason for hiding this comment

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

In case of underestimation, the actual_proof_size should be normalize to the maximum that can be consumed according to the gas limit

@RomarQ
Copy link
Copy Markdown

RomarQ commented Apr 29, 2025

Added this commit to enable the CI: 4ab4997

We need to merge the changes from moonbeam-polkadot-stable2409 to this branch and fix all PoV related errors.

@RomarQ RomarQ changed the base branch from moonbeam-polkadot-stable2409 to moonbeam-polkadot-stable2412 April 29, 2025 14:23
@RomarQ RomarQ changed the base branch from moonbeam-polkadot-stable2412 to moonbeam-polkadot-stable2409 April 29, 2025 14:24
let _ = weight_limit
.proof_size()
.checked_sub(proof_size_base_cost)
.checked_sub(proof_size_pre_execution)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This does not seem right, I would say that this check is no longer necessary

@librelois librelois closed this Mar 16, 2026
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.

4 participants