Skip to content

Commit

Permalink
remove validity buffer (#338)
Browse files Browse the repository at this point in the history
* remove validity buffer

* re-add expiry checks

---------

Co-authored-by: mouseless <[email protected]>
  • Loading branch information
mouseless0x and mouseless0x authored Oct 20, 2024
1 parent 1002da9 commit 1900e42
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/rpc/validation/UnsafeValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export class UnsafeValidator implements InterfaceValidator {
})

if (
validationResult.returnInfo.validAfter > now - 5 &&
validationResult.returnInfo.validAfter > now &&
this.config.expirationCheck
) {
throw new RpcError(
Expand All @@ -259,7 +259,7 @@ export class UnsafeValidator implements InterfaceValidator {
}

if (
validationResult.returnInfo.validUntil < now + 30 &&
validationResult.returnInfo.validUntil < now + 5 &&
this.config.expirationCheck
) {
throw new RpcError(
Expand Down Expand Up @@ -432,7 +432,7 @@ export class UnsafeValidator implements InterfaceValidator {

const now = Math.floor(Date.now() / 1000)

if (res.returnInfo.validAfter > now - 5) {
if (res.returnInfo.validAfter > now) {
throw new RpcError(
`User operation is not valid yet, validAfter=${res.returnInfo.validAfter}, now=${now}`,
ValidationErrors.ExpiresShortly
Expand All @@ -441,7 +441,7 @@ export class UnsafeValidator implements InterfaceValidator {

if (
res.returnInfo.validUntil == null ||
res.returnInfo.validUntil < now + 30
res.returnInfo.validUntil < now + 5
) {
throw new RpcError(
`UserOperation expires too soon, validUntil=${res.returnInfo.validUntil}, now=${now}`,
Expand Down

0 comments on commit 1900e42

Please sign in to comment.