From 0dacec803cd44047f10f90e078a00b636fad025a Mon Sep 17 00:00:00 2001 From: Aki Wu Date: Thu, 14 Dec 2023 12:27:09 +0800 Subject: [PATCH] add crab --- Procfile.pug | 1 + config/ormpscan2.yml | 12 +++++++----- lib/tasks/messages.rake | 6 ++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Procfile.pug b/Procfile.pug index 6045bef..0851b9c 100644 --- a/Procfile.pug +++ b/Procfile.pug @@ -1,3 +1,4 @@ eth: bin/rails "pug:track_logs[1]" +crab: bin/rails "pug:track_logs[44]" arb1: bin/rails "pug:track_logs[42161]" darwinia: bin/rails "pug:track_logs[46]" diff --git a/config/ormpscan2.yml b/config/ormpscan2.yml index ccaae8c..ebebd5d 100644 --- a/config/ormpscan2.yml +++ b/config/ormpscan2.yml @@ -1,13 +1,15 @@ -development: +default: &default + mainnet: true chains: - 1 - 42161 - 46 + - 44 + +development: + <<: *default test: production: - chains: - - 1 - - 42161 - - 46 + <<: *default diff --git a/lib/tasks/messages.rake b/lib/tasks/messages.rake index 8f8c8d0..bcf2724 100644 --- a/lib/tasks/messages.rake +++ b/lib/tasks/messages.rake @@ -111,6 +111,12 @@ def skip_message?(message_accepted_log, network) # create message if not exists return true if Message.find_by(from_network: network, msg_hash: message_accepted_log.decoded['msg_hash']) + # 在主网环境下,从crab链发出的,但是目标不是主网链的消息,不处理 + mainnet = Rails.application.config.ormpscan2['mainnet'] + chains = Rails.application.config.ormpscan2['chains'].map(&:to_i).reject { |chain_id| chain_id == 44 } + right_target_chain = chains.include?(message_accepted_log.decoded['message.to_chain_id'].to_i) + return true if mainnet && network.chain_id == 44 && !right_target_chain + false end