-
Notifications
You must be signed in to change notification settings - Fork 134
Add a type for modeling multiple-dimensional gas #482
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
Conversation
This PR introduces the package multigas that contains the code related to multi-dimensional gas. It adds the ResourceKind enum that represents a gas resource, and the ResourceConstraints struct that represents a set of constraints. Close NIT-3487
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.
Pull Request Overview
This PR defines a new multigas
package to model per-resource gas constraints for the EVM.
- Introduces
ResourceKind
enum andMultiGas
array type - Implements
ResourceConstraints
map withSetConstraint
andClearConstraint
methods - Adds unit tests covering basic constraint operations
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
arbitrum/multigas/resources.go | Defines ResourceKind enum and MultiGas type |
arbitrum/multigas/doc.go | Adds package-level documentation |
arbitrum/multigas/constraint.go | Implements ResourceConstraints type and its methods |
arbitrum/multigas/constraint_test.go | Tests for adding, updating, and clearing resource constraints |
Comments suppressed due to low confidence (3)
arbitrum/multigas/constraint.go:6
- The identifier 'constraint' collides with Go's generic 'constraint' keyword and is ambiguous. Consider renaming it to something more specific, e.g. 'resourceConstraint'.
type constraint struct {
arbitrum/multigas/constraint.go:23
- Exported constructor is missing a doc comment. Please add a comment describing what NewResourceConstraints returns and any initialization details.
func NewResourceConstraints() ResourceConstraints {
arbitrum/multigas/constraint_test.go:8
- The test currently covers only Computation and HistoryGrowth. Consider adding cases for StorageAccess and StorageGrowth to ensure all resource kinds are initialized and handled correctly.
func TestResourceConstraints(t *testing.T) {
Helps avoiding bugs when the kind is left uninitialized.
The resource constraint struct won't be used directly in go-ethereum, so we decided to move it to the nitro repository.
The ResourceConstraints struct tracks the constraints used in constraint-based pricing. Depends on OffchainLabs/go-ethereum#482 Close NIT-3487
This PR introduces the package multigas that contains the code related to multi-dimensional gas. It adds the ResourceKind enum that represents a gas resource.