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

CHIA-1226 Include the cost of the whole spend in get_conditions_from_spendbundle's return value #680

Merged

Conversation

AmineKhaldi
Copy link
Contributor

@AmineKhaldi AmineKhaldi commented Aug 27, 2024

The generator doesn't just include the puzzle reveal and the solution, it also includes the coin that's being spent, specifically in the form of (parent_id, puzzle_hash, amount). Each spend will necessarily have to pay that size-cost.

@AmineKhaldi AmineKhaldi self-assigned this Aug 27, 2024
@AmineKhaldi AmineKhaldi force-pushed the cost_in_get_conditions_from_spendbundle branch 3 times, most recently from bced560 to 2dfe9b2 Compare August 27, 2024 19:48
Copy link
Contributor

@Rigidity Rigidity left a comment

Choose a reason for hiding this comment

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

The benefit of subtracting the cost incrementally as you go is to exit early if the spend exceeds the limit, before processing the actual CLVM and conditions, or other spends. I think doing it afterward could open up a DoS attack vector

@AmineKhaldi AmineKhaldi force-pushed the cost_in_get_conditions_from_spendbundle branch from 2dfe9b2 to ae7c06f Compare August 27, 2024 20:06
Rigidity
Rigidity previously approved these changes Aug 27, 2024
crates/chia-consensus/src/spendbundle_conditions.rs Outdated Show resolved Hide resolved
crates/chia-consensus/src/spendbundle_conditions.rs Outdated Show resolved Hide resolved
crates/chia-consensus/src/spendbundle_conditions.rs Outdated Show resolved Hide resolved
Copy link

coveralls-official bot commented Aug 27, 2024

Pull Request Test Coverage Report for Build 10630724752

Details

  • 34 of 34 (100.0%) changed or added relevant lines in 2 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.01%) to 83.907%

Files with Coverage Reduction New Missed Lines %
crates/chia-protocol/src/program.rs 3 72.75%
Totals Coverage Status
Change from base Build 10618872395: 0.01%
Covered Lines: 12326
Relevant Lines: 14690

💛 - Coveralls

@AmineKhaldi AmineKhaldi force-pushed the cost_in_get_conditions_from_spendbundle branch from ae7c06f to 0f1ca2c Compare August 27, 2024 20:54
@AmineKhaldi AmineKhaldi marked this pull request as ready for review August 27, 2024 20:57
@AmineKhaldi AmineKhaldi force-pushed the cost_in_get_conditions_from_spendbundle branch from 0f1ca2c to 84c8429 Compare August 28, 2024 16:50
arvidn
arvidn previously approved these changes Aug 30, 2024
@arvidn arvidn merged commit f8666ad into Chia-Network:main Aug 30, 2024
57 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.

3 participants