-
Notifications
You must be signed in to change notification settings - Fork 123
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 price oracle proxy #1397
base: main
Are you sure you want to change the base?
Add price oracle proxy #1397
Conversation
Pull Request Test Coverage Report for Build 13400087732Details
💛 - Coveralls |
0d110e0
to
1ecfdf1
Compare
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.
(Summary of some points we discussed in chat:)
Instead of mirroring the price oracle's RPC endpoints, why not simply pass along its macaroon? We could add an RPC endpoint to tapd that returns the host, certificate, and macaroon of the price oracle service. Additionally, we could request a new sub-macaroon from the price oracle to maintain separated permissions.
Another consideration: if the client requires real, locally network-aware prices—that is, prices that counterparty edge nodes will accept—then we need to obtain that price through tapd and its RFQ process.
With that in mind, rather than duplicating the price oracle's RPC endpoint here, we could introduce a new tapd RPC endpoint. Initially, this endpoint would call the price oracle directly. However, in the future, it could leverage the RFQ system to retrieve a more accurate price across edge node peers.
This approach would also factor in asset illiquidity. We could name the new endpoint QueryBestAssetRate
, or something similar.
I think that's a major isolation leak. We should make minimal assumptions about resource or authentication sharing. |
1ecfdf1
to
3f73460
Compare
This commit changes the rpc server by adding a proxy to an underlying priceoraclerpc.
This commit adds a raw client getter for price oracles.
3f73460
to
a0dc36d
Compare
This PR adds a price oracle proxy to the rpcserver. The motivation behind is that an application dev might want to reuse the price oracle that is used with the connected tap daemon. Currently this would then mean that the application needs seperate connections for tapd and the price oracle. This simplyfies this.
Closes ##1356
AI generated summary
This pull request introduces a price oracle proxy feature to the system, along with necessary configurations and tests. The changes include adding new imports, configuration options, and implementing the price oracle proxy functionality in various parts of the codebase.
Key changes include:
Configuration and Imports:
priceoraclerpc
import in multiple files to support the price oracle proxy feature. (config.go
,itest/integration_test.go
,itest/tapd_harness.go
,perms/perms.go
,rfq/mock.go
,rfq/oracle.go
,rpcserver.go
,server.go
) [1] [2] [3] [4] [5] [6] [7] [8]Configuration Options:
AllowPublicPriceOracle
toRPCConfig
to control public access to the price oracle RPC endpoints. (config.go
) [1] [2] [3]ProxyPriceOracle
inConfig
to proxy price requests to another price oracle. (config.go
) [1] [2]Implementation:
QueryAssetRates
method inrpcServer
to handle price oracle proxy requests. (rpcserver.go
)PriceOracleServer
with the gRPC server. (rpcserver.go
)Testing:
testPriceOracleProxy
to verify the functionality of the price oracle proxy. (itest/integration_test.go
)itest/test_list_on_test.go
)QueryAssetRates
inMockPriceOracle
. (rfq/mock.go
)Miscellaneous:
ErrPriceOracleUnimplemented
to handle cases where the price oracle service is not implemented. (rpcserver.go
)These changes collectively introduce and test the price oracle proxy feature, ensuring it integrates seamlessly with the existing system.