From e8a8a5790fff55f055abd0ef9c94019768fd94a4 Mon Sep 17 00:00:00 2001 From: Layne Haber Date: Wed, 20 Mar 2024 20:11:36 -0600 Subject: [PATCH 1/5] feat: add router admins --- .../src/cli/init/config/mainnet/production.ts | 2 ++ .../contracts/src/cli/init/init.ts | 7 +++++- .../src/cli/ownership/helpers/constants.ts | 22 +++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/packages/deployments/contracts/src/cli/init/config/mainnet/production.ts b/packages/deployments/contracts/src/cli/init/config/mainnet/production.ts index 95002f23f9..b530f5c5fd 100644 --- a/packages/deployments/contracts/src/cli/init/config/mainnet/production.ts +++ b/packages/deployments/contracts/src/cli/init/config/mainnet/production.ts @@ -737,6 +737,8 @@ export const MAINNET_PRODUCTION_INIT_CONFIG: InitConfig = { "0x32d63da9f776891843c90787cec54ada23abd4c2", // Ingag "0xFaAB88015477493cFAa5DFAA533099C590876F21", // Paradox "0x6fd84ba95525c4ccd218f2f16f646a08b4b0a598", // Dokia + "0x5f4E31F4F402E368743bF29954f80f7C4655EA68", // Amber + "0xc770eC66052fe77ff2eF9edF9558236e2D1C41Ef", // Dialectic ], }, sequencers: { diff --git a/packages/deployments/contracts/src/cli/init/init.ts b/packages/deployments/contracts/src/cli/init/init.ts index 00190cc745..4268becc7d 100644 --- a/packages/deployments/contracts/src/cli/init/init.ts +++ b/packages/deployments/contracts/src/cli/init/init.ts @@ -719,7 +719,12 @@ export const initProtocol = async (protocol: ProtocolStack, apply: boolean, stag desired: true, // router admin submits (can be owner, assume router admin) auth: [ - { method: "owner", eval: (ret: string) => ret.toLowerCase() === network.signerAddress }, + { + method: "owner", + eval: (ret: string) => { + return ret.toLowerCase() === network.signerAddress.toLowerCase(); + }, + }, { method: "queryRole", args: [network.signerAddress], eval: (ret) => ret === 1 }, ], read: { method: "getRouterApproval", args: [router] }, diff --git a/packages/deployments/contracts/src/cli/ownership/helpers/constants.ts b/packages/deployments/contracts/src/cli/ownership/helpers/constants.ts index 8cbe09a1cb..a65c1efdd1 100644 --- a/packages/deployments/contracts/src/cli/ownership/helpers/constants.ts +++ b/packages/deployments/contracts/src/cli/ownership/helpers/constants.ts @@ -1,4 +1,26 @@ type AddressBook = Record<"mainnet" | "testnet", Record>; +import { constants } from "ethers"; + +export const ROUTER_ADMINS: AddressBook = { + mainnet: { + 6648936: "0x7bE978Cc84612E08f7844672B0E6A6F367FE2b6A", // mainnet + 1869640809: "0x7bE978Cc84612E08f7844672B0E6A6F367FE2b6A", // optimism + 6450786: "0x7bE978Cc84612E08f7844672B0E6A6F367FE2b6A", // bnb + 6778479: "0x7bE978Cc84612E08f7844672B0E6A6F367FE2b6A", // gnosis + 1886350457: "0x7bE978Cc84612E08f7844672B0E6A6F367FE2b6A", // polygon + 1634886255: "0x7bE978Cc84612E08f7844672B0E6A6F367FE2b6A", // arbitrum one + 1818848877: "0x7bE978Cc84612E08f7844672B0E6A6F367FE2b6A", // linea x + 1835365481: "", //TBD: "0x2f6e0e9212450c8d6Cd2a3BbD478855bfb464Dc0", // metis + 1835101812: "0x7bE978Cc84612E08f7844672B0E6A6F367FE2b6A", // mantle + 1887071085: "0x7bE978Cc84612E08f7844672B0E6A6F367FE2b6A", // polygonzk + 1635148152: "0x3C9B7B1Ab56e7922c6749B420cD4210f51F3d31F", // avalanche + 1650553709: "0x7bE978Cc84612E08f7844672B0E6A6F367FE2b6A", // base + 2053862243: "0xE11Bd4D60EEcbbFF8494E6b274e87cB71dcdb978", // zksync-era + 1836016741: "0x3C45f010512405BDEf283A32102A68114Dfc1e47", // mode + 1935897199: "0x3C45f010512405BDEf283A32102A68114Dfc1e47", // scroll + }, + testnet: {}, +}; export const PROTOCOL_ADMINS: AddressBook = { mainnet: { From 55ef30fb04f3f3d53b753a9ad223068a447a9623 Mon Sep 17 00:00:00 2001 From: Layne Haber Date: Wed, 20 Mar 2024 20:14:01 -0600 Subject: [PATCH 2/5] config: add safe salt to encrypted values --- ops/env/mainnet/core/secrets.prod.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ops/env/mainnet/core/secrets.prod.json b/ops/env/mainnet/core/secrets.prod.json index bc014e6228..9b0ff03396 100644 --- a/ops/env/mainnet/core/secrets.prod.json +++ b/ops/env/mainnet/core/secrets.prod.json @@ -33,6 +33,7 @@ "infura_key": "ENC[AES256_GCM,data:CFseUllVNz5Hzc3f0ACMEXC8Vud+FpfXWSJNcNrcDWE=,iv:Gl4+q5taIn2amrgIh4didomw4vZBSYBFdgxSbGz4SAM=,tag:K5i2ZNDVKwo6UJ5iIJPiqA==,type:str]", "graph_api_key": "ENC[AES256_GCM,data:P49Id+KJiffvtnB11Plr92aja0aj9na0v5XCWmbrcI4=,iv:Dte62MAGnvXVLaYD8id2wirAhklhBtpHMEROAjl3oOs=,tag:xkpef4z94QC4vVT5L7qOhA==,type:str]", "admin_token_lighthouse_prover_subscriber": "ENC[AES256_GCM,data:tVQNVGxtNTu+qL0K+zsCRCg=,iv:DgwnsaSfjG4aN7zZuy4+84LEZe1qjLmRh0eK90xAdg0=,tag:mC0IWKW6drwX87dP0IvK3w==,type:str]", + "eng_safe_salt": "ENC[AES256_GCM,data:ubs06YvUrDu85g==,iv:iuWfdceLatX8Ng+n03nGOQnkNzxJxTbH4sN4/JM3A8M=,tag:dzO4GeJa53o8M78xT7J9dg==,type:str]", "sops": { "kms": [ { @@ -46,10 +47,10 @@ "azure_kv": null, "hc_vault": null, "age": null, - "lastmodified": "2024-02-19T23:40:18Z", - "mac": "ENC[AES256_GCM,data:1qcT2O3dOTrCx+kJ9o7q89V9Vor8bv3nu3hmtTc2NfmO2MiU4BHLdC7iKmzF7pp6p86KRm/wqPGkF+hRQhSrKOuY/4Ft6txssNJaZLLAVtzLd0aGfZPzTdD1qm1JnphM86FtB1A9Zpzch1RS+dCU2tbljIjWHOT/Heknj2qnISg=,iv:wsIcGjK8FxCZxds1ANCPlIVCO4kl5I/qUaWDNtvD+Ic=,tag:qwI2QhCImy8eFUfjSL9ShQ==,type:str]", + "lastmodified": "2024-03-21T02:13:46Z", + "mac": "ENC[AES256_GCM,data:22ATjfRY1++KQkov/59z+dtxB8pkuxHK+kdUQ29JUNQmXKmN2ocK72v1klwOvS0LE4so6grDCi2pUhuF6Ph6vMzbl1FQnPnGclgWaC+qC7hNFK19tIEyg1MOI3p9iTKQ7qCAXJn6TQF3kLOWP9hCjllFGFpZV6dtrVMmIEOdgYg=,iv:K80uj9CLPWAXYjLkUSKjTfUxegwYsvq8uXa89v7XGCQ=,tag:y/zjXYSsdKduv2fIxjrPHg==,type:str]", "pgp": null, "unencrypted_suffix": "_unencrypted", - "version": "3.7.3" + "version": "3.8.1" } } \ No newline at end of file From 560fd00cede56b067698f5f3179bf3fd60a5a455 Mon Sep 17 00:00:00 2001 From: Layne Haber Date: Thu, 21 Mar 2024 13:21:11 -0600 Subject: [PATCH 3/5] fix: logging context --- .../agents/cartographer/poller/src/lib/operations/transfers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/agents/cartographer/poller/src/lib/operations/transfers.ts b/packages/agents/cartographer/poller/src/lib/operations/transfers.ts index 1d5af0c164..5eb77bbc18 100644 --- a/packages/agents/cartographer/poller/src/lib/operations/transfers.ts +++ b/packages/agents/cartographer/poller/src/lib/operations/transfers.ts @@ -219,7 +219,7 @@ export const updateBackoffs = async (): Promise => { logger, domains, } = getContext(); - const { requestContext, methodContext } = createLoggingContext("updateTransfers"); + const { requestContext, methodContext } = createLoggingContext("updateBackoffs"); const subgraphRelayerFeeQueryMetaParams: Map = new Map(); const subgraphSlippageUpdatesQueryMetaParams: Map = new Map(); await Promise.all( From 7afd664ffbbcbb3db521caa6d1f68cda93306e16 Mon Sep 17 00:00:00 2001 From: Layne Haber Date: Thu, 21 Mar 2024 13:23:02 -0600 Subject: [PATCH 4/5] feat: clear error status with backoff --- packages/adapters/database/src/client.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/adapters/database/src/client.ts b/packages/adapters/database/src/client.ts index ba4002bb59..d5988e881c 100644 --- a/packages/adapters/database/src/client.ts +++ b/packages/adapters/database/src/client.ts @@ -1550,7 +1550,11 @@ export const resetBackoffs = async ( const poolToUse = _pool ?? pool; const backoff = 32; await db - .update("transfers", { backoff, next_execution_timestamp: 0 }, { transfer_id: dc.isIn(transferIds) }) + .update( + "transfers", + { backoff, next_execution_timestamp: 0, error_status: null }, + { transfer_id: dc.isIn(transferIds) }, + ) .run(poolToUse); }; From 01419ade42dfce2ec8f47bb0f43419c9d46ea3d5 Mon Sep 17 00:00:00 2001 From: Layne Haber Date: Thu, 21 Mar 2024 13:26:13 -0600 Subject: [PATCH 5/5] chore: test asserts --- packages/adapters/database/test/client.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/adapters/database/test/client.spec.ts b/packages/adapters/database/test/client.spec.ts index 9f9ca5321e..6ffb1f5e69 100644 --- a/packages/adapters/database/test/client.spec.ts +++ b/packages/adapters/database/test/client.spec.ts @@ -1257,10 +1257,12 @@ describe("Database client", () => { queryRes = await pool.query("SELECT * FROM transfers WHERE transfer_id = $1", [transfer1.transferId]); expect(queryRes.rows[0].backoff).to.eq(32); expect(queryRes.rows[0].next_execution_timestamp).to.eq(0); + expect(queryRes.rows[0].error_status).to.be.null; queryRes = await pool.query("SELECT * FROM transfers WHERE transfer_id = $1", [transfer2.transferId]); expect(queryRes.rows[0].backoff).to.eq(32); expect(queryRes.rows[0].next_execution_timestamp).to.eq(0); + expect(queryRes.rows[0].error_status).to.be.null; queryRes = await pool.query("SELECT * FROM transfers WHERE transfer_id = $1", [transfer3.transferId]); expect(queryRes.rows[0].backoff).to.eq(64);