Skip to content

Commit

Permalink
fix: add GNS and Staking to callhook allowlist
Browse files Browse the repository at this point in the history
  • Loading branch information
Maikol committed Nov 29, 2023
1 parent 289b07d commit 647d4cd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cli/commands/protocol/configure-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const configureL1Bridge = async (cli: CLIEnvironment, cliArgs: CLIArgs):
const l2GNSCounterpart = l2AddressBook.getEntry('L2GNS')
logger.info('L2 GNS address: ' + l2GNSCounterpart.address)
await sendTransaction(cli.wallet, gns, 'setCounterpartGNSAddress', [l2GNSCounterpart.address])
await sendTransaction(cli.wallet, gateway, 'addToCallhookAllowlist', [gns.address])

// Staking
const staking = cli.contracts.L1Staking
Expand All @@ -57,6 +58,7 @@ export const configureL1Bridge = async (cli: CLIEnvironment, cliArgs: CLIArgs):
await sendTransaction(cli.wallet, staking, 'setCounterpartStakingAddress', [
l2StakingCounterpart.address,
])
await sendTransaction(cli.wallet, gateway, 'addToCallhookAllowlist', [staking.address])
}

export const configureL2Bridge = async (cli: CLIEnvironment, cliArgs: CLIArgs): Promise<void> => {
Expand Down
7 changes: 6 additions & 1 deletion e2e/deployment/config/l1/l1GNS.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import GraphChain from '../../../../gre/helpers/chain'

describe('[L1] GNS', () => {
const graph = hre.graph()
const { L1GNS } = graph.contracts
const { L1GNS, L1GraphTokenGateway } = graph.contracts

let unauthorized: SignerWithAddress

Expand All @@ -19,5 +19,10 @@ describe('[L1] GNS', () => {
const l2GNS = await L1GNS.counterpartGNSAddress()
expect(l2GNS).eq(graph.l2.contracts.L2GNS.address)
})

it('should be added to callhookAllowlist', async () => {
const isAllowed = await L1GraphTokenGateway.callhookAllowlist(L1GNS.address)
expect(isAllowed).true
})
})
})
7 changes: 6 additions & 1 deletion e2e/deployment/config/l1/l1Staking.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import GraphChain from '../../../../gre/helpers/chain'

describe('[L1] Staking', () => {
const graph = hre.graph()
const { L1Staking } = graph.contracts
const { L1Staking, L1GraphTokenGateway } = graph.contracts

let unauthorized: SignerWithAddress

Expand All @@ -21,5 +21,10 @@ describe('[L1] Staking', () => {
const l2Staking = hre.ethers.utils.defaultAbiCoder.decode(['address'], l2StakingData)[0]
expect(l2Staking).eq(graph.l2.contracts.L2Staking.address)
})

it('should be added to callhookAllowlist', async () => {
const isAllowed = await L1GraphTokenGateway.callhookAllowlist(L1Staking.address)
expect(isAllowed).true
})
})
})

0 comments on commit 647d4cd

Please sign in to comment.