Skip to content

Commit

Permalink
Merge pull request #382 from pimlicolabs/fix/unpackPaymasterAndData
Browse files Browse the repository at this point in the history
Fix paymasterAndDataSize
  • Loading branch information
plusminushalf authored Dec 18, 2024
2 parents 028b203 + c94f4ce commit c844866
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/calm-brooms-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pimlico/alto": patch
---

Version updated till Dec 18
7 changes: 6 additions & 1 deletion src/utils/userop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
pad,
parseAbi,
parseEventLogs,
size,
slice,
toHex,
zeroAddress
Expand Down Expand Up @@ -132,11 +133,15 @@ export function unpackPaymasterAndData(paymasterAndData: Hex) {
paymasterData: null
}
}

const paymasterAndDataSize = size(paymasterAndData)

return {
paymaster: getAddress(slice(paymasterAndData, 0, 20)),
paymasterVerificationGasLimit: BigInt(slice(paymasterAndData, 20, 36)),
paymasterPostOpGasLimit: BigInt(slice(paymasterAndData, 36, 52)),
paymasterData: slice(paymasterAndData, 52)
paymasterData:
paymasterAndDataSize > 52 ? slice(paymasterAndData, 52) : null
}
}

Expand Down

0 comments on commit c844866

Please sign in to comment.