* [rpc] Refactor - expose RPC functions in rpc package
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Refactor - Undo v1 & v2 code duplication pt1
* Move apiv1 into rpc package as baseline
* Create version enum
* Refactor API creation to use version enum
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Refactor - Rejoin GetBlockByNumber & GetBlockByHash
* Both RPC versions are supported in 1 function
* Created types directory for v1 & v2 response types
* Added framework to make rpc layer more clear and legible
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Refactor - Undo v1 & v2 code duplication pt2
* Rejoin blockchain.go functions
* Create legacy service
* Improve inline documentation
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Refactor - Undo v1 & v2 code duplication pt3
* Use StructuredResponse when returning an exposed type from RPC
* Remove addrlock.go
* Add RPCBlock creation with exposed struct for easy utility from consumers
* Update blockchain.go to reflect changes of RPCBlock
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Refactor - Undo v1 & v2 code duplication pt3
* Create types for RPCs that are returned.
* Reorganize types to appropriate v1 & v2 package.
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Refactor - Undo v1 & v2 code duplication pt4
* Add context to all RPCs
* Add response switches based on different versions of the API
* Add debug logs for RPC that don't return errors
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Refactor - Undo v1 & v2 code duplication pt5
* Add versions switches to all transaction related RPCs
* Integrate response with newly defined structures
* Add debug messages for RPCs that don't return errors
* Add inline documentation for all transaction related RPCs
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Refactor - Undo v1 & v2 code duplication pt6
* Remove apiv2
* Move StructuredResponse & TxHistoryArgs to main rpc types.go
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Refactor - Undo v1 & v2 code duplication pt7
* Create contract, pool, staking & transaction services
* Move apis into correct services
* Remove util.go (functions are now baked into RPCs in pool.go)
* Remove transaction.go (functions/methods are distributed among created services)
* Update changes for StructuredResponse
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Refactor - Add rpc server start/stop to pkg
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [node] Refactor - use new RPC start / stop for servers
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmy] Refactor - rename network.go to net.go to match rpc
* Change names for consistency with rpc pkg
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* fix go lint & go imports
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Refactor - Fix GetTransactionReceipt for staking txs
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Refactor - Rename v1 & v2 struct to not have leading 'RPC'
* Update comments
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [rpc] Refactor - make defaultBlocksPeriod be the num blocks per epoch
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* Add latest dir removal for make clean
Fix docker image in README
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmy] Refactor - Expose Harmony attributes & remove accessors
* Add internals for APIBackend & Harmony fuse
* Add skeleton for refactor of GetTotalStakingSnapshot
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmy] Refactor - Re-implement APIBacked methods in Harmony
* Add 'FIXME:done' comments to indicate implemented methods,
some were left out as they are simple accessors and will transition to using
the exposed harmony attributes.
* Split functions into standalone files for clarity.
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmy] Refactor - Fix GetTotalStakingSnapshot in Harmony implementation
Previous implementation used rps.LatestBlockNumber, which is a constant -1,
thus, the cache was never used
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmy] Refactor - Move ErrFinalizedTransaction to hmy.go
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmyapi] Refactor - Make PublicHarmonyAPI use Harmony instead of Backed
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmyapi] Refactor - Make NewPublicBlockChainAPI use Harmony instead of Backend
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmyapi] Refactor - Make NewPublicTransactionPoolAPI use Harmony instead of Backend
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmyapi] Refactor - Make DebugAPI use Harmony instead of Backend
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmyapi] Refactor - Make filers use Harmony instead of Backend
* Fix unhandled errors
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmy] Refactor - Change NetVersion to ChainID
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmyapi] Refactor - Change API service declaration to use Harmony
* Remove irrelevant TODOs
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [node] Refactor - Move harmony create to APIs fetch
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmy] Refactor - Remove api_backend.go & Backend
* Update hmyapi net.go to return ChainID as Version
* Remove unused err return on New Harmony obj
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmy] Refactor - Prettify var names, structure & comments
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmyapi] Refactor - Prettify var names, structure & comments
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmyapi] Refactor - Remove backend interface
* Fix lint
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmy] Refactor - Remove exposure for eventMux and chainDb
This is to satisfy existing interfaces, mainly the in filters.
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmy + hmyapi] Refactor - Fix imports
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmy] Refactor - Apply changes from #3243
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmyapi] Refactor - Make filters use Backend instead of hmy
This is for testing from eth if we need it in the future
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [hmyapi] Refactor - Fix imports
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* [api] Update block miner to return the correct hex value instead of wrong one address (v1)
* [api] Update block miner to return the correct hex value instead of wrong one address (v2)
* [api] Refactor for readability
* [hmy] Cache leader conversion results
[api] Get leader address from cache
* Fix lint
* [api] Minor optimization