Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge upstream changes and fix fork sync #53

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
2a8ad32
refactor(test): Split Across v3 BundleDataClient tests (#1663)
pxrl Jul 15, 2024
1eb7afc
chore: fix some comments (#1584)
finaltrip Jul 15, 2024
4ffc149
chore: fix typos (#1627)
omahs Jul 15, 2024
4865302
chore(deps): bump actions/dependency-review-action from 4.3.2 to 4.3.…
dependabot[bot] Jul 15, 2024
8ff7b07
chore(deps): bump braces from 3.0.2 to 3.0.3 (#1613)
dependabot[bot] Jul 15, 2024
01c2d2e
fix(APIClient): Dedup L1 tokens (#1653)
pxrl Jul 15, 2024
acd7109
improve(constants): Bump Polygon & Base getLogs block ranges (#1561)
pxrl Jul 15, 2024
84250fc
refactor(relayer): Simplify deposit confirmation config (#1546)
pxrl Jul 15, 2024
1695927
improve(InventoryClient): 1x overage on lite chains (#1683)
pxrl Jul 16, 2024
5ec9504
fix(relayer): Ignore HubPool liquidity on Lite deposits (#1679)
pxrl Jul 16, 2024
775ccf9
chore(deps): bump actions/checkout from 3 to 4 (#1394)
dependabot[bot] Jul 16, 2024
6810ae5
feat(blast): add blast finalizer (#1660)
bmzig Jul 16, 2024
c2f847c
refactor(ContractAddresses): Extract WETH definitions (#1685)
pxrl Jul 18, 2024
2ba2d23
refactor(Constants): Drop per-chain multicall chunk defaults (#1686)
pxrl Jul 18, 2024
62dfe6a
feat(InventoryClient): Consider repayment amount in choosing repaymen…
nicholaspai Jul 18, 2024
429b2c9
feat: Add Blast as chain we want to consider as a slow withdrawal rep…
nicholaspai Jul 18, 2024
9f9e476
feat(Scroll): add scroll constants (#1684)
bmzig Jul 18, 2024
11b274f
blast finalizations now take 7 days (#1691)
bmzig Jul 18, 2024
be40726
fix(constants): Drop relayer min fee to 1bps (#1689)
pxrl Jul 18, 2024
f42853e
improve(wethdepositor): make OP-Stack generic (#1548)
james-a-morris Jul 18, 2024
da1643f
test(briges): Add zkSync adapter test (#1632)
pxrl Jul 19, 2024
784a50b
fix(Finalizer): Update to zksync-ethers instead of zksync-web3 (#1600)
nicholaspai Jul 19, 2024
95a8125
chore: bump v20 (#1673)
james-a-morris Jul 19, 2024
ac9c93d
fix: bump logger to avoid sending warnings to PD (#1693)
mrice32 Jul 20, 2024
c27ebd4
fix(ProfitClient): Fix fill amount USD computation (#1688)
pxrl Jul 22, 2024
a3d7839
make adapters more generic (#1524)
james-a-morris Jul 22, 2024
4edcce2
fix(relayer): Restore internal fill status tracking (#1698)
pxrl Jul 23, 2024
0b64c18
fix(finalizer): Blast finalizer supports custom interface (#1697)
nicholaspai Jul 23, 2024
8553794
chore: Bump constants, contracts & sdk (#1700)
pxrl Jul 24, 2024
7614c3a
feat(scroll): Add Scroll adapter (#1699)
bmzig Jul 24, 2024
4b954ee
fix(relayer): Set fallback deposit confirmation defaults (#1702)
pxrl Jul 24, 2024
73d3ad1
fix(relayer): Don't assert on unresolved repaymentChainId (#1704)
pxrl Jul 25, 2024
fee3b52
fix(InventoryClient): Subtle target overage syntax error (#1706)
pxrl Jul 26, 2024
27f04fa
fix(relayer): Correctly resolve external lookbacks (#1707)
pxrl Jul 26, 2024
4c745f5
improve(relayer): Permit filling above MDC config (#1710)
pxrl Jul 26, 2024
5bd2efd
improve(relayer): swap priority of origin/destination for Lite chain …
bmzig Jul 26, 2024
31c7de8
feat(relayer): Track origin chain fill commitments (#1687)
pxrl Jul 29, 2024
958ece4
fix(ProfitClient): Reduce log level for unexpected output token (#1712)
pxrl Jul 29, 2024
db2e4a4
fix(relayer): Protect against unresolved limit idx (#1713)
pxrl Jul 29, 2024
0be6231
fix(generic bridges): use scroll's canonical bridge function (#1708)
bmzig Jul 30, 2024
45a5c9e
fix(relayer): Gracefully handle partial inventory config (#1719)
pxrl Jul 30, 2024
42bd5aa
[WIP] improve(relayer): Support deferring chain fills (#1716)
pxrl Jul 30, 2024
f6b739e
improve(Finalizer): Only construct spoke pool clients for L2s we are …
nicholaspai Aug 1, 2024
499c760
improve(Monitor): Ignore chains without pool rebalance leaves when lo…
nicholaspai Aug 1, 2024
10e0ab6
[WIP] improve(relayer): More robust fast relayer event ingestion (#1715)
pxrl Aug 2, 2024
8129687
improve(finalizer): update scroll finalizer with new api (#1722)
bmzig Aug 2, 2024
ad3a100
improve: prevent attestations on non-ready messages (#1728)
james-a-morris Aug 5, 2024
a395064
improve(bridges): add special USDC case for the ScrollBridge. (#1720)
bmzig Aug 7, 2024
1af130c
feat: Support Redstone (#1723)
pxrl Aug 7, 2024
1707420
fix: add ovm bridge for 690 (#1733)
bmzig Aug 7, 2024
8f0b3ea
improve(any): remove implicit any (#1734)
james-a-morris Aug 7, 2024
c50811c
improve(BlastFinalizer): Handle two step USDB withdrawal (#1703)
nicholaspai Aug 11, 2024
6ae245d
fix: Bump contracts & sdk for new Redstone SpokePool (#1742)
pxrl Aug 12, 2024
91614c4
feat(Dataworker): Move persistence of bundle data step to Disputer in…
nicholaspai Aug 14, 2024
d18d2b8
improve(Monitor): Unwrap WETH on Ethereum when attempting to refill E…
nicholaspai Aug 14, 2024
45c7863
improve(ArweaveClient): Log arweave details to custom slack channel, …
nicholaspai Aug 14, 2024
d0749cf
feat: Support Zora (#1731)
pxrl Aug 14, 2024
21bc951
fix: Bump SDK for dataworker fix (#1752)
pxrl Aug 15, 2024
5af02ba
fix(ProfitClient): Update constants & sdk for USDzC mapping (#1753)
pxrl Aug 15, 2024
f72e6cf
fix(constants): Update Multicall3 addresses (#1751)
pxrl Aug 16, 2024
041b178
improve(relayer): only send token approvals when allowance is half of…
bmzig Aug 16, 2024
2665843
feat(relayer): introduce tryMulticall into relayer (#1676)
bmzig Aug 16, 2024
2e51d41
improve(relayer): Permit per-token profitability config (#1760)
pxrl Aug 19, 2024
e7a49c9
improve: Log provider information on websocket error (#1764)
pxrl Aug 19, 2024
ff6939c
fix(relayer): Hard stop child process on exit (#1765)
pxrl Aug 19, 2024
74d8359
refactor(relayer): Rearrange external listener loop (#1766)
pxrl Aug 20, 2024
005c52a
improve(sdk): use sdk types/utils/hub (#1763)
james-a-morris Aug 20, 2024
5178700
feat(ProviderUtils): Support generic RPC provider keys (#1758)
pxrl Aug 21, 2024
4259756
docs: fix spelling issues (#1729)
nnsW3 Aug 21, 2024
c67af30
improve(adapters): swap zksync adapter with generic adapter (#1735)
bmzig Aug 21, 2024
0e02063
feat(Dataworker): Save merkle leaf proofs to Arweave (#1770)
nicholaspai Aug 22, 2024
1dc759c
feat: Log unprofitable fills in separate channel (#1774)
nicholaspai Aug 22, 2024
ff0816d
fix(zkSyncWethBridge): enable hub pool tracking (#1773)
bmzig Aug 22, 2024
119dafb
improve(Relayer): Tune down lite chain repayment logs for rebalancer …
nicholaspai Aug 22, 2024
e56a687
improve(relayer): Don't log ignored addresses on startup (#1776)
pxrl Aug 23, 2024
4d9d05d
improve(relayer): take refunds on origin when filling on a lite chain…
bmzig Aug 23, 2024
a598bd1
improve(SpokePoolClient): Log on failed listener (#1777)
pxrl Aug 23, 2024
a4ef934
fix(relayer): Lower log severity on listener SIGKILL (#1780)
pxrl Aug 23, 2024
d125f7f
fix(TryMulticallClient): Use simulated gasLimit when sending multical…
bmzig Aug 26, 2024
aa1ec0d
improve(BundleDataClient): Skip `queryHistoricalDepositForFill` funct…
nicholaspai Aug 26, 2024
1457eed
improve(RedisUtils): Log on lost redis connection (#1784)
pxrl Aug 26, 2024
9c4190d
improve(Relayer): Reduce size of overallocated-lite-chain log and sen…
nicholaspai Aug 26, 2024
1a6b143
fix(BundleDataClient): Don't mark deposits in the future as invalid (…
nicholaspai Aug 26, 2024
aad6559
fix(relayer): Don't log config on startup (#1786)
pxrl Aug 27, 2024
61ef0bc
fix: ignore logsBloom field for eth_getBlockByNumber rpc (#1789)
bmzig Aug 28, 2024
c7c705f
improve: remove reundant function definitions (#1762)
james-a-morris Aug 28, 2024
9e7de09
improve(relayer): Test lowered ethers pollingInterval (#1788)
pxrl Aug 28, 2024
cd17c2b
fix(BundleDataClient): Ignore slow fill requests for lite chains (#1792)
nicholaspai Aug 29, 2024
710839e
refactor(relayer): Defer origin chain limits computation (#1793)
pxrl Aug 29, 2024
66a52b5
refactor(relayer): Drop SKIP_RELAYS env configurable (#1794)
pxrl Aug 30, 2024
2822dd5
feat(validateRunningBalances): Add ability to log unexecuted leaves f…
nicholaspai Aug 30, 2024
bd7a763
improve(relayer): Rate-limit repetitive fill-related log messages (#1…
bmzig Aug 30, 2024
cdbfd25
improve(relayer): Log failed fill simulation separately (#1797)
pxrl Aug 30, 2024
bea685a
refactor(relayer): Drop SKIP_REBALANCING env configurable (#1795)
pxrl Aug 30, 2024
cb97b57
refactor(relayer): Relocate bridge approvals check (#1796)
pxrl Aug 30, 2024
1891525
fix: Make spokepool script v3-compatible (#1787)
pxrl Aug 30, 2024
ead455f
improve(adapters): Migrate Arbitrum One to generic adapter format (#1…
bmzig Sep 2, 2024
b55f874
fix: remove transactions field from eth_getBlockByNumber receipt (#1801)
bmzig Sep 2, 2024
955d2da
improve(relayer): Support keepalives over websockets (#1771)
pxrl Sep 5, 2024
1596ada
chore: refactor provider utils to sdk (#1737)
james-a-morris Sep 5, 2024
f454ee6
Merge remote-tracking branch 'upstream/master' into test-rebase-to-pa…
sameersubudhi Sep 6, 2024
af7b5b8
:wrench: Start the API server
sameersubudhi Sep 6, 2024
ad96de6
:hammer: Fix fork sync config
sameersubudhi Sep 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/fork-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ on:
jobs:
sync:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
timeout-minutes: 30 # `yarn test` takes longer time
steps:
- uses: tgymnich/[email protected]
with:
owner: across-protocol
repo: relayer
owner: LiskHQ
repo: across-relayer
head: master
base: master
pr_title: Sync fork repo
auto_merge: false
pr_title: Sync with upstream repo
pr_message: Merge latest changes from upstream repo
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@across-protocol/constants": "^3.1.14",
"@across-protocol/contracts": "^3.0.10",
"@across-protocol/sdk": "^3.1.27",
"@across-protocol/sdk": "^3.1.31",
"@arbitrum/sdk": "^3.1.3",
"@aws-sdk/client-kms": "^3.592.0",
"@aws-sdk/client-s3": "^3.592.0",
Expand All @@ -30,7 +30,6 @@
"@types/express": "^4.17.21",
"@uma/common": "2.33.0",
"@uma/logger": "^1.3.0",
"async": "^3.2.4",
"axios": "^1.6.1",
"dotenv": "^16.3.1",
"ethers": "^5.7.2",
Expand Down Expand Up @@ -77,7 +76,6 @@
"@nomiclabs/hardhat-waffle": "^2.0.5",
"@typechain/ethers-v5": "^10.2.1",
"@typechain/hardhat": "^6.1.6",
"@types/async-retry": "^1.4.5",
"@types/bluebird": "^3.5.38",
"@types/chai": "^4.3.5",
"@types/minimist": "^1.2.2",
Expand Down
80 changes: 66 additions & 14 deletions src/libexec/RelayerSpokePoolIndexer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import assert from "assert";
import minimist from "minimist";
import { setTimeout } from "node:timers/promises";
import { Contract, Event, EventFilter, providers as ethersProviders, utils as ethersUtils } from "ethers";
import { utils as sdkUtils } from "@across-protocol/sdk";
import * as utils from "../../scripts/utils";
Expand Down Expand Up @@ -36,7 +35,9 @@ type ScraperOpts = {

const { NODE_SUCCESS, NODE_APP_ERR } = utils;

const INDEXER_POLLING_PERIOD = 2000; // ms; time to sleep between checking for exit request via SIGHUP.
const INDEXER_POLLING_PERIOD = 2_000; // ms; time to sleep between checking for exit request via SIGHUP.
const WS_PING_INTERVAL = 20_000; // ms
const WS_PONG_TIMEOUT = WS_PING_INTERVAL / 2;

let logger: winston.Logger;
let chain: string;
Expand Down Expand Up @@ -199,7 +200,7 @@ async function listen(
});

do {
await setTimeout(INDEXER_POLLING_PERIOD);
await sdkUtils.delay(INDEXER_POLLING_PERIOD);
} while (!stop);
}

Expand Down Expand Up @@ -291,31 +292,82 @@ async function run(argv: string[]): Promise<void> {
const providers = getWSProviders(chainId, quorum);
let nProviders = providers.length;
assert(providers.length > 0, `Insufficient providers for ${chain} (required ${quorum} by quorum)`);

providers.forEach((provider) => {
provider._websocket.on("error", (err) => {
const _provider = getOriginFromURL(provider.connection.url);
const at = "RelayerSpokePoolIndexer::run";
let message = `Caught ${chain} provider error.`;
let log = logger.debug;
if (--nProviders < quorum) {
const { _websocket: ws } = provider;
const _provider = getOriginFromURL(provider.connection.url);
let interval: NodeJS.Timer | undefined;
let timeout: NodeJS.Timeout | undefined;

const closeProvider = () => {
if (interval) {
clearInterval(interval);
interval = undefined;
}

if (timeout) {
clearTimeout(timeout);
timeout = undefined;
}

if (!stop && --nProviders < quorum) {
stop = true;
log = logger.warn;
message += " Insufficient providers to continue.";
logger.warn({
at: "RelayerSpokePoolIndexer::run",
message: `Insufficient ${chain} providers to continue.`,
quorum,
nProviders,
});
}
log({ at, message, provider: _provider, quorum, nProviders, err });
};

// On connection, start an interval timer to periodically ping the remote end.
ws.on("open", () => {
interval = setInterval(() => {
ws.ping();
timeout = setTimeout(() => {
logger.warn({
at: "RelayerSpokePoolIndexer::run",
message: `Timed out on ${chain} provider.`,
provider: _provider,
});
ws.terminate();
}, WS_PONG_TIMEOUT);
}, WS_PING_INTERVAL);
});

provider._websocket.on("close", () => {
// Pong received; cancel the timeout.
ws.on("pong", () => {
if (timeout) {
clearTimeout(timeout);
timeout = undefined;
}
});

// Oops, something went wrong.
ws.on("error", (err) => {
const at = "RelayerSpokePoolIndexer::run";
const message = `Caught ${chain} provider error.`;
logger.debug({ at, message, provider: _provider, quorum, nProviders, err });
closeProvider();
});

// Websocket is gone.
ws.on("close", () => {
logger.debug({
at: "RelayerSpokePoolIndexer::run",
message: `${chain} provider connection closed.`,
provider: getOriginFromURL(provider.connection.url),
provider: _provider,
});
closeProvider();
});
});

logger.debug({ at: "RelayerSpokePoolIndexer::run", message: `Starting ${chain} listener.`, events, opts });
await listen(eventMgr, spokePool, events, providers, opts);

// Cleanup where possible.
providers.forEach((provider) => provider._websocket.terminate());
}

if (require.main === module) {
Expand Down
7 changes: 3 additions & 4 deletions src/relayer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ export async function runRelayer(_logger: winston.Logger, baseSigner: Signer): P
// Explicitly don't log ignoredAddresses because it can be huge and can overwhelm log transports.
const { ignoredAddresses: _ignoredConfig, ...loggedConfig } = config;
logger.debug({ at: "Relayer#run", message: "Relayer started 🏃‍♂️", loggedConfig, relayerRun });

logger.info({ at: "Relayer#run", message: "Starting relayer API server." });
await runAPIServer(logger);

const relayerClients = await constructRelayerClients(logger, config, baseSigner);
const relayer = new Relayer(await baseSigner.getAddress(), logger, relayerClients, config);
const simulate = !config.sendingRelaysEnabled;
const enableSlowFills = config.sendingSlowRelaysEnabled;

logger.info({ at: "Relayer#run", message: "Starting relayer API server." });
await runAPIServer(logger);

let run = 1;
let txnReceipts: { [chainId: number]: Promise<string[]> };
try {
Expand Down
Loading
Loading