Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure L2 aliased addresses are the correct length #929

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/ten-moons-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@graphprotocol/sdk": patch
---

Ensure L2 aliased addresses are the correct length
3 changes: 2 additions & 1 deletion packages/sdk/src/utils/arbitrum/address.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { hexZeroPad } from 'ethers/lib/utils'
import { toBN } from '../units'

// Adapted from:
Expand All @@ -8,5 +9,5 @@ export const applyL1ToL2Alias = (l1Address: string): string => {
const l2AddressAsNumber = l1AddressAsNumber.add(offset)

const mask = toBN(2).pow(160)
return l2AddressAsNumber.mod(mask).toHexString()
return hexZeroPad(l2AddressAsNumber.mod(mask).toHexString(), 20)
}