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: add subscription and handler for upgrade oracle event #61

Merged
merged 6 commits into from
Jan 3, 2023

Conversation

0xHansLee
Copy link
Contributor

close #58

With implementation, I did some refactoring:

  • In verification of remote report, remove checking product ID. It seems that only checking unique ID is enough.
  • Move verifyTrustedBlockInfo to the function of verifiedQueryClient struct.
  • Refactor and split some functions that were in event/oracle/event.go to reuse in OracleUpgradeEvent.

@0xHansLee 0xHansLee linked an issue Dec 29, 2022 that may be closed by this pull request
Copy link
Contributor

@audtlr24 audtlr24 left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@gyuguen gyuguen left a comment

Choose a reason for hiding this comment

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

Thank you.
I have an one comment.

approvalMsg := &oracletypes.ApprovalSharingOracleKey{
UniqueId: approverUniqueID,
ApproverOracleAddress: approverAddress,
TargetOracleAddress: targetAddress,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to targetOracleUniqueID field in ApprovalSharingOracleKey struct.
This message should include the uniqueID of the target to be upgraded so that panacea-core can find it.
That is, it is a confirmation that this request is for the current upgrade target.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's good point. It'd be better to include target unique ID and compare it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll make an issue in both core and oracle, and then handle it as another PR.
Thank you for your comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wait, if the targetOracleUniqueID is to enable panacea to find unique ID, there is no need to add it.
panacea can get(find) unique ID of target uniqueID using GetOracleUpgradeInfo.
I'll think a little more about whether this is really necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my opinion, as @gyuguen said, it would be better to include TargetOracleUniqueID in ApprovalSharingOracleKey struct.

It's not a critical point because oracle checks the unique ID from upgrade-oracle event is equal to the current unique ID of upgrade version of oracle.
However, assuming that oracle and core do not believe each other, the unique ID check should also been done in core side.

Copy link
Contributor

@gyuguen gyuguen Jan 3, 2023

Choose a reason for hiding this comment

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

Yes. As you said, the value can be got from OracleUpgradeInfo.
But I think we will check if the request for Approval is really the uniqueID currently upgrading to.
If it is determined that this validation is not important, the TargetOracleUniqueID need not be added. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also think it's good to add.
made an issue 👍

Base automatically changed from ft/57/subscribi-approve-upgrade to main January 3, 2023 05:56
Copy link
Contributor

@inchori inchori left a comment

Choose a reason for hiding this comment

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

LGTM 👍

H4NLee added 2 commits January 3, 2023 15:58
…de-oracle

# Conflicts:
#	go.mod
#	go.sum
#	panacea/query_client.go
#	server/middleware/auth_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subscribe UpgradeOracle event
4 participants