Update ERC-7730: Improve duration format - #1908
melanciani wants to merge 5 commits into
Conversation
File
|
|
Just a quick question - should an upper bound for |
truncating duration seems dangerous for clear signing as it could hide genuine large values , no ? Still, we could include some kind of |
Well, for me personally having a |
|
I was not part of the initial specs regarding this so can't say, this PR is suggestion toward improving this ! I've pushed the unboundedMessage parameter change |
|
While we are on it, shouldn't we also add "months" and "years" too? I assume there will be use cases to set couple years of deadlines etc. Edit: I guess months will be tricky because of variable days of month (30 or 31). Same for years with 366 and 365 day years? |
Yeah, the wallet will need to know if the duration field means "a countdown that starts right now" or not, and to know the current time (most wallets don't) to render it precisely (could even give you the end date then). |
|
@kuzdogan @forshtat following your comments, I agree years/months would make sense but I think we should avoid displays approximation by default. Still, I feel it would make sense to introduce a new optional parameter that would enable a more readable view like "Approximately 5 years and 7 months" yes, I'll try to suggest something soon |
|
hey again @kuzdogan @forshtat what do you think of my suggestion ? I'm mostly not sure about the need to specify the exact way we want to display approximation: Add Optional It's appended, never a replacement, so no precision is hidden. The algorithm is fully specified so all wallets render identically: round to the nearest month ( Only years and months — stopping there keeps the output a deterministic function of the value, with no clock, locale or calendar needed. Default |
|
CI is failing on something unrelated: I've opened an issue to fix this: #1933 |
742b0b6 to
c0201a9
Compare
|
The commit c0201a9 (as a parent of 8f783e5) contains errors. |
c0201a9 to
407e4f2
Compare
Co-authored-by: Alex Forshtat <forshtat1@gmail.com>
|
while working again on ethereum/clear-signing-erc7730-registry#2595, I suggest a new improvement: instead of just adding For example: we have a setter that gives right for a period of time, and revoke path uses |
Abstract
This change amends the ERC-7730
durationfield format. Adurationvalue (a numberof seconds) is rendered as
<days>d<hh>h<mm>m<ss>s, wheredaysis unbounded andhh/mm/ssare zero-padded to two digits. This replaces the previousHH:MM:ssrendering, whose unbounded hours field (e.g.
240:00:00for ten days) is ambiguous andeasily misread on a clear-signing display.
Motivation
Durations in clear-signing are frequently authorization or validity windows (permit and
delegation expiries, operator authorizations). The prior
HH:MM:ssformat collapsedmulti-day windows into large hour counts (
240:00:00), which users can misread — ameaningful risk when the value governs how long access is granted. A fixed, days-inclusive
format makes the magnitude legible at a glance without adding optional styles or parameters
that would fragment wallet behavior.
Rationale
Alternatives considered:
HH:MM:ss— rejected: ambiguous for multi-day durations (240:00:00).P10D,PT2H17M30S) — the formal standard, but rejected: crypticfor end users on a hardware-wallet screen.
style/baseparameters — rejected: adds configuration and lets the same valuerender differently across wallets. A single imposed format is simpler and consistent.
The chosen
Dd HHh MMm SSsform is days-inclusive, self-describing, and unambiguous, and keepsdurationparameter-free.Backwards Compatibility
This is a breaking change to the rendered output of
duration(previouslyHH:MM:ss), so itaffects renderers, not descriptor documents (no schema-structure change; documents that
validated before still validate). It is introduced in the v3.0.0 schema line — the current
mutable
-nextmajor draft — and does NOT alter the released v2 schema. Wallets and librariesimplementing ERC-7730 MUST update their duration renderer to the new format when adopting v3.
Test Cases
00d00h00m00s450d00h00m45s36000d01h00m00s82500d02h17m30s3600004d04h00m00s86400010d00h00m00sReference Implementation
Security Considerations
durationcommonly renders a validity or authorization window (e.g. a decryption-delegationor operator expiry). A misread duration could lead a user to authorize longer-lived access
than intended. The days-inclusive format directly reduces that misread risk versus large
unbounded hour counts. The change is rendering-only and introduces no new attack surface.