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

runtime: test that signext and saturating ops are disabled #8921

Merged
merged 4 commits into from
Apr 20, 2023

Conversation

nagisa
Copy link
Collaborator

@nagisa nagisa commented Apr 18, 2023

These are not currently supported and any decision to enable them should
be a intentional decision, not an accidental one.

Overall these changes are no-op since the deserialization will fail
earlier when trying to deserialize with pwasm deserializer, but if and
when we eventually get rid of it, it would be nice if these extensions
didn't accidentally get enabled.

This puts to rest the question raised in #8886 (comment).

@nagisa nagisa added S-automerge A-contract-runtime Area: contract compilation and execution, virtual machines, etc T-contract-runtime Team: issues relevant to the contract runtime team labels Apr 18, 2023
@nagisa nagisa requested a review from a team as a code owner April 18, 2023 10:58
@nagisa nagisa force-pushed the nagisa/disable-signext+saturating branch 2 times, most recently from 26e31da to cdb5451 Compare April 18, 2023 13:31
@nagisa nagisa changed the title runtime: test that signexgt and saturating ops are disabled runtime: test that signext and saturating ops are disabled Apr 18, 2023
Copy link
Contributor

@jakmeier jakmeier left a comment

Choose a reason for hiding this comment

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

Thanks for coming back to this! I agree it's better to have them disabled if they weren't supported and if we would fail parsing them earlier anyway.

Comment on lines +404 to +413
#[cfg(feature = "nightly")]
tb.expect(expect![[r#"
VMOutcome: balance 4 storage_usage 12 return data None burnt gas 48450963 used gas 48450963
Err: PrepareError: Error happened while deserializing the module.
"#]]);
#[cfg(not(feature = "nightly"))]
tb.expect(expect![[r#"
VMOutcome: balance 4 storage_usage 12 return data None burnt gas 0 used gas 0
Err: PrepareError: Error happened while deserializing the module.
"#]]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure but I guess feature = "nightly" has a different gas cost because of ProtocolFeature::FixContractLoadingCost, right?
If that is the case, wouldn't it be better to use #[cfg(feature = "protocol_feature_fix_contract_loading_cost")] instead? Makes the reason why we have the flag self-descriptive.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I sort of avoided looking too deeply into what exact reason for the difference is – when this change gets promoted to a proper feature (or is removed) the test will fail anyhow and the other branch then can be removed & I don't think it is beneficial to hold tests to the same level of rigour as we do for the regular kind of code in this instance.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok fair enough, I guess we can merge it then

Comment on lines +404 to +413
#[cfg(feature = "nightly")]
tb.expect(expect![[r#"
VMOutcome: balance 4 storage_usage 12 return data None burnt gas 48450963 used gas 48450963
Err: PrepareError: Error happened while deserializing the module.
"#]]);
#[cfg(not(feature = "nightly"))]
tb.expect(expect![[r#"
VMOutcome: balance 4 storage_usage 12 return data None burnt gas 0 used gas 0
Err: PrepareError: Error happened while deserializing the module.
"#]]);
Copy link
Contributor

Choose a reason for hiding this comment

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

ok fair enough, I guess we can merge it then

nagisa added 2 commits April 20, 2023 16:05
These are not currently supported and any decision to enable them should
be a intentional decision, not an accidental one.
Overall these changes are no-op since the deserialization will fail
earlier when trying to deserialize with pwasm deserializer, but if and
when we eventually get rid of it, it would be nice if these extensions
didn't accidentally get enabled.
Copy link
Contributor

@aborg-dev aborg-dev left a comment

Choose a reason for hiding this comment

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

Can't provide much insight with my review, but the general premise makes sense to me

(this required to rebase for me to reproduce locally… 🤦)
@nagisa nagisa force-pushed the nagisa/disable-signext+saturating branch from 0d7ee05 to b66db47 Compare April 20, 2023 13:25
@near-bulldozer near-bulldozer bot merged commit 0c4a09a into master Apr 20, 2023
@near-bulldozer near-bulldozer bot deleted the nagisa/disable-signext+saturating branch April 20, 2023 13:53
nikurt pushed a commit that referenced this pull request Apr 25, 2023
These are not currently supported and any decision to enable them should
be a intentional decision, not an accidental one.

Overall these changes are no-op since the deserialization will fail
earlier when trying to deserialize with pwasm deserializer, but if and
when we eventually get rid of it, it would be nice if these extensions
didn't accidentally get enabled.

This puts to rest the question raised in #8886 (comment).
nikurt pushed a commit that referenced this pull request Apr 28, 2023
These are not currently supported and any decision to enable them should
be a intentional decision, not an accidental one.

Overall these changes are no-op since the deserialization will fail
earlier when trying to deserialize with pwasm deserializer, but if and
when we eventually get rid of it, it would be nice if these extensions
didn't accidentally get enabled.

This puts to rest the question raised in #8886 (comment).
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 T-contract-runtime Team: issues relevant to the contract runtime team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants