Skip to content

call validate in pre_dispatch to have same validations #1375

Merged
sam0x17 merged 1 commit intoopentensor:devnet-readyfrom
ParthDesai:fix-tx-extension
Mar 9, 2025
Merged

call validate in pre_dispatch to have same validations #1375
sam0x17 merged 1 commit intoopentensor:devnet-readyfrom
ParthDesai:fix-tx-extension

Conversation

@ParthDesai
Copy link
Contributor

@ParthDesai ParthDesai commented Mar 7, 2025

Description

This PR fixes a bug in the runtime which can allow malicious block author to include invalid txs in a block. It fixes the issue by doing the same checks as validate in pre_dispatch method of SubtensorSignedExtension.

The inclusion of same checks in pre_dispatch mean that the checks are being run during Executive::apply_extrinsic when the block is being executed against the current state.

Related Issue(s)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Other (please describe):

Breaking Change

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have run cargo fmt and cargo clippy to ensure my code is formatted and linted correctly
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Screenshots (if applicable)

Additional Notes

@sam0x17 sam0x17 requested review from camfairchild and gztensor March 7, 2025 15:41
@sam0x17
Copy link
Contributor

sam0x17 commented Mar 7, 2025

please change this to merge into devnet-ready ;)

@ParthDesai ParthDesai changed the base branch from main to devnet-ready March 7, 2025 15:48
@ParthDesai
Copy link
Contributor Author

ParthDesai commented Mar 7, 2025

please change this to merge into devnet-ready ;)

Done and rebased to devnet-ready. @sam0x17

@sam0x17 sam0x17 merged commit 69e3a43 into opentensor:devnet-ready Mar 9, 2025
15 of 17 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.

2 participants