Skip to content

Commit e789403

Browse files
committed
fix: prefer the term 'allowlist' for callhook senders
1 parent 751240d commit e789403

File tree

5 files changed

+54
-54
lines changed

5 files changed

+54
-54
lines changed

cli/commands/bridge/to-l2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export const sendToL2Command = {
163163
description: 'Receiving address in L2. Same to L1 address if empty',
164164
})
165165
.positional('calldata', {
166-
description: 'Calldata to pass to the recipient. Must be whitelisted in the bridge',
166+
description: 'Calldata to pass to the recipient. Must be allowlisted in the bridge',
167167
})
168168
.coerce({
169169
maxGas: toBN,

contracts/gateway/L1GraphTokenGateway.sol

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ contract L1GraphTokenGateway is Initializable, GraphTokenGateway, L1ArbitrumMess
3333
/// Address of the BridgeEscrow contract that holds the GRT in the bridge
3434
address public escrow;
3535
/// Addresses for which this mapping is true are allowed to send callhooks in outbound transfers
36-
mapping(address => bool) public callhookWhitelist;
36+
mapping(address => bool) public callhookAllowlist;
3737

3838
/// Emitted when an outbound transfer is initiated, i.e. tokens are deposited from L1 to L2
3939
event DepositInitiated(
@@ -61,10 +61,10 @@ contract L1GraphTokenGateway is Initializable, GraphTokenGateway, L1ArbitrumMess
6161
event L2CounterpartAddressSet(address l2Counterpart);
6262
/// Emitted when the escrow address has been updated
6363
event EscrowAddressSet(address escrow);
64-
/// Emitted when an address is added to the callhook whitelist
65-
event AddedToCallhookWhitelist(address newWhitelisted);
66-
/// Emitted when an address is removed from the callhook whitelist
67-
event RemovedFromCallhookWhitelist(address notWhitelisted);
64+
/// Emitted when an address is added to the callhook allowlist
65+
event AddedToCallhookAllowlist(address newAllowlisted);
66+
/// Emitted when an address is removed from the callhook allowlist
67+
event RemovedFromCallhookAllowlist(address notAllowlisted);
6868

6969
/**
7070
* @dev Allows a function to be called only by the gateway's L2 counterpart.
@@ -94,7 +94,7 @@ contract L1GraphTokenGateway is Initializable, GraphTokenGateway, L1ArbitrumMess
9494
* - l2GRT using setL2TokenAddress
9595
* - l2Counterpart using setL2CounterpartAddress
9696
* - escrow using setEscrowAddress
97-
* - whitelisted callhook callers using addToCallhookWhitelist
97+
* - allowlisted callhook callers using addToCallhookAllowlist
9898
* - pauseGuardian using setPauseGuardian
9999
* @param _controller Address of the Controller that manages this contract
100100
*/
@@ -150,28 +150,28 @@ contract L1GraphTokenGateway is Initializable, GraphTokenGateway, L1ArbitrumMess
150150
}
151151

152152
/**
153-
* @notice Adds an address to the callhook whitelist.
153+
* @notice Adds an address to the callhook allowlist.
154154
* This address will be allowed to include callhooks when transferring tokens.
155-
* @param _newWhitelisted Address to add to the whitelist
155+
* @param _newAllowlisted Address to add to the allowlist
156156
*/
157-
function addToCallhookWhitelist(address _newWhitelisted) external onlyGovernor {
158-
require(_newWhitelisted != address(0), "INVALID_ADDRESS");
159-
require(Address.isContract(_newWhitelisted), "MUST_BE_CONTRACT");
160-
require(!callhookWhitelist[_newWhitelisted], "ALREADY_WHITELISTED");
161-
callhookWhitelist[_newWhitelisted] = true;
162-
emit AddedToCallhookWhitelist(_newWhitelisted);
157+
function addToCallhookAllowlist(address _newAllowlisted) external onlyGovernor {
158+
require(_newAllowlisted != address(0), "INVALID_ADDRESS");
159+
require(Address.isContract(_newAllowlisted), "MUST_BE_CONTRACT");
160+
require(!callhookAllowlist[_newAllowlisted], "ALREADY_ALLOWLISTED");
161+
callhookAllowlist[_newAllowlisted] = true;
162+
emit AddedToCallhookAllowlist(_newAllowlisted);
163163
}
164164

165165
/**
166-
* @notice Removes an address from the callhook whitelist.
166+
* @notice Removes an address from the callhook allowlist.
167167
* This address will no longer be allowed to include callhooks when transferring tokens.
168-
* @param _notWhitelisted Address to remove from the whitelist
168+
* @param _notAllowlisted Address to remove from the allowlist
169169
*/
170-
function removeFromCallhookWhitelist(address _notWhitelisted) external onlyGovernor {
171-
require(_notWhitelisted != address(0), "INVALID_ADDRESS");
172-
require(callhookWhitelist[_notWhitelisted], "NOT_WHITELISTED");
173-
callhookWhitelist[_notWhitelisted] = false;
174-
emit RemovedFromCallhookWhitelist(_notWhitelisted);
170+
function removeFromCallhookAllowlist(address _notAllowlisted) external onlyGovernor {
171+
require(_notAllowlisted != address(0), "INVALID_ADDRESS");
172+
require(callhookAllowlist[_notAllowlisted], "NOT_ALLOWLISTED");
173+
callhookAllowlist[_notAllowlisted] = false;
174+
emit RemovedFromCallhookAllowlist(_notAllowlisted);
175175
}
176176

177177
/**
@@ -180,10 +180,10 @@ contract L1GraphTokenGateway is Initializable, GraphTokenGateway, L1ArbitrumMess
180180
* The ticket must be redeemed on L2 to receive tokens at the specified address.
181181
* Note that the caller must previously allow the gateway to spend the specified amount of GRT.
182182
* @dev maxGas and gasPriceBid must be set using Arbitrum's NodeInterface.estimateRetryableTicket method.
183-
* Also note that whitelisted senders (some protocol contracts) can include additional calldata
183+
* Also note that allowlisted senders (some protocol contracts) can include additional calldata
184184
* for a callhook to be executed on the L2 side when the tokens are received. In this case, the L2 transaction
185185
* can revert if the callhook reverts, potentially locking the tokens on the bridge if the callhook
186-
* never succeeds. This requires extra care when adding contracts to the whitelist, but is necessary to ensure that
186+
* never succeeds. This requires extra care when adding contracts to the allowlist, but is necessary to ensure that
187187
* the tickets can be retried in the case of a temporary failure, and to ensure the atomicity of callhooks
188188
* with token transfers.
189189
* @param _l1Token L1 Address of the GRT contract (needed for compatibility with Arbitrum Gateway Router)
@@ -217,7 +217,7 @@ contract L1GraphTokenGateway is Initializable, GraphTokenGateway, L1ArbitrumMess
217217
bytes memory extraData;
218218
(from, maxSubmissionCost, extraData) = parseOutboundData(_data);
219219
require(
220-
extraData.length == 0 || callhookWhitelist[msg.sender] == true,
220+
extraData.length == 0 || callhookAllowlist[msg.sender] == true,
221221
"CALL_HOOK_DATA_NOT_ALLOWED"
222222
);
223223
require(maxSubmissionCost != 0, "NO_SUBMISSION_COST");
@@ -318,7 +318,7 @@ contract L1GraphTokenGateway is Initializable, GraphTokenGateway, L1ArbitrumMess
318318
* @param _from Address on L1 from which we're transferring tokens
319319
* @param _to Address on L2 to which we're transferring tokens
320320
* @param _amount Amount of GRT to transfer
321-
* @param _data Additional call data for the L2 transaction, which must be empty unless the caller is whitelisted
321+
* @param _data Additional call data for the L2 transaction, which must be empty unless the caller is allowlisted
322322
* @return Encoded calldata (including function selector) for the L2 transaction
323323
*/
324324
function getOutboundCalldata(

contracts/l2/gateway/L2GraphTokenGateway.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,17 @@ contract L2GraphTokenGateway is GraphTokenGateway, L2ArbitrumMessenger, Reentran
211211
* @notice Receives token amount from L1 and mints the equivalent tokens to the receiving address
212212
* @dev Only accepts transactions from the L1 GRT Gateway.
213213
* The function is payable for ITokenGateway compatibility, but msg.value must be zero.
214-
* Note that whitelisted senders (some protocol contracts) can include additional calldata
214+
* Note that allowlisted senders (some protocol contracts) can include additional calldata
215215
* for a callhook to be executed on the L2 side when the tokens are received. In this case, the L2 transaction
216216
* can revert if the callhook reverts, potentially locking the tokens on the bridge if the callhook
217-
* never succeeds. This requires extra care when adding contracts to the whitelist, but is necessary to ensure that
217+
* never succeeds. This requires extra care when adding contracts to the allowlist, but is necessary to ensure that
218218
* the tickets can be retried in the case of a temporary failure, and to ensure the atomicity of callhooks
219219
* with token transfers.
220220
* @param _l1Token L1 Address of GRT
221221
* @param _from Address of the sender on L1
222222
* @param _to Recipient address on L2
223223
* @param _amount Amount of tokens transferred
224-
* @param _data Extra callhook data, only used when the sender is whitelisted
224+
* @param _data Extra callhook data, only used when the sender is allowlisted
225225
*/
226226
function finalizeInboundTransfer(
227227
address _l1Token,

e2e/deployment/config/l1/l1GraphTokenGateway.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ describe('[L1] L1GraphTokenGateway configuration', function () {
5454
await expect(tx).revertedWith('Only Controller governor')
5555
})
5656

57-
it('addToCallhookWhitelist should revert', async function () {
58-
const tx = L1GraphTokenGateway.connect(unauthorized).addToCallhookWhitelist(
57+
it('addToCallhookAllowlist should revert', async function () {
58+
const tx = L1GraphTokenGateway.connect(unauthorized).addToCallhookAllowlist(
5959
unauthorized.address,
6060
)
6161
await expect(tx).revertedWith('Only Controller governor')
6262
})
6363

64-
it('removeFromCallhookWhitelist should revert', async function () {
65-
const tx = L1GraphTokenGateway.connect(unauthorized).removeFromCallhookWhitelist(
64+
it('removeFromCallhookAllowlist should revert', async function () {
65+
const tx = L1GraphTokenGateway.connect(unauthorized).removeFromCallhookAllowlist(
6666
unauthorized.address,
6767
)
6868
await expect(tx).revertedWith('Only Controller governor')

test/gateway/l1GraphTokenGateway.test.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -205,59 +205,59 @@ describe('L1GraphTokenGateway', () => {
205205
expect(await l1GraphTokenGateway.escrow()).eq(bridgeEscrow.address)
206206
})
207207
})
208-
describe('addToCallhookWhitelist', function () {
208+
describe('addToCallhookAllowlist', function () {
209209
it('is not callable by addreses that are not the governor', async function () {
210210
const tx = l1GraphTokenGateway
211211
.connect(tokenSender.signer)
212-
.addToCallhookWhitelist(fixtureContracts.rewardsManager.address)
212+
.addToCallhookAllowlist(fixtureContracts.rewardsManager.address)
213213
await expect(tx).revertedWith('Only Controller governor')
214214
expect(
215-
await l1GraphTokenGateway.callhookWhitelist(fixtureContracts.rewardsManager.address),
215+
await l1GraphTokenGateway.callhookAllowlist(fixtureContracts.rewardsManager.address),
216216
).eq(false)
217217
})
218-
it('rejects adding an EOA to the callhook whitelist', async function () {
218+
it('rejects adding an EOA to the callhook allowlist', async function () {
219219
const tx = l1GraphTokenGateway
220220
.connect(governor.signer)
221-
.addToCallhookWhitelist(tokenSender.address)
221+
.addToCallhookAllowlist(tokenSender.address)
222222
await expect(tx).revertedWith('MUST_BE_CONTRACT')
223223
})
224-
it('adds an address to the callhook whitelist', async function () {
224+
it('adds an address to the callhook allowlist', async function () {
225225
const tx = l1GraphTokenGateway
226226
.connect(governor.signer)
227-
.addToCallhookWhitelist(fixtureContracts.rewardsManager.address)
227+
.addToCallhookAllowlist(fixtureContracts.rewardsManager.address)
228228
await expect(tx)
229-
.emit(l1GraphTokenGateway, 'AddedToCallhookWhitelist')
229+
.emit(l1GraphTokenGateway, 'AddedToCallhookAllowlist')
230230
.withArgs(fixtureContracts.rewardsManager.address)
231231
expect(
232-
await l1GraphTokenGateway.callhookWhitelist(fixtureContracts.rewardsManager.address),
232+
await l1GraphTokenGateway.callhookAllowlist(fixtureContracts.rewardsManager.address),
233233
).eq(true)
234234
})
235235
})
236-
describe('removeFromCallhookWhitelist', function () {
236+
describe('removeFromCallhookAllowlist', function () {
237237
it('is not callable by addreses that are not the governor', async function () {
238238
await l1GraphTokenGateway
239239
.connect(governor.signer)
240-
.addToCallhookWhitelist(fixtureContracts.rewardsManager.address)
240+
.addToCallhookAllowlist(fixtureContracts.rewardsManager.address)
241241
const tx = l1GraphTokenGateway
242242
.connect(tokenSender.signer)
243-
.removeFromCallhookWhitelist(fixtureContracts.rewardsManager.address)
243+
.removeFromCallhookAllowlist(fixtureContracts.rewardsManager.address)
244244
await expect(tx).revertedWith('Only Controller governor')
245245
expect(
246-
await l1GraphTokenGateway.callhookWhitelist(fixtureContracts.rewardsManager.address),
246+
await l1GraphTokenGateway.callhookAllowlist(fixtureContracts.rewardsManager.address),
247247
).eq(true)
248248
})
249-
it('removes an address from the callhook whitelist', async function () {
249+
it('removes an address from the callhook allowlist', async function () {
250250
await l1GraphTokenGateway
251251
.connect(governor.signer)
252-
.addToCallhookWhitelist(fixtureContracts.rewardsManager.address)
252+
.addToCallhookAllowlist(fixtureContracts.rewardsManager.address)
253253
const tx = l1GraphTokenGateway
254254
.connect(governor.signer)
255-
.removeFromCallhookWhitelist(fixtureContracts.rewardsManager.address)
255+
.removeFromCallhookAllowlist(fixtureContracts.rewardsManager.address)
256256
await expect(tx)
257-
.emit(l1GraphTokenGateway, 'RemovedFromCallhookWhitelist')
257+
.emit(l1GraphTokenGateway, 'RemovedFromCallhookAllowlist')
258258
.withArgs(fixtureContracts.rewardsManager.address)
259259
expect(
260-
await l1GraphTokenGateway.callhookWhitelist(fixtureContracts.rewardsManager.address),
260+
await l1GraphTokenGateway.callhookAllowlist(fixtureContracts.rewardsManager.address),
261261
).eq(false)
262262
})
263263
})
@@ -492,7 +492,7 @@ describe('L1GraphTokenGateway', () => {
492492
)
493493
await expect(tx).revertedWith('NO_SUBMISSION_COST')
494494
})
495-
it('reverts when called with nonempty calldata, if the sender is not whitelisted', async function () {
495+
it('reverts when called with nonempty calldata, if the sender is not allowlisted', async function () {
496496
await grt.connect(tokenSender.signer).approve(l1GraphTokenGateway.address, toGRT('10'))
497497
const tx = l1GraphTokenGateway
498498
.connect(tokenSender.signer)
@@ -509,12 +509,12 @@ describe('L1GraphTokenGateway', () => {
509509
)
510510
await expect(tx).revertedWith('CALL_HOOK_DATA_NOT_ALLOWED')
511511
})
512-
it('allows sending nonempty calldata, if the sender is whitelisted', async function () {
512+
it('allows sending nonempty calldata, if the sender is allowlisted', async function () {
513513
// Make the sender a contract so that it can be allowed to send callhooks
514514
await provider().send('hardhat_setCode', [tokenSender.address, '0x1234'])
515515
await l1GraphTokenGateway
516516
.connect(governor.signer)
517-
.addToCallhookWhitelist(tokenSender.address)
517+
.addToCallhookAllowlist(tokenSender.address)
518518
await grt.connect(tokenSender.signer).approve(l1GraphTokenGateway.address, toGRT('10'))
519519
await testValidOutboundTransfer(
520520
tokenSender.signer,

0 commit comments

Comments
 (0)