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

Fix validation (supports v0-2 in v0.8) #2539

Closed
wants to merge 2 commits into from

Conversation

AnkushinDaniil
Copy link
Contributor

This PR resolves an issue in which the resource_bounds_required validation was misapplied to v0-2 transactions.

Copy link

codecov bot commented Feb 24, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 73.51%. Comparing base (0e9e53f) to head (12cfe87).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
validator/validator.go 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2539      +/-   ##
==========================================
+ Coverage   73.49%   73.51%   +0.02%     
==========================================
  Files         136      136              
  Lines       16657    16661       +4     
==========================================
+ Hits        12242    12249       +7     
+ Misses       3547     3544       -3     
  Partials      868      868              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rodrigo-pino
Copy link
Contributor

This PR resolves an issue in which the resource_bounds_required validation was misapplied to v0-2 transactions.

Which issue?

Comment on lines +26 to 34

// Only enforce resource bounds validation for version 0x3
if version == "0x3" || version == "0x100000000000000000000000000000003" {
return req.ResourceBounds != nil && len(*req.ResourceBounds) == 3
}

// Allow earlier versions without resource bounds
return true
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: Return the condition instantly:

Suggested change
// Only enforce resource bounds validation for version 0x3
if version == "0x3" || version == "0x100000000000000000000000000000003" {
return req.ResourceBounds != nil && len(*req.ResourceBounds) == 3
}
// Allow earlier versions without resource bounds
return true
}
// Only enforce resource bounds validation for version 0x3
return version != "0x3" && version != "0x100000000000000000000000000000003" ||
(req.ResourceBounds != nil && len(*req.ResourceBounds) == 3)

@AnkushinDaniil AnkushinDaniil changed the title Fix validation Fix validation (supports v0-2 in v0.8) Feb 24, 2025
@AnkushinDaniil
Copy link
Contributor Author

#2544

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