Skip to content

Commit c5641c5

Browse files
committed
fix: ensure L2 aliased addresses are the correct length
1 parent 2ef4613 commit c5641c5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/ten-moons-lay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@graphprotocol/sdk": patch
3+
---
4+
5+
Ensure L2 aliased addresses are the correct length

packages/sdk/src/utils/arbitrum/address.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { hexZeroPad } from 'ethers/lib/utils'
12
import { toBN } from '../units'
23

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

1011
const mask = toBN(2).pow(160)
11-
return l2AddressAsNumber.mod(mask).toHexString()
12+
return hexZeroPad(l2AddressAsNumber.mod(mask).toHexString(), 20)
1213
}

0 commit comments

Comments
 (0)