Commit Graph

286 Commits

Author SHA1 Message Date
Derrick Hammer 7c873db91b
*Add debug code to track log messages and store then in memory to be accessed over rpc 2022-12-16 08:05:16 -05:00
Derrick Hammer 58ff8f2f92
*Add methods get_bootstrap_info and get_connected_peers to debug
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-12-15 13:44:50 -05:00
Derrick Hammer d28868508b
Revert "*Need to use dynamic import"
This reverts commit 6413d97c61.
2022-12-15 06:23:28 -05:00
Derrick Hammer 485fa98f0e
Revert "*Need to return dynamic function and execute it"
This reverts commit 55fa792bc9.
2022-12-15 06:23:28 -05:00
Derrick Hammer 55fa792bc9
*Need to return dynamic function and execute it 2022-12-15 06:04:24 -05:00
Derrick Hammer 6413d97c61
*Need to use dynamic import
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-12-15 05:42:22 -05:00
Derrick Hammer 884ba62bde
*Add timeout support to broadcast request with a default timeout of 5 seconds.
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-12-15 04:58:54 -05:00
Derrick Hammer 724a0f0135
*switch plugin loading to use require and not import
ci/woodpecker/manual/woodpecker Pipeline failed Details
2022-12-13 07:23:18 -05:00
Derrick Hammer d54fe4666f
*Types changed with chalk
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-12-07 02:16:37 -05:00
Derrick Hammer 4742c6844c
*Add log level prefix plugin with chalk formatting
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-12-07 01:57:21 -05:00
Derrick Hammer 80a3354866
*ensure loglevel is configurable 2022-12-07 00:46:16 -05:00
Derrick Hammer 7bd0a72113
*Move relay identity log to swarm
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-12-06 17:03:30 -05:00
Derrick Hammer c25e8b4aff
*generateSeedPhraseDeterministic returns an array, need only the 1st element
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-12-06 16:55:58 -05:00
Derrick Hammer ededa55b57
*Dont require a domain
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-12-06 16:22:28 -05:00
Derrick Hammer eedd6e7da5
*Remove pocket config check
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-12-06 07:22:03 -05:00
Derrick Hammer 8ea5a38b83
*Remove self from peers list 2022-12-05 15:38:58 -05:00
Derrick Hammer bbc9020f66
*Update get_direct_peers to filter against dhtCache online list 2022-12-05 15:22:18 -05:00
Derrick Hammer cd7b12e8b3
*add get_peers and get_direct_peers api methods to the core rpc plugin
ci/woodpecker/push/woodpecker Pipeline failed Details
2022-12-04 12:04:18 -05:00
Derrick Hammer e35b602133
*Add getter for dhtCache 2022-12-04 12:03:36 -05:00
Derrick Hammer 0e6c84c566
*Make default topic hash an exported const 2022-12-04 12:03:09 -05:00
Derrick Hammer 4121e23fd9
*If the rpc call returns no value, default to a true boolean 2022-12-04 07:14:36 -05:00
Derrick Hammer 7dff9a1ab4
*Only try to stringify the data if it is not already a string 2022-12-04 01:28:05 -05:00
Derrick Hammer 9393ffc4c1
*if cached merge in the cached item signature with the rpc response 2022-12-04 01:25:55 -05:00
Derrick Hammer c8c19b77a6
*Switch to json-stringify-deterministic 2022-12-04 01:11:05 -05:00
Derrick Hammer d7897af137
*Prevent recursive broadcast_request 2022-12-04 01:01:13 -05:00
Derrick Hammer 64611618de
*Update to use NodeCache api 2022-12-03 22:55:39 -05:00
Derrick Hammer 616b74a820
*Wrap cache delete in try/catch
ci/woodpecker/push/woodpecker Pipeline failed Details
2022-11-28 02:06:39 -05:00
Derrick Hammer 4bb0636a8d
*Unneeded import 2022-11-28 02:04:35 -05:00
Derrick Hammer 69fd9a14ef
*Switch to node cache 2022-11-28 02:03:50 -05:00
Derrick Hammer 0387316e4f
*Refactor broadcast handling to call RPCServer.handleRequest if it is a loopback request
ci/woodpecker/push/woodpecker Pipeline failed Details
*check for request module and request method
*Bug fix processing of responses
2022-11-28 01:37:54 -05:00
Derrick Hammer 9b15c738e9
*Allow handleRequest to be publicly called
*If getMethodByRequest returns an error, treat as a request error
2022-11-28 01:35:35 -05:00
Derrick Hammer cb2299f9e8
*Buffer conversion bugfix 2022-11-28 00:31:37 -05:00
Derrick Hammer 029aab6901
*Fix type handling 2022-11-28 00:24:36 -05:00
Derrick Hammer 1c37f7809c
*If we need to wait for the connection, join the peer 2022-11-28 00:16:25 -05:00
Derrick Hammer 2f9a0c7356
*Refactor getRpcByPeer to operate in Buffers 2022-11-28 00:14:11 -05:00
Derrick Hammer 91642ea729
*Update imports 2022-11-27 18:16:08 -05:00
Derrick Hammer 8895f557e5
*getNodeQuery is not needed, for now 2022-11-27 18:12:28 -05:00
Derrick Hammer 364e628c7a
*Simplify clear_cached_item so it just needs to use broadcast_request as a proxy 2022-11-27 18:10:21 -05:00
Derrick Hammer 86ce21a4b4
*If we have a cached request, release the lock
ci/woodpecker/push/woodpecker Pipeline failed Details
2022-11-26 18:23:26 -05:00
Derrick Hammer 9ce66b15a3
*Add query hash to dht cache 2022-11-26 17:53:39 -05:00
Derrick Hammer 83b62bfdcb
*Refactor mutex lock logic 2022-11-26 17:53:16 -05:00
Derrick Hammer 5c02356595
*start swarm in boot first, before even plugins since they kickstart the rpc singleton 2022-11-26 17:13:37 -05:00
Derrick Hammer ec33e40c74
*Export swarm start
*Make swarm get non async to prevent race conditions
2022-11-26 17:13:02 -05:00
Derrick Hammer ebd09f9a52
*Bug fix signData 2022-11-26 17:11:48 -05:00
Derrick Hammer 0d5aa24b74
*privateKey needs to be secretKey 2022-11-26 14:36:44 -05:00
Derrick Hammer 00fc999169
*Major refactor to swarm based DHT design, switch to protomux-rpc, merging core plugin into main daemon, and creating a new internal rpc plugin for cache and broadcast requests
ci/woodpecker/push/woodpecker Pipeline failed Details
2022-11-26 02:59:07 -05:00
Derrick Hammer b74bcd5dd2
*Add newRouter function that defines a root endpoint and returns the pubkey
*Call newRouter in resetRouter
*Call resetRouter in start
2022-09-22 10:18:50 -04:00
Derrick Hammer 36da04bdfe
*Extract keypair logic to a helper function 2022-09-22 10:17:37 -04:00
Derrick Hammer 668e427b8c
*Change ssl to default to false, plugins will need to enable it on init 2022-09-22 08:00:02 -04:00
Derrick Hammer f8c19e2fd6
*Load env and arg configs after config files again to have them override in priority. 2022-09-22 07:51:58 -04:00
Derrick Hammer 18a7ca4aa8
*Update plugin folder location to be beside the config folder 2022-09-21 17:40:17 -04:00
Derrick Hammer 49739eaac8
*If we don't have a seed, create one by saving to the config folder as account.json 2022-09-21 16:40:10 -04:00
Derrick Hammer 8d19edb8e0
*Remove seed as required option 2022-09-21 16:38:58 -04:00
Derrick Hammer e1092fb7d8
*Remove unneeded dash 2022-09-21 16:11:02 -04:00
Derrick Hammer 36a59ce5e6
*allow override of configDir 2022-09-21 16:10:45 -04:00
Derrick Hammer 6d0aef8ae2
*Ensure plugin list is unique 2022-09-21 16:03:12 -04:00
Derrick Hammer e0995be647
*Use new config fork and load directory for configs 2022-09-21 16:00:42 -04:00
Derrick Hammer 7c6bb6297e
*add logging for after save 2022-09-21 10:11:41 -04:00
Derrick Hammer fa8668b8c8
*Several bug fixes with saving and loading 2022-09-21 10:11:28 -04:00
Derrick Hammer 4b6e1d32f5
*Wrong variable used 2022-09-21 09:45:14 -04:00
Derrick Hammer 31a785b13e
*Need to create express before booting server 2022-09-21 09:08:30 -04:00
Derrick Hammer 8ab43c9e3a
*Remove unneeded pocket code 2022-09-21 09:00:34 -04:00
Derrick Hammer 243f350a54
*re-structure code 2022-09-21 08:59:22 -04:00
Derrick Hammer a1abf09c28
*Router functions are now in app 2022-09-21 08:56:24 -04:00
Derrick Hammer dc7bc3c5c4
*Consolidate all start functions to the main entry boot 2022-09-21 08:55:35 -04:00
Derrick Hammer 650666515b
*Move ssl start logic to its own start function 2022-09-21 08:55:05 -04:00
Derrick Hammer e2ccfa5220
*Move app server logic on port 80 to a dedicated component 2022-09-21 08:54:27 -04:00
Derrick Hammer f4211342e1
*Define new api to check ssl on boot and on demand 2022-09-21 07:31:29 -04:00
Derrick Hammer 8b68ce04d2
*option name needs to be retries 2022-09-21 07:14:10 -04:00
Derrick Hammer 4a4b46df5b
*Remove use of dynamic imports 2022-09-21 07:13:48 -04:00
Derrick Hammer 5362d83af6
*Rename pluginFolder to pluginDir 2022-09-20 12:45:24 -04:00
Derrick Hammer 5c8c4cc1dd
*add 15 ms delay (found via trial/error) on stream writes since there appears to be a event loop based backlog preventing some streams from being processed, causing client detected timeouts 2022-09-19 16:48:25 -04:00
Derrick Hammer f2f6f05923
*Pass domain to dnsProvider 2022-09-09 06:24:59 -04:00
Derrick Hammer a12f6c0c89
*Update error codes 2022-09-09 06:19:08 -04:00
Derrick Hammer fe021500c6
*Call loadUtilFunctions before loading plugins 2022-09-09 06:18:59 -04:00
Derrick Hammer 68422f0c1a
*Add a helper function loadUtilFunctions 2022-09-09 06:18:39 -04:00
Derrick Hammer 1143edfb81
*plugins need to load first 2022-09-09 06:18:14 -04:00
Derrick Hammer 522807d8af
*missed setting activeIp 2022-09-09 06:17:58 -04:00
Derrick Hammer 08fdc88874
*Move dns and ssl control to plugin apis
*Add files plugin api
*Add logger to api
*Add seed getter to api
*Add app router to api
2022-09-09 05:17:25 -04:00
Derrick Hammer 8e881a7dc1
*Add support for a stream being canceled or aborted 2022-08-31 21:32:14 -04:00
Derrick Hammer 231c4a36b4
*add safety check to ensure the rpc response complies with the structure 2022-08-31 00:14:05 -04:00
Derrick Hammer afc49802b0
*Set the updated property to the current timestamp in cacheRequest 2022-08-28 23:01:47 -04:00
Derrick Hammer bd6c791675
*ensure we only cache if the method has it enabled 2022-08-28 23:01:17 -04:00
Derrick Hammer e1e90957cf
*Use @lumeweb/relay-types 2022-08-28 22:40:25 -04:00
Derrick Hammer d1b180c8cd
*loadPlugin needs to be bound 2022-08-28 22:39:51 -04:00
Derrick Hammer a6c0d5aa7b
*Switch to @lumeweb/relay-types 2022-08-28 22:38:56 -04:00
Derrick Hammer c347692490
*Move code to types package 2022-08-28 22:35:07 -04:00
Derrick Hammer 744ab44af8
*Move code to plugin 2022-08-28 22:34:48 -04:00
Derrick Hammer 6283e8c1b1
*Fix for loop iteration 2022-08-28 02:49:48 -04:00
Derrick Hammer 61e10d8121
*getMethods needs to be bound to the server instance 2022-08-28 02:49:20 -04:00
Derrick Hammer 16e8eab836
*Remove use of anyOf and set Avj allowUnionTypes
*Compile schema to validateRpcRequest
*Use errorsText to generate errors for validation
2022-08-28 02:48:53 -04:00
Derrick Hammer 44af1cf765
*add default to the Plugin type as an optional property 2022-08-28 00:27:48 -04:00
Derrick Hammer 17da91a558
*Importing a plugin may be ESM and so check for the default property 2022-08-28 00:27:20 -04:00
Derrick Hammer 7cfad02ae5
*remove globby and just use fs/path 2022-08-28 00:26:24 -04:00
Derrick Hammer b9bb588a35
*pokt-rpc-endpoints needs to be imported dynamically 2022-08-27 22:25:05 -04:00
Derrick Hammer d0b65f4dc2
*globby needs to be imported dynamically 2022-08-27 22:24:43 -04:00
Derrick Hammer 4d00de2b40
*Make data type any 2022-08-27 14:52:02 -04:00
Derrick Hammer 0c577c43bd
*Add getMethods to RPCServer for plugin api 2022-08-26 22:38:32 -04:00
Derrick Hammer ad9d838d20
*Fix typo 2022-08-26 22:30:11 -04:00
Derrick Hammer d73bb04a3d
*RPCMethod handler type needs to return a promise 2022-08-26 22:21:21 -04:00
Derrick Hammer c2dfe1f162
*Rename PluginAPI to PluginApiManager
*Rename RelayPluginAPI to PluginAPI
2022-08-26 22:14:02 -04:00
Derrick Hammer ba20b1f36e
*Dont put api methods in an api namespace 2022-08-26 22:12:13 -04:00
Derrick Hammer 48a5928256
*Super refactor for the beginning of a new rpc server, changed protocol and simple plugin system
*Remove all rpc methods to prepare them for becoming plugins
2022-08-26 21:52:19 -04:00
Derrick Hammer a0cab03073
*Remove local pokt node support while waiting on pokt v1 2022-08-24 13:05:38 -04:00
Derrick Hammer 61a0991bcd
*Use @lumeweb/pokt-rpc-endpoints 2022-08-24 11:15:07 -04:00
Derrick Hammer f89a8e93a4
*reorder logic to boot up the relay server only after the SSL is ready 2022-08-24 11:10:50 -04:00
Derrick Hammer 573ebec0a4
*Don't retry on boot, but catch any retry failures 2022-08-22 12:39:09 -04:00
Derrick Hammer 7f135c80b1
*Use promise-retry to make a best effort attempt at downloading the ssl cert and key in-case we have portal rate limits or downtime 2022-08-22 12:22:54 -04:00
Derrick Hammer 1a9f08cbba
*Add error to RPCResponse, dont put inside data 2022-08-22 11:45:51 -04:00
Derrick Hammer b37b3052ec
*Update force to bypassCache 2022-08-18 19:29:06 -04:00
Derrick Hammer 8c16ad5469
*Change pokt sol-mainnet to solana-mainnet 2022-08-18 19:28:49 -04:00
Derrick Hammer 00492de90c
*Add status code server to be used for extension proxy 2022-08-14 06:37:00 -04:00
Derrick Hammer 62409ac6d3
*Refactor IPFS to use an external IPFS node 2022-08-14 06:33:23 -04:00
Derrick Hammer f6a58ad4b6
*heavy simplification to not use in memory stores and use default on-disk repo 2022-08-06 10:10:02 -04:00
Derrick Hammer 8510c96cad
*Remove unused functions 2022-08-05 20:06:08 -04:00
Derrick Hammer 927efddfed
*Add size property to normal files 2022-08-05 20:04:57 -04:00
Derrick Hammer a58f7fec4e
*Remove slice 2022-08-05 09:55:24 -04:00
Derrick Hammer 80c48b3a1c
*Return error if hash is a directory since we don't want to download it all 2022-08-05 09:54:39 -04:00
Derrick Hammer 33fa36411b
*Handle base36 ipns keys 2022-08-05 07:50:19 -04:00
Derrick Hammer ffd3eec605
*Trim extra forward slashes 2022-08-05 02:40:55 -04:00
Derrick Hammer f22c4dd847
*Use validateChain 2022-08-05 02:39:40 -04:00
Derrick Hammer d3e234c7b7
*Make files array an object with name and size 2022-08-05 02:16:21 -04:00
Derrick Hammer 05c4fc40d9
*Use context var, not hns string 2022-08-05 02:15:32 -04:00
Derrick Hammer 50051076d9
Exit on SIGINT or SIGTERM 2022-08-05 00:06:31 -04:00
Derrick Hammer 1fd1c932ca
*Set context to RpcContext and ass type asserts 2022-08-05 00:01:03 -04:00
Derrick Hammer c95917f789
*Add get_methods to the misc chain 2022-08-05 00:00:29 -04:00
Derrick Hammer ec649d2d93
*add validateChain higher order function for RPC validation 2022-08-04 23:56:11 -04:00
Derrick Hammer 383ec64692
*Update rpc method list 2022-08-04 23:45:09 -04:00
Derrick Hammer c90d207b7c
*Add first version of the ipfs rpc methods 2022-08-04 23:44:50 -04:00
Derrick Hammer 44e1366856
*Refactor RPCConnection::processRequest to handle and process streams 2022-08-04 23:43:02 -04:00
Derrick Hammer 26e12d19a4
*Add a streams api for use with rpc 2022-08-04 23:41:40 -04:00
Derrick Hammer e0b91b02c0
*add a misc group of rpc functions starting with ping 2022-08-04 23:40:30 -04:00
Derrick Hammer 3c5b04893f
*Use ERR_INVALID_CHAIN 2022-08-04 23:39:08 -04:00
Derrick Hammer 65b02ea1f3
*Add error constants 2022-08-04 23:38:44 -04:00
Derrick Hammer 8b17fbf3d2
*Add rpcError helper method and change all rpc error handling to the function and use error constants 2022-08-04 23:38:30 -04:00
Derrick Hammer a36735a356
*SslData type not needed 2022-08-04 23:35:23 -04:00
Derrick Hammer 01a32d8734
*refactor to use dynamic imports for ESM modules and do so via a helper that bypasses typescript parsing. 2022-08-04 23:34:18 -04:00
Derrick Hammer 5a17b6befd *Remove all requires
*Switch to commonjs target
2022-08-03 02:02:40 -04:00
Derrick Hammer 451f646fb2 *Delete current-round property from response if it exists as it causes problems with deterministic processing 2022-08-01 00:06:47 -04:00
Derrick Hammer d3a90c7714 *Better catch rpc node errors and ensure they are passed through properly to the client 2022-07-25 23:09:26 -04:00
Derrick Hammer 9a9a888bcb *use app over api for pocket API keys 2022-07-25 22:38:44 -04:00
Derrick Hammer 84c00acdcf *Fix log information 2022-07-25 20:48:06 -04:00
Derrick Hammer b5a9a3b00d *Access port as uint 2022-07-25 20:35:21 -04:00
Derrick Hammer b6089446b8 *Fix port config option name 2022-07-25 20:18:31 -04:00
Derrick Hammer 79139fa980 *Only load ssl in setup if it is the bootup process 2022-07-25 03:05:38 -04:00
Derrick Hammer fca5d8b0a6 *Add missing boot call
*Remove module export
2022-07-25 02:50:27 -04:00
Derrick Hammer 5cc06d62c5 *Use loglevel 2022-07-25 02:45:16 -04:00
Derrick Hammer 98050b90b0 *WIP: minor refactor and build process to create application binaries 2022-07-24 22:36:49 -04:00
Derrick Hammer 0713216cd3 *Restructure to transpile to commonjs since vercel pkg does not support ESM 2022-07-23 23:16:34 -04:00
Derrick Hammer 755b760f94 *Use log library 2022-07-23 20:29:46 -04:00