Skip to content

Commit f3887a5

Browse files
authored
N-02 Relay Tokens From L1 Emits Empty Transaction Hash When Relaying USDC Through CCTP (#976)
Signed-off-by: bennett <[email protected]>
1 parent b251c10 commit f3887a5

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

contracts/chain-adapters/ZkStack_Adapter.sol

-4
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ contract ZkStack_Adapter is AdapterInterface, CircleCCTPAdapter {
5858
// when calling a hub pool message relay, which would otherwise cause a large amount of ETH to be sent to L2.
5959
uint256 private immutable MAX_TX_GASPRICE;
6060

61-
event ZkStackMessageRelayed(bytes32 indexed canonicalTxHash);
62-
6361
error ETHGasTokenRequired();
6462
error TransactionFeeTooHigh();
6563
error InvalidBridgeConfig();
@@ -141,7 +139,6 @@ contract ZkStack_Adapter is AdapterInterface, CircleCCTPAdapter {
141139
);
142140

143141
emit MessageRelayed(target, message);
144-
emit ZkStackMessageRelayed(canonicalTxHash);
145142
}
146143

147144
/**
@@ -220,7 +217,6 @@ contract ZkStack_Adapter is AdapterInterface, CircleCCTPAdapter {
220217
}
221218

222219
emit TokensRelayed(l1Token, l2Token, amount, to);
223-
emit ZkStackMessageRelayed(txHash);
224220
}
225221

226222
/**

contracts/chain-adapters/ZkStack_CustomGasToken_Adapter.sol

-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ contract ZkStack_CustomGasToken_Adapter is AdapterInterface, CircleCCTPAdapter {
7979
// when calling a hub pool message relay, which would otherwise cause a large amount of the custom gas token to be sent to L2.
8080
uint256 private immutable MAX_TX_GASPRICE;
8181

82-
event ZkStackMessageRelayed(bytes32 indexed canonicalTxHash);
8382
error ETHGasTokenNotAllowed();
8483
error TransactionFeeTooHigh();
8584
error InvalidBridgeConfig();
@@ -165,7 +164,6 @@ contract ZkStack_CustomGasToken_Adapter is AdapterInterface, CircleCCTPAdapter {
165164
);
166165

167166
emit MessageRelayed(target, message);
168-
emit ZkStackMessageRelayed(canonicalTxHash);
169167
}
170168

171169
/**
@@ -268,7 +266,6 @@ contract ZkStack_CustomGasToken_Adapter is AdapterInterface, CircleCCTPAdapter {
268266
}
269267

270268
emit TokensRelayed(l1Token, l2Token, amount, to);
271-
emit ZkStackMessageRelayed(txHash);
272269
}
273270

274271
/**

test/evm/foundry/local/ZkStack_Adapter.t.sol

+10-9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { FinderInterface } from "@uma/core/contracts/data-verification-mechanism
1111

1212
import { ZkStack_Adapter } from "../../../../contracts/chain-adapters/ZkStack_Adapter.sol";
1313
import { ZkStack_CustomGasToken_Adapter, FunderInterface } from "../../../../contracts/chain-adapters/ZkStack_CustomGasToken_Adapter.sol";
14+
import { AdapterInterface } from "../../../../contracts/chain-adapters/interfaces/AdapterInterface.sol";
1415
import { WETH9Interface } from "../../../../contracts/external/interfaces/WETH9Interface.sol";
1516
import { WETH9 } from "../../../../contracts/external/WETH9.sol";
1617
import { MockBridgeHub, BridgeHubInterface } from "../../../../contracts/test/MockZkStackBridgeHub.sol";
@@ -197,7 +198,7 @@ contract ZkStackAdapterTest is Test {
197198
)
198199
);
199200
vm.expectEmit(address(zksAdapter));
200-
emit ZkStack_Adapter.ZkStackMessageRelayed(expectedTxnHash);
201+
emit AdapterInterface.MessageRelayed(target, message);
201202
zksAdapter.relayMessage{ value: baseCost }(target, message);
202203
}
203204

@@ -228,7 +229,7 @@ contract ZkStackAdapterTest is Test {
228229
);
229230

230231
vm.expectEmit(address(zksAdapter));
231-
emit ZkStack_Adapter.ZkStackMessageRelayed(expectedTxnHash);
232+
emit AdapterInterface.TokensRelayed(address(l1Weth), address(l2Weth), amountToSend, random);
232233
zksAdapter.relayTokens{ value: baseCost }(address(l1Weth), address(l2Weth), amountToSend, random);
233234
vm.stopPrank();
234235
}
@@ -254,7 +255,7 @@ contract ZkStackAdapterTest is Test {
254255
);
255256

256257
vm.expectEmit(address(zksAdapter));
257-
emit ZkStack_Adapter.ZkStackMessageRelayed(expectedTxnHash);
258+
emit AdapterInterface.TokensRelayed(address(l1Usdc), address(l2Usdc), amountToSend, random);
258259
zksAdapter.relayTokens{ value: baseCost }(address(l1Usdc), address(l2Usdc), amountToSend, random);
259260
}
260261

@@ -279,7 +280,7 @@ contract ZkStackAdapterTest is Test {
279280
);
280281

281282
vm.expectEmit(address(zksAdapter));
282-
emit ZkStack_Adapter.ZkStackMessageRelayed(expectedTxnHash);
283+
emit AdapterInterface.TokensRelayed(address(l1Token), address(l2Token), amountToSend, random);
283284
zksAdapter.relayTokens{ value: baseCost }(address(l1Token), address(l2Token), amountToSend, random);
284285
}
285286

@@ -305,7 +306,7 @@ contract ZkStackAdapterTest is Test {
305306
)
306307
);
307308
vm.expectEmit(address(zksCustomGasAdapter));
308-
emit ZkStack_CustomGasToken_Adapter.ZkStackMessageRelayed(expectedTxnHash);
309+
emit AdapterInterface.MessageRelayed(target, message);
309310
zksCustomGasAdapter.relayMessage(target, message);
310311
// Approve only the amount of the fee of the custom gas token. Since we don't actually transferFrom, the approval should stand.
311312
assertEq(l1CustomGasToken.allowance(address(zksCustomGasAdapter), sharedBridge), baseCost);
@@ -337,7 +338,7 @@ contract ZkStackAdapterTest is Test {
337338
);
338339

339340
vm.expectEmit(address(zksCustomGasAdapter));
340-
emit ZkStack_CustomGasToken_Adapter.ZkStackMessageRelayed(expectedTxnHash);
341+
emit AdapterInterface.TokensRelayed(address(l1Weth), address(l2Weth), amountToSend, random);
341342
zksCustomGasAdapter.relayTokens(address(l1Weth), address(l2Weth), amountToSend, random);
342343
vm.stopPrank();
343344
// Approve only the amount of the fee of the custom gas token. Since we don't actually transferFrom, the approval should stand.
@@ -364,7 +365,7 @@ contract ZkStackAdapterTest is Test {
364365
);
365366

366367
vm.expectEmit(address(zksCustomGasAdapter));
367-
emit ZkStack_CustomGasToken_Adapter.ZkStackMessageRelayed(expectedTxnHash);
368+
emit AdapterInterface.TokensRelayed(address(l1Usdc), address(l2Usdc), amountToSend, random);
368369
zksCustomGasAdapter.relayTokens(address(l1Usdc), address(l2Usdc), amountToSend, random);
369370
// Approve only the amount of the fee of the custom gas token. Since we don't actually transferFrom, the approval should stand.
370371
assertEq(l1CustomGasToken.allowance(address(zksCustomGasAdapter), usdcSharedBridge), baseCost);
@@ -391,7 +392,7 @@ contract ZkStackAdapterTest is Test {
391392
);
392393

393394
vm.expectEmit(address(zksCustomGasAdapter));
394-
emit ZkStack_CustomGasToken_Adapter.ZkStackMessageRelayed(expectedTxnHash);
395+
emit AdapterInterface.TokensRelayed(address(l1Token), address(l2Token), amountToSend, random);
395396
zksCustomGasAdapter.relayTokens(address(l1Token), address(l2Token), amountToSend, random);
396397
// Approve only the amount of the fee of the custom gas token. Since we don't actually transferFrom, the approval should stand.
397398
assertEq(l1CustomGasToken.allowance(address(zksCustomGasAdapter), sharedBridge), baseCost);
@@ -417,7 +418,7 @@ contract ZkStackAdapterTest is Test {
417418
)
418419
);
419420
vm.expectEmit(address(zksCustomGasAdapter));
420-
emit ZkStack_CustomGasToken_Adapter.ZkStackMessageRelayed(expectedTxnHash);
421+
emit AdapterInterface.TokensRelayed(address(l1CustomGasToken), address(l2CustomGasToken), amountToSend, random);
421422
zksCustomGasAdapter.relayTokens(address(l1CustomGasToken), address(l2CustomGasToken), amountToSend, random);
422423

423424
// Approve only the amount of the fee of the custom gas token. Since we don't actually transferFrom, the approval should stand.

0 commit comments

Comments
 (0)