Skip to content

Commit

Permalink
Merge branch 'master' into feat/FbV2-arbitrary-call
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi committed Oct 3, 2024
2 parents 693b432 + 66bb939 commit 2a785ca
Show file tree
Hide file tree
Showing 37 changed files with 2,857 additions and 127 deletions.
1 change: 1 addition & 0 deletions contrib/opbot/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ require (
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.54.0 // indirect
github.com/prometheus/procfs v0.15.0 // indirect
github.com/puzpuzpuz/xsync v1.5.2 // indirect
github.com/puzpuzpuz/xsync/v2 v2.5.1 // indirect
github.com/richardwilkes/toolbox v1.74.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
Expand Down
11 changes: 11 additions & 0 deletions packages/contracts-rfq/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.6.2](https://github.com/synapsecns/sanguine/compare/@synapsecns/contracts-rfq@0.6.1...@synapsecns/contracts-rfq@0.6.2) (2024-10-03)


### Bug Fixes

* **contracts-rfq:** gas bench tests for the views [SLT-275] ([#3217](https://github.com/synapsecns/sanguine/issues/3217)) ([68821a7](https://github.com/synapsecns/sanguine/commit/68821a7c7bca7b397abd7d54d5cf880af2a638b6))





## [0.6.1](https://github.com/synapsecns/sanguine/compare/@synapsecns/contracts-rfq@0.6.0...@synapsecns/contracts-rfq@0.6.1) (2024-10-02)

**Note:** Version bump only for package @synapsecns/contracts-rfq
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-rfq/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@synapsecns/contracts-rfq",
"license": "MIT",
"version": "0.6.1",
"version": "0.6.2",
"description": "FastBridge contracts.",
"private": true,
"files": [
Expand Down
19 changes: 19 additions & 0 deletions packages/contracts-rfq/test/FastBridgeV2.GasBench.Encoding.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {FastBridgeV2SrcBaseTest} from "./FastBridgeV2.Src.Base.t.sol";

// solhint-disable func-name-mixedcase, ordering
contract FastBridgeV2GasBenchmarkSrcProtocolFeesTest is FastBridgeV2SrcBaseTest {
// TODO: add more tests with variable length requests once arbitrary call is done

function test_getBridgeTransaction() public view {
bytes memory request = abi.encode(extractV1(tokenTx));
fastBridge.getBridgeTransaction(request);
}

function test_getBridgeTransactionV2() public view {
bytes memory request = abi.encode(tokenTx);
fastBridge.getBridgeTransactionV2(request);
}
}
16 changes: 12 additions & 4 deletions packages/contracts-rfq/test/FastBridgeV2.GasBench.Src.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,21 @@ contract FastBridgeV2GasBenchmarkSrcTest is FastBridgeV2SrcBaseTest {
}

function test_claim_token() public {
bytes32 txId = getTxId(provenTokenTx);
skipTimeAtLeast({time: CLAIM_DELAY + 1});
assertTrue(fastBridge.canClaim(txId, relayerA));
claim({caller: relayerA, bridgeTx: provenTokenTx});
assertEq(fastBridge.bridgeStatuses(getTxId(provenTokenTx)), IFastBridgeV2.BridgeStatus.RELAYER_CLAIMED);
assertEq(fastBridge.bridgeStatuses(txId), IFastBridgeV2.BridgeStatus.RELAYER_CLAIMED);
assertEq(srcToken.balanceOf(relayerA), INITIAL_RELAYER_BALANCE + tokenTx.originAmount);
assertEq(srcToken.balanceOf(address(fastBridge)), initialFastBridgeBalanceToken - tokenTx.originAmount);
}

function test_claimWithAddress_token() public {
bytes32 txId = getTxId(provenTokenTx);
skipTimeAtLeast({time: CLAIM_DELAY + 1});
assertTrue(fastBridge.canClaim(txId, relayerA));
claim({caller: relayerA, bridgeTx: provenTokenTx, to: relayerB});
assertEq(fastBridge.bridgeStatuses(getTxId(provenTokenTx)), IFastBridgeV2.BridgeStatus.RELAYER_CLAIMED);
assertEq(fastBridge.bridgeStatuses(txId), IFastBridgeV2.BridgeStatus.RELAYER_CLAIMED);
assertEq(srcToken.balanceOf(relayerB), INITIAL_RELAYER_BALANCE + tokenTx.originAmount);
assertEq(srcToken.balanceOf(address(fastBridge)), initialFastBridgeBalanceToken - tokenTx.originAmount);
}
Expand Down Expand Up @@ -209,17 +213,21 @@ contract FastBridgeV2GasBenchmarkSrcTest is FastBridgeV2SrcBaseTest {
}

function test_claim_eth() public {
bytes32 txId = getTxId(provenEthTx);
skipTimeAtLeast({time: CLAIM_DELAY + 1});
assertTrue(fastBridge.canClaim(txId, relayerA));
claim({caller: relayerA, bridgeTx: provenEthTx});
assertEq(fastBridge.bridgeStatuses(getTxId(provenEthTx)), IFastBridgeV2.BridgeStatus.RELAYER_CLAIMED);
assertEq(fastBridge.bridgeStatuses(txId), IFastBridgeV2.BridgeStatus.RELAYER_CLAIMED);
assertEq(relayerA.balance, INITIAL_RELAYER_BALANCE + ethTx.originAmount);
assertEq(address(fastBridge).balance, initialFastBridgeBalanceEth - ethTx.originAmount);
}

function test_claimWithAddress_eth() public {
bytes32 txId = getTxId(provenEthTx);
skipTimeAtLeast({time: CLAIM_DELAY + 1});
assertTrue(fastBridge.canClaim(txId, relayerA));
claim({caller: relayerA, bridgeTx: provenEthTx, to: relayerB});
assertEq(fastBridge.bridgeStatuses(getTxId(provenEthTx)), IFastBridgeV2.BridgeStatus.RELAYER_CLAIMED);
assertEq(fastBridge.bridgeStatuses(txId), IFastBridgeV2.BridgeStatus.RELAYER_CLAIMED);
assertEq(relayerB.balance, INITIAL_RELAYER_BALANCE + ethTx.originAmount);
assertEq(address(fastBridge).balance, initialFastBridgeBalanceEth - ethTx.originAmount);
}
Expand Down
Loading

0 comments on commit 2a785ca

Please sign in to comment.