feat: Add preamble-future-date lint for last-call-deadline validation#120
feat: Add preamble-future-date lint for last-call-deadline validation#120apeaircreative wants to merge 5 commits intoethereum:masterfrom
Conversation
This commit adds a new lint that validates that the last-call-deadline field in EIP preambles is set to a future date when the EIP status is 'Last Call'. The lint: - Only checks if status is 'Last Call' - Compares the deadline date with today's date - Reports an error if the deadline is not in the future - Includes helpful error messages This helps ensure that Last Call deadlines are always set to future dates, making the EIP process more robust.
Adds validation for last-call-deadline to ensure it is set to a future date when EIP status is Last Call. Updates include: - Added FutureDate lint to default lints - Fixed serialization format for better compatibility - Added comprehensive tests for past, future, and non-Last Call cases
Adds comprehensive documentation explaining the purpose, behavior, and usage of the FutureDate lint.
According to EIP-1, last-call-deadline represents when the last call period ends, so today's date should be valid. Also improved error messages to be clearer about this.
Updated test assertions to match the new error messages that allow today's date as valid for last-call-deadline.
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 |
There was a problem hiding this comment.
eipw is released under the MPL, not apache.
|
|
||
| fn lint<'a>(&self, slug: &'a str, ctx: &Context<'a, '_>) -> Result<(), Error> { | ||
| // Only check if status is "Last Call" | ||
| let status = match ctx.preamble().by_name("status") { |
There was a problem hiding this comment.
When possible, I prefer keeping lints small and single purpose. Here, I think it would be simpler if—instead of checking for a particular status—you only enforce that the date is in the future if and only if the field is present.
Then preamble-req-last-call-deadline, preamble-date-last-call-deadline, and this lint will all work together.
| }; | ||
|
|
||
| // Get today's date | ||
| let today = Utc::now().date_naive(); |
There was a problem hiding this comment.
This might be overly strict. If someone in, for example, Eastern Time (so UTC-5) submits near midnight, this would annoyingly fail for them. Can we do like... UTC-12 or something? I'm not 100% sure how timezones work.
| async fn future_date() { | ||
| let src = r#"--- | ||
| status: Last Call | ||
| last-call-deadline: 2025-12-12 |
There was a problem hiding this comment.
This will fail while I am alive. Can we do like 3000-12-12?
Adds a new
preamble-future-datelint that validates thelast-call-deadlinefield in EIP preambles. According to EIP-1, this field must be today or a future date when status is "Last Call", using ISO 8601 format (YYYY-MM-DD). The lint includes comprehensive tests and clear error messages. Fixes #21.