From 117b6c029f42d198108dc3ba8dcc30cc51b67a51 Mon Sep 17 00:00:00 2001 From: DrZoltanFazekas <55164848+DrZoltanFazekas@users.noreply.github.com> Date: Thu, 22 Aug 2024 13:51:56 +0200 Subject: [PATCH] fix filter issue (#9) * add contract address to filters * add contract address to filters * Add a rustfmt.toml to get around linting issues. --------- Co-authored-by: Yaron --- .trunk/trunk.yaml | 38 +++++++++++++-------------- bridge-validators/rust-toolchain.toml | 4 +++ bridge-validators/rustfmt.toml | 3 +++ bridge-validators/src/bridge_node.rs | 14 +++++++--- 4 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 bridge-validators/rust-toolchain.toml create mode 100644 bridge-validators/rustfmt.toml diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 6c2dae0..d510944 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -1,34 +1,34 @@ version: 0.1 cli: - version: 1.22.0 + version: 1.22.3 plugins: sources: - id: trunk - ref: v1.2.1 + ref: v1.6.2 uri: https://github.com/trunk-io/plugins lint: enabled: - - clippy@1.65.0 + - clippy@1.79.0 - gofmt@1.20.4 - - golangci-lint@1.57.2 - - oxipng@9.1.1 + - golangci-lint@1.60.2 + - oxipng@9.1.2 - shellcheck@0.10.0 - - taplo@0.8.1 - - actionlint@1.6.27 + - taplo@0.9.3 + - actionlint@1.7.1 - hadolint@2.12.0 - - eslint@8.57.0 - - buildifier@7.1.1 + - eslint@9.9.0 + - buildifier@7.1.2 - git-diff-check - - markdownlint@0.40.0 - - prettier@3.2.5 + - markdownlint@0.41.0 + - prettier@3.3.3 - shfmt@3.6.0 - - svgo@3.2.0 - - gitleaks@8.18.2 - - flake8@7.0.0 + - svgo@3.3.2 + - gitleaks@8.18.4 + - flake8@7.1.1 - isort@5.13.2 - - black@24.4.2 - - rustfmt@1.65.0 + - black@24.8.0 + - rustfmt@1.79.0 # - shellcheck@0.9.0 - removed for being over-prissy and wanting tab indents - rrw 2023-04-25 ignore: - linters: [gitleaks] @@ -60,9 +60,9 @@ lint: runtimes: enabled: - - go@1.18.3 - - node@16.14.2 - - python@3.10.3 + - go@1.21.0 + - node@18.12.1 + - python@3.10.8 actions: enabled: - trunk-announce diff --git a/bridge-validators/rust-toolchain.toml b/bridge-validators/rust-toolchain.toml new file mode 100644 index 0000000..37e92ba --- /dev/null +++ b/bridge-validators/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "1.79.0" +components = ["rustfmt", "clippy"] +profile = "minimal" diff --git a/bridge-validators/rustfmt.toml b/bridge-validators/rustfmt.toml new file mode 100644 index 0000000..a034783 --- /dev/null +++ b/bridge-validators/rustfmt.toml @@ -0,0 +1,3 @@ +edition = "2021" +imports_granularity = "Crate" +group_imports = "StdExternalCrate" diff --git a/bridge-validators/src/bridge_node.rs b/bridge-validators/src/bridge_node.rs index ccd569a..a9a0041 100644 --- a/bridge-validators/src/bridge_node.rs +++ b/bridge-validators/src/bridge_node.rs @@ -76,7 +76,9 @@ impl BridgeNode { { self.chain_client .get_events( - event.filter, + event + .filter + .address(self.chain_client.chain_gateway_address), self.chain_client.chain_gateway_block_deployed.into(), to_block, ) @@ -138,8 +140,14 @@ impl BridgeNode { let chain_gateway: ChainGateway = self.chain_client.get_contract(); // TODO: polling finalized events - let relayed_filter = chain_gateway.event::().filter; - let dispatched_filter = chain_gateway.event::().filter; + let relayed_filter = chain_gateway + .event::() + .filter + .address(self.chain_client.chain_gateway_address); + let dispatched_filter = chain_gateway + .event::() + .filter + .address(self.chain_client.chain_gateway_address); let relayed_listener: EventListener = EventListener::new(self.chain_client.clone(), relayed_filter);