-
Notifications
You must be signed in to change notification settings - Fork 1
feat: gastime package
#9
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
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 introduces a new gastime package that implements a "gas clock" - a time measurement system based on gas consumption rather than traditional time units. The implementation extends proxtime.Time[gas.Gas] to track both time passage and a continuous equivalent of ACP-176 gas excess at gas-unit resolution.
Key changes:
- Gas-based time tracking with excess consumption monitoring per ACP-176/194
- Canoto serialization support for persistence and network transmission
- Comprehensive test coverage for scaling operations and excess calculations
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| go.mod | Adds uint256 dependency for geth/libevm compatibility |
| gastime/gastime.go | Core Time struct with gas-based time tracking and excess management |
| gastime/marshal.go | Canoto serialization interface and marshaling methods |
| gastime/marshal.canoto.go | Generated canoto marshaling implementation |
| gastime/gastime_test.go | Comprehensive tests for scaling, excess calculations, and cloning |
| gastime/cmpopt.go | Test utilities for comparing Time instances |
StephenButtolph
left a comment
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.
Really my only questions/concerns are cases of potential overflow.
Introduces the gas clock, an extension of a
proxytime.Time[gas.Gas]that also tracks a "continuous" equivalent of ACP-176 gas excess at gas-unit resolution instead of per second.Closes #11