-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add an gRPC endpoint for request verification #45
Conversation
} | ||
} | ||
if dataSourceID == nil { | ||
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("no data source required by the request %d found which relates to the external data source with ID %d.", req.RequestId, req.ExternalId)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should return 502 (Internal server error). If a request existed it should have a data source for every raw requests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is another possibility that a client sends some random external ID that does not exists in the request, which causes data source ID to be nil.
Fixed: BAND-220
When new oracle request is arrived on bandchain, yoda received the event and trying to request data from data provider. When there is a data provider that requires payment in order to access the data, the data provider should setup a server to check the request sent by yoda before providing data. The server may use this gRPC endpoint to verify the request sent by yoda to make sure that data provider will provide data to correct reporter account.
Implementation details
The gRPC endpoint is at
/oracle/verify_request
. It requires the following information for verification before report the dataRequestVerification
proto message.It will verify the following logic
There is also CLI command provided for ease of use and testing.
In order to query via grpc-gateway, it can be done by sending
GET
request to/oracle/v1/verify_request
with following parameterschain_id
: current chain IDvalidator
: validator accountrequest_id
: request IDexternal_id
: raw request's external IDreporter
: reporter's public key in bech32 formatsignature
: signature of all above data in base64 format. This can be done by following example codeThe following example command sends HTTP GET request
Please note that in unit test, there is a method that will be deprecated and unsupported soon, begins at v0.43.0, which is
Bech32ifyPubKey
(also affeectsMustBech32ifyPubKey
). Start at v0.43.0, we need to change the way to input reporter's public key by encoding the public key using protobuf'sAny
type field. See cosmos/cosmos-sdk#7357 for more informationPlease ensure the following requirements are met before submitting a pull request:
CHANGELOG_UNRELEASED.md
Files changed
tab in the Github PR explorer)