-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(contracts-rfq): gas benchmark for the arbitrary call [SLT-233] (#…
…3273) * test: gas bench for bridge with arbitrary call * refactor: deduplicate checks * fix: gas benchmark contract names * test: gas benchmark for relay with arbitrary call * test: separate set of cases for bridge/prove/claim with arbitrary calls * fix: start from nonce=1 in gas benchmark tests
- Loading branch information
1 parent
1f61284
commit 0428f30
Showing
8 changed files
with
94 additions
and
32 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
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
18 changes: 18 additions & 0 deletions
18
packages/contracts-rfq/test/FastBridgeV2.GasBench.Src.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,18 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
import {FastBridgeV2GasBenchmarkSrcTest} from "./FastBridgeV2.GasBench.Src.t.sol"; | ||
|
||
// solhint-disable func-name-mixedcase, ordering | ||
contract FastBridgeV2GasBenchmarkSrcArbitraryCallTest is FastBridgeV2GasBenchmarkSrcTest { | ||
function createFixturesV2() public virtual override { | ||
super.createFixturesV2(); | ||
bytes memory mockCallParams = abi.encode(userA, keccak256("Random ID")); | ||
setTokenTestCallParams(mockCallParams); | ||
setEthTestCallParams(mockCallParams); | ||
bridgedTokenTx.callParams = mockCallParams; | ||
bridgedEthTx.callParams = mockCallParams; | ||
provenTokenTx.callParams = mockCallParams; | ||
provenEthTx.callParams = 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
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