Commit Graph

25 Commits

Author SHA1 Message Date
Luke Anderson
91f5f17566 Removing 'success_respons' in favour of 'ResponseBuilder' 2019-09-13 19:10:11 +10:00
Luke Anderson
09e11dd081 Merge branch 'api-alignment' into validator-post-fns 2019-09-13 19:06:32 +10:00
Luke Anderson
b0e3ce7885 Addressed Paul's comments regarding head_state. 2019-09-13 18:58:08 +10:00
Luke Anderson
cd8f40b4b7 Getting regular endpoint functions to return futures.
- Wrapped endpoint functions in new into_boxfut function
 - Undid changes to Network API service, now returning ApiResult again.
 - Cleaning up of functions, and removal of success_response functions in updated endpoints.
 - A bunch of other clean-ups.
2019-09-12 15:20:31 +10:00
Luke Anderson
82f4303787 Merge branch 'api-alignment' into validator-post-fns 2019-09-12 15:12:54 +10:00
Luke Anderson
c254ac8c2e Separated acquisition of BeaconChain and BeaconState. 2019-09-12 01:44:45 +10:00
Luke Anderson
2739ee83f9 Further restructuring futures API.
- Adding try_future! macros where necessary
 - Returning ApiResult and mapping it to future instead
 - Upgrading POST publish block to return a future directly
2019-09-11 18:02:00 +10:00
Luke Anderson
b8667217f0 Made async functions work!
- Cleaned up imports
 - Moved ApiError and such to it's own error.rs
 - Obsoleted 'success_response' in favour of new async regular and json only flavours
 - Made ApiError work async and be derived from hyper errors
 - Added a check to ensure an error is thrown if a non-json encoding is requested on a json-only function
 - Made all the individual service functions return futures (only node and network for now)
2019-09-11 00:40:22 +10:00
Luke Anderson
b0090df543 Getting the restructured ApiService to work. 2019-09-10 19:30:36 +10:00
Luke Anderson
ca9094e79a WIP: Made block publishing validator function, which sends to a network channel. Untested. 2019-09-10 10:54:37 +10:00
Luke Anderson
0136eb33b0 WIP: Added POST functionality for pusblish_beacon_block. Currently doesn't compile, struggling with the borrow checker. 2019-09-09 12:54:14 +10:00
Luke Anderson
99c673045c Moved chain/cache building into separate function, and made sure that all REST API endpoints are using this function to get the state. 2019-09-09 12:10:41 +10:00
Luke Anderson
e6a0d038e9 Added YAML types for list of validators and added some logging to duties function. 2019-09-06 14:10:49 +10:00
Luke Anderson
bf2f459773 Extended API
- Added a /beacon/validators function, to list all validators active in a particular epoch
 - Moved 'get_genesis_state' function, to align with router.
 - Added content-type for error responses
 - Tried adding a cache update call to fix issue getting validator duties (this is WIP)
2019-09-04 23:03:05 +10:00
Luke Anderson
01b652ab0e Fixed merge conflict, updated calls.
- Fixed function re-names
 - Updated the function which gets the beacon_chain from the request, and makes sure caches are updated.
 - Updated this api-alignment branch with the new code from interop branch.
2019-09-04 16:06:14 +10:00
Luke Anderson
0c1ceab527 Addressed Paul's suggestions.
- Updated some comments.
 - Replaced match statements with map functions.
2019-09-04 13:43:45 +10:00
Luke Anderson
b432c8c58c Replaced unnecessary match statements with map_err and ok_or 2019-09-04 11:18:29 +10:00
Luke Anderson
dcd074877b Removed block publish feature, since it's incomplete currently. 2019-09-04 10:57:09 +10:00
Luke Anderson
632c13a9ec Fixing some API bits
- Adding the validator routes into the main function.
 - Fixing the setting of the aggregation bits, and handling errors correctly.
 - Rust format fixes, and addressing compiler warnings.
2019-09-01 15:41:03 +10:00
Luke Anderson
8ea1167563 Factored out getting beacon_chain from request into it's own function. 2019-09-01 15:09:01 +10:00
Luke Anderson
5ee1bb20b7 WIP: Furthered attestation production for validator. 2019-08-31 23:56:35 +10:00
Paul Hauner
682081ef07 Add first pass at removing speculative state 2019-08-29 19:14:52 +10:00
Luke Anderson
eaec5e7b69 Start implementation of 'get attstation' validator function.
- Created new /beacon/validator/attestation endpoint
 - Updated some small issues with the API spec.
2019-08-29 14:58:49 +10:00
Luke Anderson
faef347d18 Fleshed out some API endpoints.
- Added the /beacon/validator/block endpoint for GET (untested)
 - Added the /beacon/fork endpoint for GET
 - Cleaned up a bunch of unused imports & variables
 - Removed '/network/block_discovery' endpoint
2019-08-28 23:33:34 +10:00
Luke Anderson
328f11d564 Validator API (#504)
* Implemented more REST API endpoints.
 - Added many of the endpoints, which return 501 - Not Implemented
 - Created helper function to return a not implemented error
 - Created a parse_pubkey function to get a PublicKey from a hex string
 - Created a HTTP handler for the validator endpoints
 - Started implementing validator/duties endpoint.

* Fleshed out get validator duties.
 - Re-implemented the get validator duties function for the REST API
 - Added an 'as_hex_string' function to FakePublicKey, beacuse it was missing.

* Fixed small caching/state bug.

* Extended to array of API inputs.
 - Created  function for getting arrays from GET parameters.
 - Extended get validator duties function to support array of validator duties.

* Tidy API to be more consistent with recent decisions

* Addressing Paul's comments.
 - Cleaning up function to get list of proposers.
 - Removing unnecessary serde annotations
 - Clarifying error messages
 - Only accept pubkeys if they are '0x' prefixed.

* Fixed formatting with rustfmt.
2019-08-28 00:40:35 +10:00