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

Validate WASM on txpool level before allowing upgrade tx #2080

Merged
merged 27 commits into from
Aug 15, 2024

Conversation

Dentosal
Copy link
Member

@Dentosal Dentosal commented Aug 14, 2024

Closes #2078

When submitting an Upgrade tx, validate the WASM before it can be added into the txpool. This is technically a breaking change, as previously-accepted but semantically invalid transactions are no longer accepted.

Checklist

  • Breaking changes are clearly marked as such in the PR description and changelog
  • New behavior is reflected in tests
  • The specification matches the implemented behavior (link update PR if changes are needed)

Before requesting review

  • I have reviewed the code myself
  • I have created follow-up issues caused by this PR and linked them here

@Dentosal Dentosal added breaking A breaking api change fuel-txpool labels Aug 14, 2024
@Dentosal Dentosal self-assigned this Aug 14, 2024
@Dentosal Dentosal added the wasm WASM-based block execution label Aug 14, 2024
@Dentosal Dentosal marked this pull request as ready for review August 14, 2024 16:08
@Dentosal Dentosal requested a review from a team August 14, 2024 16:08
crates/services/txpool/src/ports.rs Outdated Show resolved Hide resolved
crates/services/txpool/src/service.rs Outdated Show resolved Hide resolved
crates/services/txpool/src/test_helpers.rs Outdated Show resolved Hide resolved
crates/services/txpool/src/txpool.rs Show resolved Hide resolved
crates/services/upgradable-executor/src/executor.rs Outdated Show resolved Hide resolved
crates/types/src/services/executor.rs Outdated Show resolved Hide resolved
tests/tests/tx/upgrade.rs Show resolved Hide resolved
@@ -172,6 +178,16 @@ pub(crate) fn random_predicate(
.into_default_estimated()
}

pub struct MockWasmChecker;
Copy link
Member

Choose a reason for hiding this comment

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

nit: I'd name this Fake instead of Mock, since it's not "mocking" behavior.

Copy link
Member Author

Choose a reason for hiding this comment

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

The terminology seems to be all over the place, e.g. https://stackoverflow.com/questions/346372/whats-the-difference-between-faking-mocking-and-stubbing shows that there's no consensus around the naming. I don't think we them that consistently either.

@netrome netrome self-requested a review August 15, 2024 09:34
netrome
netrome previously approved these changes Aug 15, 2024
Copy link
Contributor

@netrome netrome left a comment

Choose a reason for hiding this comment

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

Looks good to me! 👍

crates/types/src/services/executor.rs Outdated Show resolved Hide resolved
crates/services/upgradable-executor/src/executor.rs Outdated Show resolved Hide resolved
crates/services/upgradable-executor/src/executor.rs Outdated Show resolved Hide resolved
@Dentosal Dentosal requested review from xgreenx and netrome August 15, 2024 14:25
@Dentosal Dentosal merged commit f4b6623 into master Aug 15, 2024
33 checks passed
@Dentosal Dentosal deleted the dento/validate-wasm-before-upgrade branch August 15, 2024 14:39
@xgreenx xgreenx mentioned this pull request Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A breaking api change fuel-txpool wasm WASM-based block execution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tx-pool Upgrade validity check
4 participants