Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspai committed Mar 22, 2024
2 parents b14e9ff + 3aa299e commit 20d1e78
Show file tree
Hide file tree
Showing 166 changed files with 14,574 additions and 12,675 deletions.
66 changes: 66 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
version: 2.1
jobs:
install:
docker:
- image: cimg/node:16.18.0
working_directory: ~/relayer-v2
resource_class: medium+
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- cache-node-v1-{{ checksum "yarn.lock" }}
- run:
name: Install Dependencies
command: yarn install --immutable
- save_cache:
name: Save Yarn Package Cache
key: cache-node-v1-{{ checksum "yarn.lock" }}
paths:
- node_modules
test:
docker:
- image: cimg/node:16.18.0
working_directory: ~/relayer-v2
resource_class: medium+
parallelism: 20
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- cache-node-v1-{{ checksum "yarn.lock" }}
- run:
name: Run build
command: yarn build
- run:
name: Run tests
command: |
circleci tests glob "test/**/*.ts" | circleci tests split > /tmp/test-files
yarn test --bail $(cat /tmp/test-files)
lint:
docker:
- image: cimg/node:16.18.0
working_directory: ~/relayer-v2
resource_class: medium+
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- cache-node-v1-{{ checksum "yarn.lock" }}
- run:
name: Run lint
command: yarn lint
workflows:
version: 2.1
build_and_test:
jobs:
- install
- test:
requires:
- install
- lint:
requires:
- install
58 changes: 48 additions & 10 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# Wallet details. Exercise *extreme* caution with these, and *never* share these
# lines from the configuration. Key theft will likely result in loss of funds.
# Uncomment and the configure desired variable, and use the following runtime
# argument to specify which should be used:
# Wallet configuration is controlled by the runtime argument:
# --wallet <secret|mnemonic|privateKey>
#
# --wallet <mnemonic|privateKey>
# SECRET identifies a file containing a mnemonic or private key. The file can
# reside anywhere in the accessible filesystem, and may have more restrictive
# permissions. This is the preferred method of configuring a wallet.
#SECRET="./secret"

# MNEMONIC or PRIVATE_KEY can be specified directly in the .env file. Exercise
# *extreme* caution with these, and *never* share these lines from the
# configuration. Key theft will likely result in loss of funds. Uncomment and
# the configure desired variable, and use the following runtime argument to
# specify which should be used:
#
#MNEMONIC="your twelve or twenty four word seed phrase..."
#PRIVATE_KEY=0xabc123...
Expand Down Expand Up @@ -70,6 +77,15 @@ NODE_MAX_CONCURRENCY=25
SEND_RELAYS=false


# Permit the finalizer to submit transactions for finalizing cross-chain actions.
# This is disabled by default and must be explicitly enabled for the finalizer to
# submit transactions via the MultiCaller client. When SEND_FINALIZATIONS is not
# set to "true", the bot will simulate making finalizations and will log the
# results, but will not submit transactions to the RPC provider. It is recommended
# to test with this before setting SEND_FINALIZATIONS to "true".
SEND_FINALIZATIONS=false


# List of origin and destination chains to be supported by the relayer. If set
# to a non-empty list, only transfers complying with the specified origin and
# destination chains will be filled. For example:
Expand Down Expand Up @@ -130,6 +146,12 @@ PRIORITY_FEE_SCALER_10=0.1
# like `eth_getBlock` in the Redis DB.
REDIS_URL="redis://127.0.0.1:6379"

# A namespace that will be used to prefix all keys in the Redis DB. This is
# useful if multiple relayers are running on the same Redis instance. This
# ENV variable is optional and defaults to not using a namespace.
# Possible Usage: This ENV variable can be used to effectively clear
# the Redis DB for an entire namespace.
GLOBAL_CACHE_NAMESPACE="ACROSS_0"

# The caching duration for a subset of the queries issued to RPC providers can
# be configured. The default time-to-live (TTL) of responses is 3600 seconds (60
Expand Down Expand Up @@ -226,14 +248,30 @@ RELAYER_TOKENS='["0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "0xA0b86991c6218b
# },
#}'

# The dataworker can be configured to store tertiary bundle data on Arweave
# for debugging and auditing purposes. This is disabled by default and must be
# explicitly enabled for the dataworker to store bundle data on Arweave. When
# PERSIST_DATA_TO_ARWEAVE is set to "true", the variables ARWEAVE_WALLET_JWK
# and ARWEAVE_GATEWAY must be set to valid values.
PERSIST_DATA_TO_ARWEAVE=false

# This wallet JWK is used to sign transactions intended for permenant storage of bundle
# data on Arweave. Ensure that the wallet has enough AR to cover the cost of storage.
ARWEAVE_WALLET_JWK=$({"kty":"", "e":"", "n":"", "d":"", "p":"", "q":"", "dp":"", "dq":"", "qi":""})

# The Arweave gateway to use for storing bundle data. This is used to connect to the
# Arweave network and store bundle data. The default gateway is the official Arweave
# gateway. This can be changed to a custom gateway if desired.
ARWEAVE_GATEWAY=$({"url":"", "port": 443, "protocol":"https"})

################################################################################
########################### Testing Configuration ##############################
################################################################################

# Note: This section is intended for advanced users only. It ONLY serves to aid
# developers in testing the relayer bot. It is NOT intended for any relayer
# or dataworker operator to use in production. It's recommended to consult
# the #relayers channel within the Across Discord server before making any
# developers in testing the relayer bot. It is NOT intended for any relayer
# or dataworker operator to use in production. It's recommended to consult
# the #relayers channel within the Across Discord server before making any
# changes to this section. See https://discord.across.to.
#
# Note: PLEASE DO NOT USE THIS SECTION IN PRODUCTION. IT IS FOR TESTING ONLY.
Expand All @@ -247,7 +285,7 @@ RELAYER_TOKENS='["0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "0xA0b86991c6218b
# Config Store.
#INJECT_CHAIN_ID_INCLUSION='{"blockNumber":17876743,"chainId":8453}'

# Used to force a proposal to be attempted regardless of whether there is a
# Used to force a proposal to be attempted regardless of whether there is a
# pending proposal. This is useful for testing the proposal logic.
# Note: This logic ONLY works if `SEND_PROPOSALS` is set to false.
#FORCE_PROPOSAL=false
Expand All @@ -257,4 +295,4 @@ RELAYER_TOKENS='["0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "0xA0b86991c6218b
# [number, number][] where the two numbers are the start and end bundle ranges and the array
# represents the bundle ranges that will be proposed per the chain id indices.
# Note: This logic ONLY works if `SEND_PROPOSALS` and `SEND_DISPUTES` are BOTH set to false.
# FORCE_PROPOSAL_BUNDLE_RANGE = [[1, 2], [1, 3], ...]
# FORCE_PROPOSAL_BUNDLE_RANGE = [[1, 2], [1, 3], ...]
27 changes: 12 additions & 15 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
# TODO: Re-Enable after @uma/* projects are updated to use the newer version of their vulnerable dependencies
# : This disabled file was signed-off by @nicholaspai during a huddle between @james-a-morris, @nicholaspai, and @pxrl
name: "Dependency Review"
on: [pull_request]

# name: "Dependency Review"
# on: [pull_request]
permissions:
contents: read

# permissions:
# contents: read

# jobs:
# dependency-review:
# runs-on: ubuntu-latest
# steps:
# - name: "Checkout Repository"
# uses: actions/checkout@v3
# - name: "Dependency Review"
# uses: actions/[email protected]
jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: "Checkout Repository"
uses: actions/checkout@v3
- name: "Dependency Review"
uses: actions/[email protected]
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# dotfiles are ignored by default and must be added explicitly. Use
# `git add -f <dotfile>` add a dotfile. Only do this for public files.
.*

node_modules
.env
coverage
coverage.json
typechain*
.DS_Store
dump.rdb*
.idea

# Hardhat files
cache
artifacts
dist

# Debugging files
*.log
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ yarn build

# Community

General discussion happens most frequently on the [Across discord](https://discord.com/invite/across).
General discussion happens most frequently on the [Across discord](https://discord.across.to).

# License

Expand Down
18 changes: 17 additions & 1 deletion contracts/AtomicWethDepositor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ interface ZkSyncL1Bridge {
) external pure returns (uint256);
}

interface LineaL1MessageService {
function sendMessage(address _to, uint256 _fee, bytes calldata _calldata) external payable;
}

/**
* @notice Contract deployed on Ethereum helps relay bots atomically unwrap and bridge WETH over the canonical chain
* bridges for Optimism, Base, Boba, ZkSync, and Polygon. Needed as these chains only support bridging of ETH, not WETH.
* bridges for Optimism, Base, Boba, ZkSync, Linea, and Polygon. Needed as these chains only support bridging of ETH,
* not WETH.
*/

contract AtomicWethDepositor {
Expand All @@ -45,8 +50,11 @@ contract AtomicWethDepositor {
OvmL1Bridge public immutable baseL1Bridge = OvmL1Bridge(0x3154Cf16ccdb4C6d922629664174b904d80F2C35);
PolygonL1Bridge public immutable polygonL1Bridge = PolygonL1Bridge(0xA0c68C638235ee32657e8f720a23ceC1bFc77C77);
ZkSyncL1Bridge public immutable zkSyncL1Bridge = ZkSyncL1Bridge(0x32400084C286CF3E17e7B677ea9583e60a000324);
LineaL1MessageService public immutable lineaL1MessageService =
LineaL1MessageService(0xd19d4B5d358258f05D7B411E21A1460D11B0876F);

event ZkSyncEthDepositInitiated(address indexed from, address indexed to, uint256 amount);
event LineaEthDepositInitiated(address indexed from, address indexed to, uint256 amount);

function bridgeWethToOvm(address to, uint256 amount, uint32 l2Gas, uint256 chainId) public {
weth.transferFrom(msg.sender, address(this), amount);
Expand All @@ -69,6 +77,14 @@ contract AtomicWethDepositor {
polygonL1Bridge.depositEtherFor{ value: amount }(to);
}

function bridgeWethToLinea(address to, uint256 amount) public payable {
weth.transferFrom(msg.sender, address(this), amount);
weth.withdraw(amount);
lineaL1MessageService.sendMessage{ value: amount + msg.value }(to, msg.value, "");
// Emit an event that we can easily track in the Linea-related adapters/finalizers
emit LineaEthDepositInitiated(msg.sender, to, amount);
}

function bridgeWethToZkSync(
address to,
uint256 amount,
Expand Down
3 changes: 2 additions & 1 deletion contracts/MockSpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ import "@across-protocol/contracts-v2/contracts/test/MockSpokePool.sol";
* this contract is explicitly defined here.
*/
contract _MockSpokePool is MockSpokePool {

/// @custom:oz-upgrades-unsafe-allow constructor
constructor(address _wrappedNativeTokenAddress) MockSpokePool(_wrappedNativeTokenAddress) {} // solhint-disable-line no-empty-blocks
}
Loading

0 comments on commit 20d1e78

Please sign in to comment.