From 52ecfd155ecbbef3009eecd58e16f9433b841fff Mon Sep 17 00:00:00 2001 From: julian merlo Date: Thu, 25 Apr 2024 10:08:29 -0300 Subject: [PATCH 1/5] Map blast chain --- .../config/custom-environment-variables.json | 7 ++ blockchain-watcher/config/mainnet.json | 5 ++ .../repositories/RepositoriesBuilder.ts | 1 + .../repositories/RepositoriesBuilder.test.ts | 3 + blockchain-watcher/test/mocks/configMock.ts | 7 ++ .../workers/source-events-2.yaml | 64 ++++++++++--------- .../workers/target-events-2.yaml | 48 +++++++++++++- 7 files changed, 104 insertions(+), 31 deletions(-) diff --git a/blockchain-watcher/config/custom-environment-variables.json b/blockchain-watcher/config/custom-environment-variables.json index 68e3a1ce..921a9401 100644 --- a/blockchain-watcher/config/custom-environment-variables.json +++ b/blockchain-watcher/config/custom-environment-variables.json @@ -181,6 +181,13 @@ } } }, + "blast": { + "network": "BLAST_NETWORK", + "rpcs": { + "__name": "BLAST_RPCS", + "__format": "json" + } + }, "polygon-sepolia": { "network": "POLYGON_SEPOLIA_NETWORK", "rpcs": { diff --git a/blockchain-watcher/config/mainnet.json b/blockchain-watcher/config/mainnet.json index 2eb4f58f..8aa9782b 100644 --- a/blockchain-watcher/config/mainnet.json +++ b/blockchain-watcher/config/mainnet.json @@ -130,6 +130,11 @@ "https://scroll-mainnet.chainstacklabs.com", "https://scroll-mainnet.public.blastapi.io" ] + }, + "blast": { + "network": "mainnet", + "chainId": 36, + "rpcs": ["https://rpc.ankr.com/"] } } } diff --git a/blockchain-watcher/src/infrastructure/repositories/RepositoriesBuilder.ts b/blockchain-watcher/src/infrastructure/repositories/RepositoriesBuilder.ts index e8022a91..9cf8de39 100644 --- a/blockchain-watcher/src/infrastructure/repositories/RepositoriesBuilder.ts +++ b/blockchain-watcher/src/infrastructure/repositories/RepositoriesBuilder.ts @@ -63,6 +63,7 @@ const EVM_CHAINS = new Map([ ["ethereum-holesky", "evmRepo"], ["scroll", "evmRepo"], ["polygon-sepolia", "polygon-evmRepo"], + ["blast", "polygon-evmRepo"], ]); const POOL_STRATEGY = "weighted"; diff --git a/blockchain-watcher/test/infrastructure/repositories/RepositoriesBuilder.test.ts b/blockchain-watcher/test/infrastructure/repositories/RepositoriesBuilder.test.ts index 795c6140..c1a703b7 100644 --- a/blockchain-watcher/test/infrastructure/repositories/RepositoriesBuilder.test.ts +++ b/blockchain-watcher/test/infrastructure/repositories/RepositoriesBuilder.test.ts @@ -104,6 +104,9 @@ describe("RepositoriesBuilder", () => { expect(repos.getEvmBlockRepository("polygon-sepolia")).toBeInstanceOf( RateLimitedEvmJsonRPCBlockRepository ); + expect(repos.getEvmBlockRepository("blast")).toBeInstanceOf( + RateLimitedEvmJsonRPCBlockRepository + ); expect(repos.getAptosRepository()).toBeInstanceOf(RateLimitedAptosJsonRPCBlockRepository); expect(repos.getMetadataRepository()).toBeInstanceOf(FileMetadataRepository); expect(repos.getSnsEventRepository()).toBeInstanceOf(SnsEventRepository); diff --git a/blockchain-watcher/test/mocks/configMock.ts b/blockchain-watcher/test/mocks/configMock.ts index 84e8d981..cd8ebdd1 100644 --- a/blockchain-watcher/test/mocks/configMock.ts +++ b/blockchain-watcher/test/mocks/configMock.ts @@ -115,6 +115,13 @@ export const configMock = (): Config => { rpcs: ["http://localhost"], timeout: 10000, }, + blast: { + name: "blast", + network: "testnet", + chainId: 36, + rpcs: ["http://localhost"], + timeout: 10000, + }, "ethereum-sepolia": { name: "ethereum-sepolia", network: "sepolia", diff --git a/deploy/blockchain-watcher/workers/source-events-2.yaml b/deploy/blockchain-watcher/workers/source-events-2.yaml index 0d3ae12e..1efb7956 100644 --- a/deploy/blockchain-watcher/workers/source-events-2.yaml +++ b/deploy/blockchain-watcher/workers/source-events-2.yaml @@ -186,36 +186,6 @@ data: } ] }, - { - "id": "poll-log-message-published-arbitrum-sepolia", - "chain": "arbitrum-sepolia", - "source": { - "action": "PollEvm", - "config": { - "blockBatchSize": 100, - "commitment": "latest", - "interval": 30000, - "addresses": ["0x6b9C8671cdDC8dEab9c719bB87cBd3e782bA6a35"], - "chain": "arbitrum-sepolia", - "chainId": 10003 - } - }, - "handlers": [ - { - "action": "HandleEvmLogs", - "target": "sns", - "mapper": "evmLogMessagePublishedMapper", - "config": { - "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)", - "filter": { - "addresses": ["0x6b9C8671cdDC8dEab9c719bB87cBd3e782bA6a35"], - "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"] - }, - "metricName": "process_source_event" - } - } - ] - }, { "id": "poll-log-message-published-polygon", "chain": "polygon", @@ -576,6 +546,36 @@ data: } } ] + }, + { + "id": "poll-log-message-published-blast", + "chain": "blast", + "source": { + "action": "PollEvm", + "config": { + "blockBatchSize": 100, + "commitment": "latest", + "interval": 5000, + "addresses": ["0x473e002D7add6fB67a4964F13bFd61280Ca46886"], + "chain": "blast", + "chainId": 36 + } + }, + "handlers": [ + { + "action": "HandleEvmLogs", + "target": "sns", + "mapper": "evmLogMessagePublishedMapper", + "config": { + "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)", + "filter": { + "addresses": ["0x473e002D7add6fB67a4964F13bFd61280Ca46886"], + "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"] + }, + "metricName": "process_source_event" + } + } + ] } ] --- @@ -656,6 +656,10 @@ spec: - name: ARBITRUM_SEPOLIA_RPCS value: '{{ .ARBITRUM_SEPOLIA_RPCS }}' {{ end }} + {{ if .BLAST_RPCS }} + - name: BLAST_RPCS + value: '{{ .BLAST_RPCS }}' + {{ end }} image: {{ .IMAGE_NAME }} resources: limits: diff --git a/deploy/blockchain-watcher/workers/target-events-2.yaml b/deploy/blockchain-watcher/workers/target-events-2.yaml index 9f491e84..9606ccfd 100644 --- a/deploy/blockchain-watcher/workers/target-events-2.yaml +++ b/deploy/blockchain-watcher/workers/target-events-2.yaml @@ -476,7 +476,7 @@ data: "action": "PollEvm", "records": "GetEvmTransactions", "config": { - "blockBatchSize": 10, + "blockBatchSize": 100, "commitment": "latest", "interval": 5000, "addresses": [ @@ -514,6 +514,48 @@ data: } } ] + }, + { + "id": "poll-redeemed-transactions-blast", + "chain": "blast", + "source": { + "action": "PollEvm", + "records": "GetEvmTransactions", + "config": { + "blockBatchSize": 100, + "commitment": "latest", + "interval": 5000, + "addresses": [ + "0x430855B4D43b8AEB9D2B9869B74d58dda79C0dB2" + ], + "chain": "blast", + "chainId": 36, + "topics": [ + "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169", + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + ] + } + }, + "handlers": [ + { + "action": "HandleEvmTransactions", + "target": "sns", + "mapper": "evmRedeemedTransactionFoundMapper", + "config": { + "abi": "", + "filter": { + "addresses": [ + "0x430855B4D43b8AEB9D2B9869B74d58dda79C0dB2" + ], + "topics": [ + "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169", + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + ] + }, + "metricName": "process_vaa_event" + } + } + ] } ] --- @@ -614,6 +656,10 @@ spec: - name: MOONBEAM_RPCS value: '{{ .MOONBEAM_RPCS }}' {{ end }} + {{ if .BLAST_RPCS }} + - name: BLAST_RPCS + value: '{{ .BLAST_RPCS }}' + {{ end }} image: {{ .IMAGE_NAME }} resources: limits: From f0d6f39aa2a0b4a28180eedcf136d2e13a57136b Mon Sep 17 00:00:00 2001 From: julian merlo Date: Thu, 25 Apr 2024 10:18:05 -0300 Subject: [PATCH 2/5] Fix some files --- .../repositories/RepositoriesBuilder.ts | 2 +- .../workers/source-events-2.yaml | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/blockchain-watcher/src/infrastructure/repositories/RepositoriesBuilder.ts b/blockchain-watcher/src/infrastructure/repositories/RepositoriesBuilder.ts index 9cf8de39..03a913e8 100644 --- a/blockchain-watcher/src/infrastructure/repositories/RepositoriesBuilder.ts +++ b/blockchain-watcher/src/infrastructure/repositories/RepositoriesBuilder.ts @@ -63,7 +63,7 @@ const EVM_CHAINS = new Map([ ["ethereum-holesky", "evmRepo"], ["scroll", "evmRepo"], ["polygon-sepolia", "polygon-evmRepo"], - ["blast", "polygon-evmRepo"], + ["blast", "evmRepo"], ]); const POOL_STRATEGY = "weighted"; diff --git a/deploy/blockchain-watcher/workers/source-events-2.yaml b/deploy/blockchain-watcher/workers/source-events-2.yaml index 1efb7956..b6a85ebc 100644 --- a/deploy/blockchain-watcher/workers/source-events-2.yaml +++ b/deploy/blockchain-watcher/workers/source-events-2.yaml @@ -186,6 +186,36 @@ data: } ] }, + { + "id": "poll-log-message-published-arbitrum-sepolia", + "chain": "arbitrum-sepolia", + "source": { + "action": "PollEvm", + "config": { + "blockBatchSize": 100, + "commitment": "latest", + "interval": 30000, + "addresses": ["0x6b9C8671cdDC8dEab9c719bB87cBd3e782bA6a35"], + "chain": "arbitrum-sepolia", + "chainId": 10003 + } + }, + "handlers": [ + { + "action": "HandleEvmLogs", + "target": "sns", + "mapper": "evmLogMessagePublishedMapper", + "config": { + "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)", + "filter": { + "addresses": ["0x6b9C8671cdDC8dEab9c719bB87cBd3e782bA6a35"], + "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"] + }, + "metricName": "process_source_event" + } + } + ] + }, { "id": "poll-log-message-published-polygon", "chain": "polygon", From ce8fa049de7975fc9c638539c4faaa10f8f0f9d0 Mon Sep 17 00:00:00 2001 From: julian merlo Date: Thu, 25 Apr 2024 12:16:49 -0300 Subject: [PATCH 3/5] Map testnet chain --- blockchain-watcher/config/default.json | 7 +++++++ blockchain-watcher/config/mainnet.json | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/blockchain-watcher/config/default.json b/blockchain-watcher/config/default.json index 6a4870b2..7c4c8bfa 100644 --- a/blockchain-watcher/config/default.json +++ b/blockchain-watcher/config/default.json @@ -175,6 +175,13 @@ ], "timeout": 10000 }, + "blast": { + "name": "blast", + "network": "testnet", + "chainId": 36, + "rpcs": [], + "timeout": 10000 + }, "ethereum-sepolia": { "name": "ethereum-sepolia", "network": "sepolia", diff --git a/blockchain-watcher/config/mainnet.json b/blockchain-watcher/config/mainnet.json index 8aa9782b..b357bd29 100644 --- a/blockchain-watcher/config/mainnet.json +++ b/blockchain-watcher/config/mainnet.json @@ -133,7 +133,6 @@ }, "blast": { "network": "mainnet", - "chainId": 36, "rpcs": ["https://rpc.ankr.com/"] } } From 51e7743141747504d66f7689268f88c197466ab4 Mon Sep 17 00:00:00 2001 From: julian merlo Date: Thu, 25 Apr 2024 12:29:39 -0300 Subject: [PATCH 4/5] Map config job --- blockchain-watcher/config/default.json | 2 +- .../workers/source-events-2.yaml | 30 ++++++++++++++ .../workers/target-events-2.yaml | 40 +++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) diff --git a/blockchain-watcher/config/default.json b/blockchain-watcher/config/default.json index 7c4c8bfa..6b43b93a 100644 --- a/blockchain-watcher/config/default.json +++ b/blockchain-watcher/config/default.json @@ -179,7 +179,7 @@ "name": "blast", "network": "testnet", "chainId": 36, - "rpcs": [], + "rpcs": ["https://blast-sepolia.drpc.org", "https://sepolia.blast.io"], "timeout": 10000 }, "ethereum-sepolia": { diff --git a/deploy/blockchain-watcher/workers/source-events-2.yaml b/deploy/blockchain-watcher/workers/source-events-2.yaml index b6a85ebc..862cf859 100644 --- a/deploy/blockchain-watcher/workers/source-events-2.yaml +++ b/deploy/blockchain-watcher/workers/source-events-2.yaml @@ -334,6 +334,36 @@ data: } } ] + }, + { + "id": "poll-log-message-published-blast", + "chain": "blast", + "source": { + "action": "PollEvm", + "config": { + "blockBatchSize": 100, + "commitment": "latest", + "interval": 5000, + "addresses": [""], + "chain": "blast", + "chainId": 36 + } + }, + "handlers": [ + { + "action": "HandleEvmLogs", + "target": "sns", + "mapper": "evmLogMessagePublishedMapper", + "config": { + "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)", + "filter": { + "addresses": [""], + "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"] + }, + "metricName": "process_source_event" + } + } + ] } ] mainnet-jobs.json: |- diff --git a/deploy/blockchain-watcher/workers/target-events-2.yaml b/deploy/blockchain-watcher/workers/target-events-2.yaml index 9606ccfd..4aa3d990 100644 --- a/deploy/blockchain-watcher/workers/target-events-2.yaml +++ b/deploy/blockchain-watcher/workers/target-events-2.yaml @@ -286,6 +286,46 @@ data: } } ] + }, + { + "id": "poll-redeemed-transactions-blast", + "chain": "blast", + "source": { + "action": "PollEvm", + "records": "GetEvmTransactions", + "config": { + "blockBatchSize": 100, + "commitment": "latest", + "interval": 5000, + "addresses": [ + "" + ], + "chain": "blast", + "chainId": 36, + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + ] + } + }, + "handlers": [ + { + "action": "HandleEvmTransactions", + "target": "sns", + "mapper": "evmRedeemedTransactionFoundMapper", + "config": { + "abi": "", + "filter": { + "addresses": [ + "" + ], + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" + ] + }, + "metricName": "process_vaa_event" + } + } + ] } ] mainnet-jobs.json: |- From 3b62f2b9960a21de1e55bb35d28b4e6f13167f0f Mon Sep 17 00:00:00 2001 From: julian merlo Date: Thu, 25 Apr 2024 15:28:10 -0300 Subject: [PATCH 5/5] Map testnet contracts --- deploy/blockchain-watcher/workers/source-events-2.yaml | 8 ++++---- deploy/blockchain-watcher/workers/target-events-2.yaml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/deploy/blockchain-watcher/workers/source-events-2.yaml b/deploy/blockchain-watcher/workers/source-events-2.yaml index 862cf859..1d41c6a3 100644 --- a/deploy/blockchain-watcher/workers/source-events-2.yaml +++ b/deploy/blockchain-watcher/workers/source-events-2.yaml @@ -344,7 +344,7 @@ data: "blockBatchSize": 100, "commitment": "latest", "interval": 5000, - "addresses": [""], + "addresses": ["0x473e002D7add6fB67a4964F13bFd61280Ca46886"], "chain": "blast", "chainId": 36 } @@ -357,7 +357,7 @@ data: "config": { "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)", "filter": { - "addresses": [""], + "addresses": ["0x473e002D7add6fB67a4964F13bFd61280Ca46886"], "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"] }, "metricName": "process_source_event" @@ -616,7 +616,7 @@ data: "blockBatchSize": 100, "commitment": "latest", "interval": 5000, - "addresses": ["0x473e002D7add6fB67a4964F13bFd61280Ca46886"], + "addresses": [""], "chain": "blast", "chainId": 36 } @@ -629,7 +629,7 @@ data: "config": { "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)", "filter": { - "addresses": ["0x473e002D7add6fB67a4964F13bFd61280Ca46886"], + "addresses": [""], "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"] }, "metricName": "process_source_event" diff --git a/deploy/blockchain-watcher/workers/target-events-2.yaml b/deploy/blockchain-watcher/workers/target-events-2.yaml index 4aa3d990..f5d68f98 100644 --- a/deploy/blockchain-watcher/workers/target-events-2.yaml +++ b/deploy/blockchain-watcher/workers/target-events-2.yaml @@ -298,7 +298,7 @@ data: "commitment": "latest", "interval": 5000, "addresses": [ - "" + "0x430855B4D43b8AEB9D2B9869B74d58dda79C0dB2" ], "chain": "blast", "chainId": 36, @@ -316,7 +316,7 @@ data: "abi": "", "filter": { "addresses": [ - "" + "0x430855B4D43b8AEB9D2B9869B74d58dda79C0dB2" ], "topics": [ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" @@ -566,7 +566,7 @@ data: "commitment": "latest", "interval": 5000, "addresses": [ - "0x430855B4D43b8AEB9D2B9869B74d58dda79C0dB2" + "" ], "chain": "blast", "chainId": 36, @@ -585,7 +585,7 @@ data: "abi": "", "filter": { "addresses": [ - "0x430855B4D43b8AEB9D2B9869B74d58dda79C0dB2" + "" ], "topics": [ "0xcaf280c8cfeba144da67230d9b009c8f868a75bac9a528fa0474be1ba317c169",