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

feat: initiated feature of zetaclient-restricted-address #1790

Merged
merged 10 commits into from
Feb 26, 2024

Conversation

ws4charlie
Copy link
Contributor

@ws4charlie ws4charlie commented Feb 21, 2024

Description

  1. Added ComplianceConfig field to config file where observers can fill in a blacklist of evm addresses and bitcoin addresses (can be mixed)
  2. Any inbound transaction (ZetaSent, ERC20Deposit, Gas deposit) that involves a banned address (Sender or Receiver or txOrigin) will be ignored by observers.
  3. Any registered outbound cctx will be cancelled if it involves a banned address (Sender or Receiver). The cctx cancellation is done by zeroing out the amount of Zeta/ERC20/Gas token sent to Receiver.

Closes: 1789

Zeta and ERC20 Deposited

image
image

Restricted EVM address and BTC address
image
image

Gas token to TSS. Banned EVM address and BTC address

image
image

Outbound banned address is tested in e2e tests PR #1791

Example log file:
compliance.log

Example zetaclient config:
image

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Include instructions and any relevant details so others can reproduce.

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Checklist:

  • I have added unit tests that prove my fix feature works

Copy link

!!!WARNING!!!
nosec detected in the following files: zetaclient/bitcoin/utils.go

Be very careful about using #nosec in code. It can be a quick way to suppress security warnings and move forward with development, it should be employed with caution. Suppressing warnings with #nosec can hide potentially serious vulnerabilities. Only use #nosec when you're absolutely certain that the security issue is either a false positive or has been mitigated in another way.

Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203
Broad #nosec annotations should be avoided, as they can hide other vulnerabilities. The CI will block you from merging this PR until you remove #nosec annotations that do not target specific rules.

Pay extra attention to the way #nosec is being used in the files listed above.

@github-actions github-actions bot added the nosec label Feb 22, 2024
changelog.md Outdated Show resolved Hide resolved
zetaclient/bitcoin/bitcoin_client.go Outdated Show resolved Hide resolved
zetaclient/bitcoin/bitcoin_client.go Outdated Show resolved Hide resolved
zetaclient/bitcoin/bitcoin_client.go Outdated Show resolved Hide resolved
zetaclient/bitcoin/bitcoin_client.go Show resolved Hide resolved
zetaclient/bitcoin/bitcoin_client_test.go Outdated Show resolved Hide resolved
zetaclient/config/config.go Outdated Show resolved Hide resolved
zetaclient/config/config.go Outdated Show resolved Hide resolved
zetaclient/config/types.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Feb 23, 2024

Codecov Report

Attention: Patch coverage is 22.72727% with 170 lines in your changes are missing coverage. Please review.

Project coverage is 8.23%. Comparing base (ea1da8b) to head (e948d7d).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           develop   #1790      +/-   ##
==========================================
+ Coverage     8.10%   8.23%   +0.12%     
==========================================
  Files          251     252       +1     
  Lines        62166   62279     +113     
==========================================
+ Hits          5041    5126      +85     
- Misses       56743   56765      +22     
- Partials       382     388       +6     
Files Coverage Δ
x/crosschain/keeper/evm_deposit.go 55.93% <100.00%> (-6.93%) ⬇️
zetaclient/bitcoin/inbound_tracker.go 0.00% <0.00%> (ø)
zetaclient/bitcoin/utils.go 74.16% <85.71%> (+4.55%) ⬆️
common/utils.go 6.45% <0.00%> (-3.55%) ⬇️
zetaclient/common/utils.go 18.18% <18.18%> (ø)
zetaclient/evm/inbounds.go 13.30% <30.76%> (+13.30%) ⬆️
zetaclient/evm/evm_signer.go 0.00% <0.00%> (ø)
zetaclient/bitcoin/bitcoin_signer.go 0.00% <0.00%> (ø)
zetaclient/evm/evm_client.go 0.30% <0.00%> (-0.01%) ⬇️
zetaclient/bitcoin/bitcoin_client.go 13.34% <27.14%> (+4.05%) ⬆️

@ws4charlie ws4charlie changed the title feat: initiated feature of zetaclient-banned-address feat: initiated feature of zetaclient-restricted-address Feb 23, 2024
@ws4charlie ws4charlie merged commit 6c0e0bb into develop Feb 26, 2024
20 checks passed
@ws4charlie ws4charlie deleted the feat-zetaclient-banned-addresses branch February 26, 2024 19:19
lumtis pushed a commit that referenced this pull request Mar 5, 2024
* initiated feature of zetaclient-banned-address

* fix some issues in e2e tests

* fix gosec issues

* some unit tests, comments and refactor

* unified log prints for restricted address detection

* move restricted address to Unreleased section

* improved compliance log prints

* update compliance log print according to CharlieMc
lumtis added a commit that referenced this pull request Mar 12, 2024
* simplify docker compose

* fix makefi;e

* add new version

* type

* fix restart client

* some fixes

* add light upgrade test

* fix gov sending

* add admin function test command

* performance test

* fix lint

* add pprof port

* some fixes in tests

* test: emissions unit test (#1767)

* ci: run build workflow on develop push for code coverage generation (#1793)

* refactor: zetaclient metrics (#1783)

* Refactor zetaclient metrics

* Fix blame counter init

* Add changelog entry

* Add unreleased to changelog

* Remove blank line

* feat: initiated feature of zetaclient-restricted-address (#1790)

* initiated feature of zetaclient-banned-address

* fix some issues in e2e tests

* fix gosec issues

* some unit tests, comments and refactor

* unified log prints for restricted address detection

* move restricted address to Unreleased section

* improved compliance log prints

* update compliance log print according to CharlieMc

* chore(codecov.yml): fix ignore extension (#1814)

* chore(codecov.yml): fix ignore extension

* changelog

* refactor: remove params from config and introduce app context (#1774)

* refactor(`crosschain`): move ballot voting logic into `observer` (#1511)

* move logic for ballot voting for inbound

* fix mocks

* goimports

* changelog

* fix unit tests

* fix CI =

* x/observer/keeper/vote_outbound.go x/crosschain/types/expected_keepers.go x/crosschain/keeper/msg_server_vote_outbound_tx.go

* update mocks

* refactor finalized check

* make generate

* initialize vote inbound tests

* add sdk keepers in observer testutil

* implement mock option for observer

* inbound vote test

* initialize outbound tests

* goimports

* vote outbound tests

* update changelog

* test with integration tests

* add isNew in vote_inbound

* add tests back

* use tmp context for ballot logic

* add new test for finalized ballot

* add not finzalized test

* remove unused comment

* fix bitcoin credentials

* change upgrade version

* fix performance tests

* handler

* fix setup handler

* add light flag and use it for upgrade tests

* fix username

* add performance test back

* Update cmd/zetae2e/local/ethereum.go

* stefan comments

* changelog

* fix

---------

Co-authored-by: Tanmay <[email protected]>
Co-authored-by: skosito <[email protected]>
Co-authored-by: Charlie Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implementation of the tool to detect and ignore banned addresses
4 participants