-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: gas benchmark for relay with arbitrary call
- Loading branch information
1 parent
48cd1d7
commit c798dd2
Showing
3 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
packages/contracts-rfq/test/FastBridgeV2.GasBench.Dst.ArbitraryCall.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
import {FastBridgeV2GasBenchmarkDstTest} from "./FastBridgeV2.GasBench.Dst.t.sol"; | ||
import {RecipientMock} from "./mocks/RecipientMock.sol"; | ||
|
||
// solhint-disable func-name-mixedcase, ordering | ||
contract FastBridgeV2GasBenchmarkDstArbitraryCallTest is FastBridgeV2GasBenchmarkDstTest { | ||
// To get an idea about how much overhead the arbitrary call adds to the relaying process, we use a mock | ||
// recipient that has the hook function implemented as a no-op. | ||
// The mocked callParams are chosen to be similar to the real use cases: | ||
// - user address | ||
// - some kind of ID to decide what to do with the tokens next | ||
|
||
function setUp() public virtual override { | ||
// In the inherited tests userB is always used as the recipient of the tokens. | ||
userB = address(new RecipientMock()); | ||
vm.label(userB, "ContractRecipient"); | ||
super.setUp(); | ||
} | ||
|
||
function createFixturesV2() public virtual override { | ||
super.createFixturesV2(); | ||
bytes memory mockCallParams = abi.encode(userA, keccak256("Random ID")); | ||
setTokenTestCallParams(mockCallParams); | ||
setEthTestCallParams(mockCallParams); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters