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
Epic: API Refactoring #1764
Comments
This can be done with no code changes to the node if the SMApp uses the REST endpoints instead of gRPC. The node currently exposes both a gRPC interface and an HTTP/JSON interface for all endpoints. If the SMApp starts using the HTTP interface, we can use a public API gateway that only exposes a subset of endpoints and redirects requests from those endpoints to a set of backing nodes using round-robin (or similar load balancing mechanism). I think this makes a better architecture than nodes maintaining a persistent gRPC session with remote, user-controlled wallets. We're currently in the process of doing the same transition for the same reason for the PoET service: #1716 |
yes, this makes sense architecturally. |
@ilans - this is what I mentioned in our talk about the API |
Consider adding pagination to all methods which return a list of data items. @IlyaVi |
I believe we should refactor the API into categories / facades in the node level instead of just having a flat list of methods. This can be as simple as adding the facade name after v1 in methods rest urls. e.g. /v1/mesh/method1... Additional things to consider:
|
Inventory of API clients:
|
@lrettig @YaronWittenstein - We need to specify the API category for smart wallets. e.g. A method to read data from an app instance. |
I wasn't aware that you can do streaming over GRPC. That's exciting to hear. I'll look into it. I think streaming is important but I'm not married to websockets.
Agree. For comparison, this is how geth works:
|
I don't think the smart wallet, or any dapp, needs to use a special API. It's just transactions, right? Or in the case of statically reading data, it's like a "quasi" transaction. Basically we need to start thinking about what a Spacemesh |
I'll soon start working on App's Storage ABI. |
yes - this epic is what is the sm.js looks like... regarding smart wallet - the part in the api which is not txs that we need to specify is the method(s) to read wallet storage data. For example, to populate a smart wallet ui in the app... |
From Discord:
|
You just write a "constant" method in the smart contract and call it like this: https://web3js.readthedocs.io/en/v1.2.6/web3-eth-contract.html#methods-mymethod-call |
I don't think this is yaron's current design for read-only data in svm... I think he wants to have an explicit api for this use case... @YaronWittenstein |
Agree with Yaron. You can't have permissions on state data. Every node needs to be able to read all of the state to validate transactions - unless you want to talk about doing something super complicated using zero knowledge proofs, and we're obviously not going that route anytime soon! Can totally add that on top using encryption of course :) |
## Motivation See #1764 ## Changes - adds a new GRPC gateway json-http service - adds related flags and configs (for now, there is only a single flag to enable it, and another flag to set the port; it will be enabled for all corresponding new GRPC services that are also enabled) - starts/stops it in app setup/teardown ## Test Plan - tests new commandline flags (turning on the service, setting the port) - tests enabling the service in combination with enabling new GRPC service (at least one is required) - tests communication between new JSON service and new GRPC service - E2E test of one JSON service endpoint
## Motivation See #1764 ## Changes - adds a new GRPC gateway json-http service - adds related flags and configs (for now, there is only a single flag to enable it, and another flag to set the port; it will be enabled for all corresponding new GRPC services that are also enabled) - starts/stops it in app setup/teardown ## Test Plan - tests new commandline flags (turning on the service, setting the port) - tests enabling the service in combination with enabling new GRPC service (at least one is required) - tests communication between new JSON service and new GRPC service - E2E test of one JSON service endpoint
## Motivation See #1764 ## Changes - adds a new GRPC gateway json-http service - adds related flags and configs (for now, there is only a single flag to enable it, and another flag to set the port; it will be enabled for all corresponding new GRPC services that are also enabled) - starts/stops it in app setup/teardown ## Test Plan - tests new commandline flags (turning on the service, setting the port) - tests enabling the service in combination with enabling new GRPC service (at least one is required) - tests communication between new JSON service and new GRPC service - E2E test of one JSON service endpoint
## Motivation See #1764 ## Changes - adds a new GRPC gateway json-http service - adds related flags and configs (for now, there is only a single flag to enable it, and another flag to set the port; it will be enabled for all corresponding new GRPC services that are also enabled) - starts/stops it in app setup/teardown ## Test Plan - tests new commandline flags (turning on the service, setting the port) - tests enabling the service in combination with enabling new GRPC service (at least one is required) - tests communication between new JSON service and new GRPC service - E2E test of one JSON service endpoint
## Motivation See #1764 ## Changes - adds a new GRPC gateway json-http service - adds related flags and configs (for now, there is only a single flag to enable it, and another flag to set the port; it will be enabled for all corresponding new GRPC services that are also enabled) - starts/stops it in app setup/teardown ## Test Plan - tests new commandline flags (turning on the service, setting the port) - tests enabling the service in combination with enabling new GRPC service (at least one is required) - tests communication between new JSON service and new GRPC service - E2E test of one JSON service endpoint
## Motivation See #1764 ## Changes - adds a new GRPC gateway json-http service - adds related flags and configs (for now, there is only a single flag to enable it, and another flag to set the port; it will be enabled for all corresponding new GRPC services that are also enabled) - starts/stops it in app setup/teardown ## Test Plan - tests new commandline flags (turning on the service, setting the port) - tests enabling the service in combination with enabling new GRPC service (at least one is required) - tests communication between new JSON service and new GRPC service - E2E test of one JSON service endpoint
## Motivation See #1764 ## Changes - adds a new GRPC gateway json-http service - adds related flags and configs (for now, there is only a single flag to enable it, and another flag to set the port; it will be enabled for all corresponding new GRPC services that are also enabled) - starts/stops it in app setup/teardown ## Test Plan - tests new commandline flags (turning on the service, setting the port) - tests enabling the service in combination with enabling new GRPC service (at least one is required) - tests communication between new JSON service and new GRPC service - E2E test of one JSON service endpoint
## Motivation See #1764 ## Changes - adds a new GRPC gateway json-http service - adds related flags and configs (for now, there is only a single flag to enable it, and another flag to set the port; it will be enabled for all corresponding new GRPC services that are also enabled) - starts/stops it in app setup/teardown ## Test Plan - tests new commandline flags (turning on the service, setting the port) - tests enabling the service in combination with enabling new GRPC service (at least one is required) - tests communication between new JSON service and new GRPC service - E2E test of one JSON service endpoint
## Motivation See #1764 ## Changes - adds a new GRPC gateway json-http service - adds related flags and configs (for now, there is only a single flag to enable it, and another flag to set the port; it will be enabled for all corresponding new GRPC services that are also enabled) - starts/stops it in app setup/teardown ## Test Plan - tests new commandline flags (turning on the service, setting the port) - tests enabling the service in combination with enabling new GRPC service (at least one is required) - tests communication between new JSON service and new GRPC service - E2E test of one JSON service endpoint
## Motivation See #1764 ## Changes - adds a new GRPC gateway json-http service - adds related flags and configs (for now, there is only a single flag to enable it, and another flag to set the port; it will be enabled for all corresponding new GRPC services that are also enabled) - starts/stops it in app setup/teardown ## Test Plan - tests new commandline flags (turning on the service, setting the port) - tests enabling the service in combination with enabling new GRPC service (at least one is required) - tests communication between new JSON service and new GRPC service - E2E test of one JSON service endpoint
## Motivation See #1764 ## Changes - adds a new GRPC gateway json-http service - adds related flags and configs (for now, there is only a single flag to enable it, and another flag to set the port; it will be enabled for all corresponding new GRPC services that are also enabled) - starts/stops it in app setup/teardown ## Test Plan - tests new commandline flags (turning on the service, setting the port) - tests enabling the service in combination with enabling new GRPC service (at least one is required) - tests communication between new JSON service and new GRPC service - E2E test of one JSON service endpoint
## Motivation See #1764 ## Changes - adds a new GRPC gateway json-http service - adds related flags and configs (for now, there is only a single flag to enable it, and another flag to set the port; it will be enabled for all corresponding new GRPC services that are also enabled) - starts/stops it in app setup/teardown ## Test Plan - tests new commandline flags (turning on the service, setting the port) - tests enabling the service in combination with enabling new GRPC service (at least one is required) - tests communication between new JSON service and new GRPC service - E2E test of one JSON service endpoint
## Motivation See #1764 ## Changes - Implements each previously unimplemented NodeService endpoint ## Test Plan - Adds tests for every implemented endpoint in NodeService - These are implemented as an array of test data and subtests
## Motivation See #1764 Also Fixes #2116 Requires #2092, merge that first ## Changes - Adds stubs for all remaining services and endpoints - Upgrades to latest API build, renames a few API data items to be consistent with improved naming in the API code - Allows MeshService to read and return layer root hash: makes TransactionProcessor GetLayerStateRoot method public - Adds a config param (internal, only for testing) to force the syncer to always enable listening to gossip - Event Reporter no longer reports any details about Status updates, it just "pings" the listener which is responsible for re-fetching all status items they care about - Adds account, reward, receipt channels to Reporter; allows Reporter to block, or to increase channel buffer sizes, on initialization - Allows Reporter report methods to block (useful for tests) - Implements all endpoints that can be implemented (some, e.g. those involving transaction receipt, cannot yet be implemented) - Adds a method `GetSmesherID` to ATX to allow the nodeID that created it to be read, as part of finding ATXs by smesher for the API ## Test Plan - Adds tests for all new endpoints and services
## Motivation See #1764 Closes #2077, Closes #2078, Closes #2153, Closes #411, Closes #2163, Closes #2145, Closes #2168 ## Changes - Removes old GRPC API and HTTP-JSON gateway code - Removes protobuf code - Updates tests to use new API - Lots of cleanup of the system tests ## Test Plan No new tests required, this does not add any new functionality. Affected tests are updated/removed. ## TODO - [x] Remove old API code - [x] Update tests to use new API instead - [x] Remove all protobuf-related code and references - [x] Update README - [x] Update to API v1.0.0, adding GatewayService to new API for poet (#2133) - [x] Implement GatewayService (#2156) - [x] Update poet (spacemeshos/poet#98) - [x] Fix p2p tests broadcast issue - [x] Update hardcoded go-spacemesh docker images in configs - [x] Open issue to replace all `curl`/json http gateway server API interactions in tests with python grpc library (#2185) - [x] Update system tests (including tx_generator WalletAPI, test_p2p) to use new API - [x] Make sure spacecraft has been updated to factor in new ports and commandline flags (spacemeshos/spacecraft#1) - [x] Update hardcoded poet docker image spacemeshos/poet:develop, fix in configs (needs spacemeshos/poet#105) - [x] Merge #2157 - [x] Merge #2159 - [x] Merge #2169
## Motivation See #1764 Closes #2077, Closes #2078, Closes #2153, Closes #411, Closes #2163, Closes #2145, Closes #2168 ## Changes - Removes old GRPC API and HTTP-JSON gateway code - Removes protobuf code - Updates tests to use new API - Lots of cleanup of the system tests ## Test Plan No new tests required, this does not add any new functionality. Affected tests are updated/removed. ## TODO - [x] Remove old API code - [x] Update tests to use new API instead - [x] Remove all protobuf-related code and references - [x] Update README - [x] Update to API v1.0.0, adding GatewayService to new API for poet (#2133) - [x] Implement GatewayService (#2156) - [x] Update poet (spacemeshos/poet#98) - [x] Fix p2p tests broadcast issue - [x] Update hardcoded go-spacemesh docker images in configs - [x] Open issue to replace all `curl`/json http gateway server API interactions in tests with python grpc library (#2185) - [x] Update system tests (including tx_generator WalletAPI, test_p2p) to use new API - [x] Make sure spacecraft has been updated to factor in new ports and commandline flags (spacemeshos/spacecraft#1) - [x] Update hardcoded poet docker image spacemeshos/poet:develop, fix in configs (needs spacemeshos/poet#105) - [x] Merge #2157 - [x] Merge #2159 - [x] Merge #2169
## Motivation See #1764 Closes #2077, Closes #2078, Closes #2153, Closes #411, Closes #2163, Closes #2145, Closes #2168 ## Changes - Removes old GRPC API and HTTP-JSON gateway code - Removes protobuf code - Updates tests to use new API - Lots of cleanup of the system tests ## Test Plan No new tests required, this does not add any new functionality. Affected tests are updated/removed. ## TODO - [x] Remove old API code - [x] Update tests to use new API instead - [x] Remove all protobuf-related code and references - [x] Update README - [x] Update to API v1.0.0, adding GatewayService to new API for poet (#2133) - [x] Implement GatewayService (#2156) - [x] Update poet (spacemeshos/poet#98) - [x] Fix p2p tests broadcast issue - [x] Update hardcoded go-spacemesh docker images in configs - [x] Open issue to replace all `curl`/json http gateway server API interactions in tests with python grpc library (#2185) - [x] Update system tests (including tx_generator WalletAPI, test_p2p) to use new API - [x] Make sure spacecraft has been updated to factor in new ports and commandline flags (spacemeshos/spacecraft#1) - [x] Update hardcoded poet docker image spacemeshos/poet:develop, fix in configs (needs spacemeshos/poet#105) - [x] Merge #2157 - [x] Merge #2159 - [x] Merge #2169
See #1764 Closes #2077, Closes #2078, Closes #2153, Closes #411, Closes #2163, Closes #2145, Closes #2168 - Removes old GRPC API and HTTP-JSON gateway code - Removes protobuf code - Updates tests to use new API - Lots of cleanup of the system tests No new tests required, this does not add any new functionality. Affected tests are updated/removed. - [x] Remove old API code - [x] Update tests to use new API instead - [x] Remove all protobuf-related code and references - [x] Update README - [x] Update to API v1.0.0, adding GatewayService to new API for poet (#2133) - [x] Implement GatewayService (#2156) - [x] Update poet (spacemeshos/poet#98) - [x] Fix p2p tests broadcast issue - [x] Update hardcoded go-spacemesh docker images in configs - [x] Open issue to replace all `curl`/json http gateway server API interactions in tests with python grpc library (#2185) - [x] Update system tests (including tx_generator WalletAPI, test_p2p) to use new API - [x] Make sure spacecraft has been updated to factor in new ports and commandline flags (spacemeshos/spacecraft#1) - [x] Update hardcoded poet docker image spacemeshos/poet:develop, fix in configs (needs spacemeshos/poet#105) - [x] Merge #2157 - [x] Merge #2159 - [x] Merge #2169 Cherry-pick, and resolve some merge conflicts
Includes #2131 but also some testnet-specific fixes, and restores the old API API phase 11: cleanup old API and protoc code (#2131) See #1764 Closes #2077, Closes #2078, Closes #2153, Closes #411, Closes #2163, Closes #2145, Closes #2168 - Removes old GRPC API and HTTP-JSON gateway code - Removes protobuf code - Updates tests to use new API - Lots of cleanup of the system tests No new tests required, this does not add any new functionality. Affected tests are updated/removed. - [x] Remove old API code - [x] Update tests to use new API instead - [x] Remove all protobuf-related code and references - [x] Update README - [x] Update to API v1.0.0, adding GatewayService to new API for poet (#2133) - [x] Implement GatewayService (#2156) - [x] Update poet (spacemeshos/poet#98) - [x] Fix p2p tests broadcast issue - [x] Update hardcoded go-spacemesh docker images in configs - [x] Open issue to replace all `curl`/json http gateway server API interactions in tests with python grpc library (#2185) - [x] Update system tests (including tx_generator WalletAPI, test_p2p) to use new API - [x] Make sure spacecraft has been updated to factor in new ports and commandline flags (spacemeshos/spacecraft#1) - [x] Update hardcoded poet docker image spacemeshos/poet:develop, fix in configs (needs spacemeshos/poet#105) - [x] Merge #2157 - [x] Merge #2159 - [x] Merge #2169 Cherry-pick, and resolve some merge conflicts Restore old API
Everything is done except some documentation and some optimization. There are issues to track all of these and we'll follow up on them separately. |
For background on motivation and design, see spacemeshos/SMIPS#21 and https://github.com/spacemeshos/api.
Phases
Phase 1: E2E proof of concept (#2041)
implement and test single
Echo
endpoint inNodeService
(totally independent of existing grpc server)Phase 2: CLI support (#2043)
add CLI flags and allow new NodeService to be switched on
Phase 3: grpc-gateway proof of concept (#2053)
implement and test single
Echo
endpoint inNodeService
using grpc-gateway server (totally independent of existing grpc-gateway server)Phase 4: multiplexing grpc (#2054)
implement a second new GRPC service and multiplex it onto the same server/port as NodeService
Phase 5: multiplexing grpc-gateway (#2055)
do the same for the grpc-gateway server
Phase 6: NodeService (#2056)
fully implement this service, excluding stream endpoints
Phase 7: second grpc service (#2059)
implement a second service,
MeshService
, and testPhase 8: MeshService streams (#2061)
Phase 9: finish implementing grpc services (#2071)
Phase 10: docs (#2083)
document everything!
Phase 11: cleanup (#2131)
remove/deprecate old API, grpc service, grpc-gateway service, and all protobuf build code. Note: most of this work was already done in #2036 and can be carried over from that branch.
Phase 12: missing stuff
fill in the endpoints/data elements that weren't previously implemented because of functionality missing in go-spacemesh
Phase 13: optimization
replace naive implementations of data queries with optimized implementations - may require adding DB indices in some cases
TransactionService.TransactionsStateStream
)Misc
The text was updated successfully, but these errors were encountered: