Skip to content

Commit

Permalink
PRT-878-cache-state-tracker-requests (lavanet#760)
Browse files Browse the repository at this point in the history
* added cache into the lava repository

* lint

* lint

* only print missing hashes warning for non finalized info

* remove unused code

* ignore cache on not_applicable block requests

* added some debug logs

* refactored cache and added caching in state tracker block retreival

* fix unitests, added cache to chainFetcher constructor

* lint

* add support for optional metadata in cache

* added ignoredMetadata into the cache entries in the provider

* fix nil deref on empty cache response

* name change to screen

---------

Co-authored-by: Ran Mishael <[email protected]>
  • Loading branch information
omerlavanet and ranlavanet authored Sep 24, 2023
1 parent f9e2633 commit 161dcce
Show file tree
Hide file tree
Showing 24 changed files with 1,763 additions and 269 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/protocol_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@ jobs:
### Run protocol unitests
######################################################
- name: Run Lava Protocol Tests
run: go test ./protocol/...
run: go test ./protocol/...
- name: Run Cache Tests
run: go test ./ecosystem/cache/...
2 changes: 2 additions & 0 deletions cmd/lavap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/lavanet/lava/app"
"github.com/lavanet/lava/cmd/lavad/cmd"
"github.com/lavanet/lava/ecosystem/cache"
"github.com/lavanet/lava/protocol/badgegenerator"
"github.com/lavanet/lava/protocol/rpcconsumer"
"github.com/lavanet/lava/protocol/rpcprovider"
Expand Down Expand Up @@ -51,6 +52,7 @@ func main() {
testCmd.AddCommand(rpcconsumer.CreateTestRPCConsumerCobraCommand())
testCmd.AddCommand(rpcprovider.CreateTestRPCProviderCobraCommand())
testCmd.AddCommand(statetracker.CreateEventsCobraCommand())
rootCmd.AddCommand(cache.CreateCacheCobraCommand())
if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil {
switch e := err.(type) {
case server.ErrorCode:
Expand Down
28 changes: 14 additions & 14 deletions cookbook/specs/spec_add_cosmossdk.json
Original file line number Diff line number Diff line change
Expand Up @@ -4063,9 +4063,9 @@
"name": "health",
"block_parsing": {
"parser_arg": [
""
"latest"
],
"parser_func": "EMPTY"
"parser_func": "DEFAULT"
},
"compute_units": 10,
"enabled": true,
Expand All @@ -4081,9 +4081,9 @@
"name": "net_info",
"block_parsing": {
"parser_arg": [
""
"latest"
],
"parser_func": "EMPTY"
"parser_func": "DEFAULT"
},
"compute_units": 10,
"enabled": true,
Expand All @@ -4099,9 +4099,9 @@
"name": "num_unconfirmed_txs",
"block_parsing": {
"parser_arg": [
""
"latest"
],
"parser_func": "EMPTY"
"parser_func": "DEFAULT"
},
"compute_units": 10,
"enabled": true,
Expand All @@ -4117,9 +4117,9 @@
"name": "status",
"block_parsing": {
"parser_arg": [
""
"latest"
],
"parser_func": "EMPTY"
"parser_func": "DEFAULT"
},
"compute_units": 10,
"enabled": true,
Expand Down Expand Up @@ -4153,9 +4153,9 @@
"name": "tx",
"block_parsing": {
"parser_arg": [
""
"latest"
],
"parser_func": "EMPTY"
"parser_func": "DEFAULT"
},
"compute_units": 10,
"enabled": true,
Expand All @@ -4171,9 +4171,9 @@
"name": "tx_search",
"block_parsing": {
"parser_arg": [
""
"latest"
],
"parser_func": "EMPTY"
"parser_func": "DEFAULT"
},
"compute_units": 10,
"enabled": true,
Expand All @@ -4189,9 +4189,9 @@
"name": "unconfirmed_txs",
"block_parsing": {
"parser_arg": [
""
"latest"
],
"parser_func": "EMPTY"
"parser_func": "DEFAULT"
},
"compute_units": 10,
"enabled": true,
Expand Down
Loading

0 comments on commit 161dcce

Please sign in to comment.