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

feature: Stabilize Compute Costs #8892

Closed
wants to merge 1 commit into from

Conversation

aborg-dev
Copy link
Contributor

@aborg-dev aborg-dev commented Apr 6, 2023

Remove the compile time feature "protocol_feature_compute_costs" and replace all checks in the code to look at the current protocol version instead.

@aborg-dev aborg-dev force-pushed the compute_costs_stabilization branch from eb03ed5 to d4cb8dc Compare April 6, 2023 09:46
@aborg-dev aborg-dev requested a review from jakmeier April 6, 2023 09:46
@aborg-dev aborg-dev added the A-contract-runtime Area: contract compilation and execution, virtual machines, etc label Apr 6, 2023
@aborg-dev aborg-dev marked this pull request as ready for review April 6, 2023 09:46
@aborg-dev aborg-dev requested a review from a team as a code owner April 6, 2023 09:46
Comment on lines +2561 to +2572
let sha256_cost = ParameterCost {
gas: Gas::from(1_000_000u64),
compute: if checked_feature!(
"stable",
ComputeCosts,
apply_state.current_protocol_version
) {
Compute::from(10_000_000_000_000u64)
} else {
Compute::from(1_000_000u64)
},
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Unless you want to add a test that checks a version before the feature was added, I don't think you need this checked_feature!, right? (Assuming we bump the protocol version first)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've addressed this in #8915

@@ -238,6 +242,7 @@ impl ProtocolFeature {
ProtocolFeature::Ed25519Verify
| ProtocolFeature::ZeroBalanceAccount
| ProtocolFeature::DelegateAction => 59,
ProtocolFeature::ComputeCosts => 61,
Copy link
Contributor

Choose a reason for hiding this comment

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

When (or before) we can put stable protocol features to version 61, we have to bump STABLE_PROTOCOL_VERSION to 61. We usually do it in the same PR as the feature stabilization, so you can do it directly in this PR. That should also make stable tests easier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've addressed this in #8915

@aborg-dev
Copy link
Contributor Author

I've replaced this PR with #8915

@aborg-dev aborg-dev closed this Apr 17, 2023
near-bulldozer bot pushed a commit that referenced this pull request Apr 18, 2023
This PR re-introduces changes from #8805 together with #8892 after fixing #8908:

The PR addresses #8265 by introducing aggregation of compute usage across all operations performed during chunk application and limiting this compute usage to 1s.

This should not change the behavior of nodes in the short run because compute costs match gas costs which is validated by the assert, so any discrepancy should be caught on canary nodes.
nikurt pushed a commit that referenced this pull request Apr 18, 2023
This PR re-introduces changes from #8805 together with #8892 after fixing #8908:

The PR addresses #8265 by introducing aggregation of compute usage across all operations performed during chunk application and limiting this compute usage to 1s.

This should not change the behavior of nodes in the short run because compute costs match gas costs which is validated by the assert, so any discrepancy should be caught on canary nodes.
nikurt pushed a commit that referenced this pull request Apr 18, 2023
This PR re-introduces changes from #8805 together with #8892 after fixing #8908:

The PR addresses #8265 by introducing aggregation of compute usage across all operations performed during chunk application and limiting this compute usage to 1s.

This should not change the behavior of nodes in the short run because compute costs match gas costs which is validated by the assert, so any discrepancy should be caught on canary nodes.
nikurt pushed a commit that referenced this pull request Apr 25, 2023
This PR re-introduces changes from #8805 together with #8892 after fixing #8908:

The PR addresses #8265 by introducing aggregation of compute usage across all operations performed during chunk application and limiting this compute usage to 1s.

This should not change the behavior of nodes in the short run because compute costs match gas costs which is validated by the assert, so any discrepancy should be caught on canary nodes.
nikurt pushed a commit that referenced this pull request Apr 25, 2023
This PR re-introduces changes from #8805 together with #8892 after fixing #8908:

The PR addresses #8265 by introducing aggregation of compute usage across all operations performed during chunk application and limiting this compute usage to 1s.

This should not change the behavior of nodes in the short run because compute costs match gas costs which is validated by the assert, so any discrepancy should be caught on canary nodes.
nikurt pushed a commit that referenced this pull request Apr 28, 2023
This PR re-introduces changes from #8805 together with #8892 after fixing #8908:

The PR addresses #8265 by introducing aggregation of compute usage across all operations performed during chunk application and limiting this compute usage to 1s.

This should not change the behavior of nodes in the short run because compute costs match gas costs which is validated by the assert, so any discrepancy should be caught on canary nodes.
@aborg-dev aborg-dev deleted the compute_costs_stabilization branch June 12, 2023 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contract-runtime Area: contract compilation and execution, virtual machines, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants