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: implement approve oracle upgrade tx #582

Merged
merged 54 commits into from
Jan 4, 2023

Conversation

0xHansLee
Copy link
Contributor

@0xHansLee 0xHansLee commented Dec 29, 2022

close #574

Implemented MsgApproveOracleUpgrade transaction with some refactoring.

audtlr24 and others added 30 commits December 19, 2022 10:28
Co-authored-by: Youngjoon Lee <taxihighway@gmail.com>
…nto ft/569/oracle-upgrade-handler

# Conflicts:
#	cmd/panacead/cmd/genoracle.go
#	proto/panacea/oracle/v2/oracle.proto
…ft/571/upgrade-oracle-tx

# Conflicts:
#	proto/panacea/oracle/v2/oracle.proto
#	proto/panacea/oracle/v2/proposal.proto
#	proto/panacea/oracle/v2/query.proto
#	x/oracle/types/errors.go
#	x/oracle/types/keys.go
#	x/oracle/types/oracle.go
#	x/oracle/types/oracle.pb.go
#	x/oracle/types/query.pb.go
#	x/oracle/types/query.pb.gw.go
…ft/575/upgrade-proto

# Conflicts:
#	proto/panacea/oracle/v2/oracle.proto
#	proto/panacea/oracle/v2/proposal.proto
#	proto/panacea/oracle/v2/query.proto
#	x/oracle/types/keys.go
#	x/oracle/types/oracle.pb.go
#	x/oracle/types/query.pb.go
#	x/oracle/types/query.pb.gw.go
This reverts commit 44a3f47.
…1/upgrade-oracle-tx

# Conflicts:
#	proto/panacea/oracle/v2/oracle.proto
#	proto/panacea/oracle/v2/proposal.proto
#	x/oracle/keeper/grpc_query_oracle.go
#	x/oracle/types/keys.go
#	x/oracle/types/oracle.pb.go
Comment on lines -15 to -18
if err := oracleRegistration.ValidateBasic(); err != nil {
return err
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As commented in the previous PR, I deleted this validation.

@@ -133,10 +132,11 @@ func (suite *oracleTestSuite) TestRegisterOracleSuccess() {
suite.Require().Equal(suite.oracleCommissionMaxChangeRate, oracleFromKeeper.OracleCommissionMaxChangeRate)
}

func (suite *oracleTestSuite) TestRegisterOracleFailedValidateToMsgOracleRegistration() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Accordingly this, deleted validation test code.

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.

Thanks for your hard work. I have one comment.

Comment on lines 105 to 106
if err != nil || !existing {
return fmt.Errorf("failed to check if the approver oracle exists or not. address(%s)", approval.ApproverOracleAddress)
Copy link
Contributor

Choose a reason for hiding this comment

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

How about splitting the error? It seems that the address may not be valid and the oracle may not be in the store.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. 1c69a6d

As you can see the commit, I changed the HasOracle function.
Because we should check if the oracle exists and is active as well. Thank you for pointing out.

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.

LGTM

),
)

// TODO: add to queue(?) for update unique ID
Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed offline, it seems that you can check if the encryptedOraclePrivKey of OracleUpgrade is not nil without putting it in the queue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@audtlr24, we probably don't need to use queue to update unique ID for upgraded oracles.
As @gyuguen said, we can know that which oracles are upgraded through the EncryptedOralePrivKey in OracleUpgrade. It makes simpler I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, I understand. I will reflect it in PR #584.

Co-authored-by: Hansol Lee <38912532+H4NLee@users.noreply.github.com>
Copy link

@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

0xHansLee and others added 5 commits January 3, 2023 18:27
…oracle-reg

# Conflicts:
#	proto/panacea/oracle/v2/tx.proto
#	x/oracle/abci.go
#	x/oracle/abci_test.go
#	x/oracle/keeper/upgrade.go
#	x/oracle/types/message_oracle.go
#	x/oracle/types/oracle.go
#	x/oracle/types/tx.pb.go
… into ft/574/approve-oracle-upgrade

# Conflicts:
#	x/oracle/keeper/upgrade.go
#	x/oracle/types/errors.go
Base automatically changed from ft/na/rename-approve-oracle-reg to main January 4, 2023 02:43
…-upgrade

# Conflicts:
#	proto/panacea/oracle/v2/tx.proto
#	x/oracle/keeper/oracle.go
#	x/oracle/types/tx.pb.go
@0xHansLee 0xHansLee merged commit d7966ce into main Jan 4, 2023
@0xHansLee 0xHansLee deleted the ft/574/approve-oracle-upgrade branch January 4, 2023 02:55
Copy link
Contributor

@youngjoon-lee youngjoon-lee left a comment

Choose a reason for hiding this comment

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

lgtm

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.

Implement approve oracle upgrade tx
5 participants