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: update observer #1384

Merged
merged 21 commits into from
Nov 14, 2023
Merged

feat: update observer #1384

merged 21 commits into from
Nov 14, 2023

Conversation

kingpinXD
Copy link
Contributor

@kingpinXD kingpinXD commented Nov 7, 2023

Description

Add a new transction which allows

  • A tombstones operator to update their operator address
  • An admin to update someones operator address

Closes:

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

github-actions bot commented Nov 7, 2023

!!!WARNING!!!
nosec detected in the following files: x/observer/client/cli/tx_update_observer.go, x/observer/keeper/msg_server_update_observer_test.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 Nov 7, 2023
@kingpinXD kingpinXD marked this pull request as ready for review November 7, 2023 22:30
@kingpinXD kingpinXD marked this pull request as draft November 7, 2023 22:34
@kingpinXD kingpinXD changed the title Debug update observer feat: update observer Nov 7, 2023
@kingpinXD kingpinXD linked an issue Nov 8, 2023 that may be closed by this pull request
@kingpinXD kingpinXD marked this pull request as ready for review November 8, 2023 03:41
@lumtis
Copy link
Member

lumtis commented Nov 8, 2023

@kingpinXD can we add a description in the PR?

Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First review, have to drop off for a call, gonna make another review after

proto/observer/observer.proto Outdated Show resolved Hide resolved
testutil/keeper/observer.go Show resolved Hide resolved
x/observer/client/cli/tx_update_observer.go Outdated Show resolved Hide resolved
x/observer/client/cli/tx_update_observer.go Outdated Show resolved Hide resolved
x/observer/client/cli/tx_update_observer.go Outdated Show resolved Hide resolved
Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only allow a observer to update their address if they become tombstoned.
Couldn't we allow them to update it under any condition? For example they need to use a new key for a various reason like new security setup

x/observer/keeper/keeper.go Outdated Show resolved Hide resolved
x/observer/keeper/keeper_test.go Show resolved Hide resolved
x/observer/keeper/keeper_utils.go Outdated Show resolved Hide resolved
x/observer/keeper/keeper_utils.go Show resolved Hide resolved
x/observer/keeper/msg_server_add_observer.go Show resolved Hide resolved
x/observer/keeper/msg_server_update_observer.go Outdated Show resolved Hide resolved
x/observer/keeper/msg_server_update_observer.go Outdated Show resolved Hide resolved
x/observer/keeper/msg_server_update_observer_test.go Outdated Show resolved Hide resolved
x/observer/types/message_update_observer.go Show resolved Hide resolved
@kingpinXD
Copy link
Contributor Author

We only allow a observer to update their address if they become tombstoned. Couldn't we allow them to update it under any condition? For example they need to use a new key for a various reason like new security setup

No, because if we make this TX permission less it could lead to a situation where more than 66 % of observers change their operator address in the same block, which means any ballots created in that block cannot be finalized.
If they change their setup, they must contact the admin to help change their operator .

Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Just left two minor comments

proto/observer/observer.proto Outdated Show resolved Hide resolved
x/observer/types/message_update_observer.go Show resolved Hide resolved
Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we can use a #nosec for the raised gosec issue

changelog.md Outdated Show resolved Hide resolved
kingpinXD and others added 3 commits November 10, 2023 18:19
Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com>
Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@ws4charlie ws4charlie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kingpinXD kingpinXD merged commit ce3cc5f into develop Nov 14, 2023
14 of 15 checks passed
@kingpinXD kingpinXD deleted the debug-update-observer branch November 14, 2023 21:22
CharlieMc0 added a commit that referenced this pull request Dec 19, 2023
* feat: zeta supply checks (#1358)

* chore: improve changelogs format (#1390)

* sort changelogs

* refactor format

* comment

* fix(`crosschain`): use event index in inbound tx digest (#1372)

* add event index in observer inbound

* rename messages

* update method usage

* use event index

* fix cosmos-gosec

* depositor contract

* smoketest refactor

* fix contracts

* mutiple deposits smoke tests

* fix depositor

* withdrawer contract

* fix smoketest deposits

* fix withdrawer contract

* multiple withdraw test

* fix contracts

* fix withdraws

* update changelog

* fix: cherry pick v10.1.x hotfix (minRelayTxFee and bitcoin mainnet/testnet address format) (#1367)

* skip some more recent garbage outTx trackers

* skip garbage trackers and increase btc gas fee

* skip mainnet addresses in cctxs

* cherry picked minRelayTxFee hotfix and bitcoin testnet/mainnet address format fix

* resolve conflict

* update CHANGELOG.md for v10.1.x hotfix

---------

Co-authored-by: charliec <charliec@zetachain.com>
Co-authored-by: brewmaster012 <88689859+brewmaster012@users.noreply.github.com>

* feat: update observer (#1384)

* chore: add chain id to localnet and open port 26657 to make local testing easier.  (#1401)

* added chain id to configs

* mapped port 26657 to localhost

* feat: Add HSM capability for zetaclient hot key - non production (#1387)

* initial commit

* Added sign function and unit test

* hsm config updates

* introduce hsm mode

* added commands to get address and generate key in hsm

* skipping unit test as it will fail in CI

* ran make generate and fixed lint errors

* Update cmd/zetaclientd/hsm.go

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

* Update zetaclient/broadcast.go

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

* Update zetaclient/broadcast.go

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

* Update zetaclient/hsm_signer.go

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

* Update zetaclient/hsm_signer.go

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

* Update zetaclient/hsm_signer.go

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

* cleanup

* added config for hsm hotkey name and moved hsm mode flag to zetabridge cfg

* add entry to changelog.

* moved hsm to new package and added build flag for unit test

* add changelog entry

* fix lint errors

---------

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

* fix: speed up evm outtx inclusion and improve log prints (#1406)

Co-authored-by: charliec <charliec@zetachain.com>

* docs: add code freeze note (#1414)

* zetaclient: allow one 1 event that remotely calls zEVM contract per tx

* revert the accidental last commit

* include bitcoin outtx regardless of the cctx status (#38)

* refactor: condense logging for a supply checker  (#9)

* chore: increment handler version (#5)

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

* test: add tests for out tx tracker (#10)

* add tests fro out ts tracker

* use getEthereumChainID function in tests

---------

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

* fix: Zellic-3.7 - Add check for existing contract address to avoid overwriting. (#13)

* add check for existing contract address to avoid overwriting.

* Added check for redeployment of gas and asset token contracts
Added unit test for this scenario

* update changelog

---------

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

* fix: Zellic-3.2 - prevent deposit when zrc20 is paused (#31)

* add pause check

* revert on paused

* update tests

* add smoke test check

* goimports

* changelog

* Update x/crosschain/keeper/evm_deposit.go

Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com>

---------

Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com>

* test: ballot tests (#17)

* refactor(`fungible`): use code hash in `MsgUpdateContractBytecode` to allow for rollback (#23)

* code hash request

* make generate

* udpate message

* add cli command

* udpate smoke tests

* changelog

* update message name

* add check for length

* replace log with event

* add is contract check

* refactor: consolidate builds (#22)

* remove begin block

* remove build from smoketest

* deploy system contracts message

* msg tx

* add system contract deployment in smoke tests

* start core params refactor

* changelog

* refactor chains

* config refactor

* remaining build tags

* lint issues

* lint issues 2

* gen docs

* gen docs 2

* gosec issues 1

* fix cosmos nosec

* lint issues

* fix core params check

* make generate

* fix assign

* use privnet chains by default

* fix chain fetching

* use local goerli for smoke tests

* remove unamed gosec

* address nosec

* other goerli net to rename in smoketests

* gosec

* nosec alerts

* nosec alert 2

* use Bitcoin specific network

* fix address system contracts

* add logs in test

* Add more logs

* test remaining smoke tests

* remove hardcoded ZetaChain chain ID

* remove bitcoin hardcoded values

* add back smoketests

* fix smoke test except cross chain swap

* make generate

* add log message

* fix evm swap contract

* fix unit test 1

* fix CLI tests

* make generate

* fix log error

* fix Bitcoin proof test

* fix address test

* remove network flag and improve smoke tests

* add admin group

* move core params out of genesis

* remove unnecessary RemoveInTxTrackerIfExists

* add check for contract failure

* Update x/crosschain/keeper/keeper_cross_chain_tx_vote_inbound_tx.go

Co-authored-by: Tanmay <tanmay@zetachain.com>

* fix install in action

* improve events for system contract deploy

* error handling for bitcoin net params

* add utility functions in common

* add stateful smoketest from source

* try test fix

* fix unit test

* fix tests

---------

Co-authored-by: Tanmay <tanmay@zetachain.com>

* refactor: disable zeta supply checker routine (#45)

* docs: update changelog with v11.0.0

* chore: update go releaser

---------

Co-authored-by: Tanmay <tanmay@zetachain.com>
Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>
Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com>
Co-authored-by: charliec <charliec@zetachain.com>
Co-authored-by: brewmaster012 <88689859+brewmaster012@users.noreply.github.com>
Co-authored-by: Charlie <31941002+CharlieMc0@users.noreply.github.com>
Co-authored-by: kevinssgh <79858682+kevinssgh@users.noreply.github.com>
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.

observer : Update Observer mechanism
3 participants