Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/pimlicolabs/alto into feat/…
Browse files Browse the repository at this point in the history
…v2-bundler-api
  • Loading branch information
plusminushalf committed Feb 6, 2024
2 parents d446c27 + cbd258c commit 225d867
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 675 deletions.
2 changes: 2 additions & 0 deletions packages/executor/src/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ export class BasicExecutor implements IExecutor {
if (
simulatedOps.every((sop) => sop.reason === FeeCapTooLowError.name)
) {
this.markWalletProcessed(wallet)
return opsWithHashes.map((owh) => {
return {
status: "resubmit",
Expand Down Expand Up @@ -731,6 +732,7 @@ export class BasicExecutor implements IExecutor {
if (
simulatedOps.every((sop) => sop.reason === FeeCapTooLowError.name)
) {
this.markWalletProcessed(wallet)
return compressedOps.map((compressedOp) => {
return {
status: "resubmit",
Expand Down
6 changes: 5 additions & 1 deletion packages/rpc/src/rpcHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,12 @@ export class RpcHandler implements IRpcEndpoint {
userOperation.verificationGasLimit = 10_000_000n
userOperation.callGasLimit = 10_000_000n

if (this.chainId === chains.base.id) {
userOperation.verificationGasLimit = 2_500_000n
userOperation.callGasLimit = 2_500_000n
}

if (
this.chainId === 8453 ||
this.chainId === chains.celoAlfajores.id ||
this.chainId === chains.celo.id
) {
Expand Down
20 changes: 16 additions & 4 deletions packages/rpc/src/validation/SafeValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,22 @@ export class SafeValidator extends UnsafeValidator implements IValidator {
)
}

if (
validationResult.returnInfo.validUntil <
Date.now() / 1000 + 30
) {
const now = Date.now() / 1000

this.logger.debug({
validAfter: validationResult.returnInfo.validAfter,
validUntil: validationResult.returnInfo.validUntil,
now: now
})

if (validationResult.returnInfo.validAfter > now - 5) {
throw new RpcError(
"User operation is not valid yet",
ValidationErrors.ExpiresShortly
)
}

if (validationResult.returnInfo.validUntil < now + 30) {
throw new RpcError(
"expires too soon",
ValidationErrors.ExpiresShortly
Expand Down
22 changes: 16 additions & 6 deletions packages/rpc/src/validation/UnsafeValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ export class UnsafeValidator implements IValidator {
throw e
})

console.log("errorResult ==========> ", errorResult)

return getSimulationResult(
errorResult,
this.logger,
Expand Down Expand Up @@ -336,10 +334,22 @@ export class UnsafeValidator implements IValidator {
)
}

if (
validationResult.returnInfo.validUntil <
Date.now() / 1000 + 30
) {
const now = Date.now() / 1000

this.logger.debug({
validAfter: validationResult.returnInfo.validAfter,
validUntil: validationResult.returnInfo.validUntil,
now
})

if (validationResult.returnInfo.validAfter > now - 5) {
throw new RpcError(
"User operation is not valid yet",
ValidationErrors.ExpiresShortly
)
}

if (validationResult.returnInfo.validUntil < now + 30) {
throw new RpcError(
"expires too soon",
ValidationErrors.ExpiresShortly
Expand Down
Loading

0 comments on commit 225d867

Please sign in to comment.