-
Notifications
You must be signed in to change notification settings - Fork 54
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
Chain: Test oversized scripts #387
Chain: Test oversized scripts #387
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love the change, minor suggestions
9df6121
to
fa18f8b
Compare
Updated with @JoseSK999 comments and added a test for #396 |
This commit moves transaction-specific validation to a dedicated function. This will be used to test our transaction validation logic, and to verify mempool transactions in the future. A new function, `verify_transaction` was created. It takes the UTXOs map, a transaction, some flags and returns the input/output amounts or an error, if any. It'll check the following: - The transaction doesn't spend more coins than it claims in the inputs - The transaction doesn't create more coins than allowed - The transaction has valid scripts - The transaction doesn't have duplicate inputs (TODO)
fa18f8b
to
d982bd5
Compare
Rebased with master |
This commit adds some tests with huge scripts to see our validation is working as expected. Those test cases were tested against core and we check if floresta outputs the same thing as the former.
d982bd5
to
cf8d988
Compare
Fixed some warnings too |
Nice! Something to note: Technically if the UTXO that we spend has a >10KB script we won't have it in our accumulator (as dictated by This now checks it as well on the |
Right. This utxo will not be inside the accumulator and therefore it's impossible to make a proof for it. But if it gets created on the same block, the utreexo side won't check it. So I think the current check is also useful. |
Good proint! |
* consensus: refactor verify_block_transactions This commit moves transaction-specific validation to a dedicated function. This will be used to test our transaction validation logic, and to verify mempool transactions in the future. A new function, `verify_transaction` was created. It takes the UTXOs map, a transaction, some flags and returns the input/output amounts or an error, if any. It'll check the following: - The transaction doesn't spend more coins than it claims in the inputs - The transaction doesn't create more coins than allowed - The transaction has valid scripts - The transaction doesn't have duplicate inputs * consensus: test over sized scripts This commit adds some tests with huge scripts to see our validation is working as expected. Those test cases were tested against core and we check if floresta outputs the same thing as the former.
* consensus: refactor verify_block_transactions This commit moves transaction-specific validation to a dedicated function. This will be used to test our transaction validation logic, and to verify mempool transactions in the future. A new function, `verify_transaction` was created. It takes the UTXOs map, a transaction, some flags and returns the input/output amounts or an error, if any. It'll check the following: - The transaction doesn't spend more coins than it claims in the inputs - The transaction doesn't create more coins than allowed - The transaction has valid scripts - The transaction doesn't have duplicate inputs * consensus: test over sized scripts This commit adds some tests with huge scripts to see our validation is working as expected. Those test cases were tested against core and we check if floresta outputs the same thing as the former.
* consensus: refactor verify_block_transactions This commit moves transaction-specific validation to a dedicated function. This will be used to test our transaction validation logic, and to verify mempool transactions in the future. A new function, `verify_transaction` was created. It takes the UTXOs map, a transaction, some flags and returns the input/output amounts or an error, if any. It'll check the following: - The transaction doesn't spend more coins than it claims in the inputs - The transaction doesn't create more coins than allowed - The transaction has valid scripts - The transaction doesn't have duplicate inputs * consensus: test over sized scripts This commit adds some tests with huge scripts to see our validation is working as expected. Those test cases were tested against core and we check if floresta outputs the same thing as the former.
* consensus: refactor verify_block_transactions This commit moves transaction-specific validation to a dedicated function. This will be used to test our transaction validation logic, and to verify mempool transactions in the future. A new function, `verify_transaction` was created. It takes the UTXOs map, a transaction, some flags and returns the input/output amounts or an error, if any. It'll check the following: - The transaction doesn't spend more coins than it claims in the inputs - The transaction doesn't create more coins than allowed - The transaction has valid scripts - The transaction doesn't have duplicate inputs * consensus: test over sized scripts This commit adds some tests with huge scripts to see our validation is working as expected. Those test cases were tested against core and we check if floresta outputs the same thing as the former.
What is the purpose of this pull request?
Which crates are being modified?
Description
This PR adds test cases with scripts manually crafted to be oversized and break on some boundary check. Some are meant to be barely valid, so we can sanity check our code.
To achieve this, a first step was to refactor
verify_block_transactions
, moving the tx validation to a new function. This will also be useful for checking mempool transactions in the future.Notes to the reviewers
6d10b82 is move-only and should not change any behavior.
Checklist
just lint
cargo test