Skip to content

Commit

Permalink
Merge branch 'CNS-694-validators-rewards-pool-implementation' into CN…
Browse files Browse the repository at this point in the history
…S-720-providers-rewards-pool-research-and-design
  • Loading branch information
Yarom Swisa authored and Yarom Swisa committed Dec 19, 2023
2 parents 96a4f28 + f0e86a9 commit 93b6f3e
Show file tree
Hide file tree
Showing 232 changed files with 6,369 additions and 1,693 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/consensus_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ jobs:
run: go test ./x/downtime/...

- name: lava rewards unit Tests
run: go test ./x/rewards/...
run: go test ./x/rewards/...
86 changes: 43 additions & 43 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,49 +192,49 @@ jobs:
if: always()
continue-on-error: true
run: grep "" testutil/e2e/sdkLogs/01_sdkTest* --include="*errors*"
test-payment-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: "0"
- uses: actions/setup-go@v3
with:
go-version: 1.20.5
# test-payment-e2e:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: "0"
# - uses: actions/setup-go@v3
# with:
# go-version: 1.20.5

######################################################
### Run Lava Protocol Payment E2E Tests
### Run Lava Protocol Payment E2E Tests - temporarily disabled
######################################################
- name: Run Lava Payment E2E Tests -timeout 1200s
run: go test ./testutil/e2e/ -run ^TestLavaProtocolPayment$ -v -timeout 1200s # 20mins

- name: tail -n 300 Lavad Logs
if: always()
run: tail -n 300 testutil/e2e/protocolLogs/00_StartLava.log

- name: Stake Lava All Logs
if: always()
run: cat testutil/e2e/protocolLogs/01_stakeLavaForPayment.log

- name: Stake Lava Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/protocolLogs/01_stakeLava_errors.log

- name: Lava Provider All Logs
if: always()
run: grep "" testutil/e2e/protocolLogs/05_LavaProvider* --exclude="*errors*"

- name: Lava Provider Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/protocolLogs/05_LavaProvider* --include="*errors*"

- name: RPCConsumer Consumer All Logs
if: always()
run: grep "" testutil/e2e/protocolLogs/06_RPCConsumer* --exclude="*errors*"

- name: RPCConsumer Consumer Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/protocolLogs/06_RPCConsumer* --include="*errors*"
# - name: Run Lava Payment E2E Tests -timeout 1200s
# run: go test ./testutil/e2e/ -run ^TestLavaProtocolPayment$ -v -timeout 1200s # 20mins

# - name: tail -n 300 Lavad Logs
# if: always()
# run: tail -n 300 testutil/e2e/protocolLogs/00_StartLava.log

# - name: Stake Lava All Logs
# if: always()
# run: cat testutil/e2e/protocolLogs/01_stakeLavaForPayment.log

# - name: Stake Lava Error Only Logs
# if: always()
# continue-on-error: true
# run: cat testutil/e2e/protocolLogs/01_stakeLava_errors.log

# - name: Lava Provider All Logs
# if: always()
# run: grep "" testutil/e2e/protocolLogs/05_LavaProvider* --exclude="*errors*"

# - name: Lava Provider Error Only Logs
# if: always()
# continue-on-error: true
# run: grep "" testutil/e2e/protocolLogs/05_LavaProvider* --include="*errors*"

# - name: RPCConsumer Consumer All Logs
# if: always()
# run: grep "" testutil/e2e/protocolLogs/06_RPCConsumer* --exclude="*errors*"

# - name: RPCConsumer Consumer Error Only Logs
# if: always()
# continue-on-error: true
# run: grep "" testutil/e2e/protocolLogs/06_RPCConsumer* --include="*errors*"
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,8 @@ ecosystem/lavajs/proto/gogoproto
ecosystem/lavajs/proto/google
ecosystem/lavajs/proto/tendermint

testutil/e2e/sdk/tests/package.json
testutil/e2e/sdk/tests/package-lock.json
testutil/e2e/sdk/tests/node_modules.json

config/health_examples/health_template_gen.yml
# Yarn
.yarn/
21 changes: 14 additions & 7 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ parent:
order: false
-->


<div align="center">
<h1> <img src="https://user-images.githubusercontent.com/2770565/223762290-44afc792-8ad4-4dbb-b2c2-532780d6c5de.png" alt="Logo" width="30" height="25"> Lava Network </h1>
</div>

![image](https://user-images.githubusercontent.com/2770565/203528359-dced4d06-f020-4b6a-bb5f-319124924689.png)

### What is Lava?

The Lava Protocol aims to provide decentralized and scalable access to blockchain data through the use of a network of providers and consumers. It utilizes a proof-of-stake consensus mechanism and incentivizes participants through the use of its native LAVA token. The protocol includes features such as a stake-weighted pseudorandom pairing function, backfilling, and a lazy settlement process to improve scalability and efficiency. The roadmap for the Lava Protocol includes further development of governance, conflict resolution, privacy, and quality of service, as well as support for additional API specifications. It is designed to be a public good that enables decentralized access to the Web3 ecosystem.

Read more about Lava in the [litepaper](https://litepaper.lavanet.xyz?utm_source=github.com&utm_medium=github&utm_campaign=readme) and visit the [Docs](https://docs.lavanet.xyz?utm_source=github.com&utm_medium=github&utm_campaign=readme)
Expand All @@ -22,31 +22,38 @@ Lava is built using the [Cosmos SDK](https://github.com/cosmos/cosmos-sdk/) whic
**Note**: Requires [Go 1.20.5](https://golang.org/dl/)

### Installing development dependencies

before running the scripts make sure you have go installed and added to $PATH, you can validate by running `which go`
init_install will install all necessary dependencies to develop on lava.

```bash
./scripts/init_install.sh
```

## Building the binaries
install-all will build all lava binaries (lavad, lavap, lavavisor) and place them in the go bin path on your environment.

LAVA_BINARY=all will build all lava binaries (lavad, lavap, lavavisor) and place them in the go bin path on your environment.

```bash
make install-all
LAVA_BINARY=all make install
```

### Building the binaries locally
You can also build the binaries locally (path will be ./build/...) by running

You can also build the binaries locally (path will be ./build/...) by running

```bash
make build-all
LAVA_BINARY=all make build
```

### Building only a specific binary
it is possible to also build only one binary, for example lavad only.

it is possible to build only one binary: lavad/lavap/lavavisor

```bash
LAVA_BINARY=lavad make install
```


Or check out the latest [release](https://github.com/lavanet/lava/releases).

### Add `lavad` autocomplete
Expand Down
5 changes: 4 additions & 1 deletion app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
dualstakingante "github.com/lavanet/lava/x/dualstaking/ante"
dualstakingkeeper "github.com/lavanet/lava/x/dualstaking/keeper"
)

func NewAnteHandler(accountKeeper ante.AccountKeeper, bankKeeper authtypes.BankKeeper, signModeHandler signing.SignModeHandler, feegrantKeeper ante.FeegrantKeeper, sigGasConsumer ante.SignatureVerificationGasConsumer) sdk.AnteHandler {
func NewAnteHandler(accountKeeper ante.AccountKeeper, bankKeeper authtypes.BankKeeper, dualstakingKeeper dualstakingkeeper.Keeper, signModeHandler signing.SignModeHandler, feegrantKeeper ante.FeegrantKeeper, sigGasConsumer ante.SignatureVerificationGasConsumer) sdk.AnteHandler {
anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
ante.NewExtensionOptionsDecorator(nil),
Expand All @@ -21,6 +23,7 @@ func NewAnteHandler(accountKeeper ante.AccountKeeper, bankKeeper authtypes.BankK
ante.NewSigGasConsumeDecorator(accountKeeper, sigGasConsumer),
ante.NewSigVerificationDecorator(accountKeeper, signModeHandler),
ante.NewIncrementSequenceDecorator(accountKeeper),
dualstakingante.NewRedelegationFlager(dualstakingKeeper),
}
return sdk.ChainAnteDecorators(anteDecorators...)
}
13 changes: 9 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ var Upgrades = []upgrades.Upgrade{
upgrades.Upgrade_0_30_0,
upgrades.Upgrade_0_30_1,
upgrades.Upgrade_0_30_2,
upgrades.Upgrade_remove_mint_add_rewards,
upgrades.Upgrade_0_31_0,
upgrades.Upgrade_0_31_1,
upgrades.Upgrade_0_32_0,
}

// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals
Expand Down Expand Up @@ -235,9 +237,6 @@ var (
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Burner},
subscriptionmoduletypes.ModuleName: {authtypes.Burner, authtypes.Staking},
dualstakingmoduletypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
dualstakingmoduletypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
pairingmoduletypes.ModuleName: {authtypes.Burner, authtypes.Staking},
string(rewardsmoduletypes.ValidatorsRewardsAllocationPoolName): {authtypes.Burner, authtypes.Staking},
string(rewardsmoduletypes.ValidatorsRewardsDistributionPoolName): {authtypes.Burner, authtypes.Staking},
string(rewardsmoduletypes.ProviderRewardsDistributionPool): {authtypes.Burner, authtypes.Staking},
Expand Down Expand Up @@ -414,6 +413,7 @@ func New(
keys[specmoduletypes.StoreKey],
keys[specmoduletypes.MemStoreKey],
app.GetSubspace(specmoduletypes.ModuleName),
app.StakingKeeper,
)
specModule := specmodule.NewAppModule(appCodec, app.SpecKeeper, app.AccountKeeper, app.BankKeeper)

Expand All @@ -426,6 +426,7 @@ func New(
app.BankKeeper,
app.AccountKeeper,
app.SpecKeeper,
app.StakingKeeper,
)
epochstorageModule := epochstoragemodule.NewAppModule(appCodec, app.EpochstorageKeeper, app.AccountKeeper, app.BankKeeper)

Expand All @@ -448,6 +449,7 @@ func New(
app.EpochstorageKeeper,
app.SpecKeeper,
app.FixationStoreKeeper,
app.StakingKeeper,
)
plansModule := plansmodule.NewAppModule(appCodec, app.PlansKeeper)

Expand Down Expand Up @@ -508,6 +510,7 @@ func New(
app.RewardsKeeper,
app.FixationStoreKeeper,
app.TimerStoreKeeper,
app.StakingKeeper,
)
subscriptionModule := subscriptionmodule.NewAppModule(appCodec, app.SubscriptionKeeper, app.AccountKeeper, app.BankKeeper)

Expand Down Expand Up @@ -589,6 +592,7 @@ func New(
app.PairingKeeper,
app.EpochstorageKeeper,
app.SpecKeeper,
app.StakingKeeper,
)
conflictModule := conflictmodule.NewAppModule(appCodec, app.ConflictKeeper, app.AccountKeeper, app.BankKeeper)

Expand Down Expand Up @@ -813,6 +817,7 @@ func New(
NewAnteHandler(
app.AccountKeeper,
app.BankKeeper,
app.DualstakingKeeper,
encodingConfig.TxConfig.SignModeHandler(),
app.FeeGrantKeeper,
ante.DefaultSigVerificationGasConsumer),
Expand Down
16 changes: 14 additions & 2 deletions app/upgrades/empty_upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,20 @@ var Upgrade_0_30_2 = Upgrade{
StoreUpgrades: store.StoreUpgrades{},
}

var Upgrade_remove_mint_add_rewards = Upgrade{
UpgradeName: "remove-mint-add-rewards",
var Upgrade_0_31_0 = Upgrade{
UpgradeName: "v0.31.0",
CreateUpgradeHandler: defaultUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{},
}

var Upgrade_0_31_1 = Upgrade{
UpgradeName: "v0.31.1",
CreateUpgradeHandler: defaultUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{},
}

var Upgrade_0_32_0 = Upgrade{
UpgradeName: "v0.32.0",
CreateUpgradeHandler: defaultUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{rewardstypes.StoreKey},
Expand Down
5 changes: 4 additions & 1 deletion cmd/lavad/cmd/genaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
`,
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
cdc := clientCtx.Codec

serverCtx := server.GetServerContextFromCmd(cmd)
Expand Down
5 changes: 5 additions & 0 deletions cmd/lavap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"github.com/lavanet/lava/cmd/lavad/cmd"
"github.com/lavanet/lava/ecosystem/cache"
"github.com/lavanet/lava/protocol/badgegenerator"
"github.com/lavanet/lava/protocol/monitoring"
"github.com/lavanet/lava/protocol/performance/connection"
"github.com/lavanet/lava/protocol/rpcconsumer"
"github.com/lavanet/lava/protocol/rpcprovider"
"github.com/lavanet/lava/protocol/statetracker"
Expand Down Expand Up @@ -52,6 +54,9 @@ func main() {
testCmd.AddCommand(rpcconsumer.CreateTestRPCConsumerCobraCommand())
testCmd.AddCommand(rpcprovider.CreateTestRPCProviderCobraCommand())
testCmd.AddCommand(statetracker.CreateEventsCobraCommand())
testCmd.AddCommand(connection.CreateTestConnectionServerCobraCommand())
testCmd.AddCommand(connection.CreateTestConnectionProbeCobraCommand())
testCmd.AddCommand(monitoring.CreateHealthCobraCommand())
rootCmd.AddCommand(cache.CreateCacheCobraCommand())
if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil {
switch e := err.(type) {
Expand Down
5 changes: 5 additions & 0 deletions common/types/token.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package types

const (
TokenDenom = "ulava"
)
31 changes: 31 additions & 0 deletions config/health_examples/health_example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
max-provider-latency: 150ms
subscription-days-left-alert: 10
interval: 5m
allowed_time_lag: 30s
query-retries: 5
alert-webhook-url: <alert-hook>
identifier: health_example
cu-percent-threshold: 0.2
alert-suppression-interval: 6h
disable-alert-suppression: false
suppression-alert-count-threshold: 3
metrics-listen-address: ":7776"
disable-alert-logging: false
subscription_addresses:
- lava@...
- lava@...
provider_addresses:
- lava@...
- lava@...
- lava@...
consumer_endpoints:
- chain-id: ETH1
api-interface: jsonrpc
network-address: 127.0.0.1:3333
reference_endpoints:
- chain-id: ETH1
api-interface: jsonrpc
network-address: public-rpc-1
- chain-id: ETH1
api-interface: jsonrpc
network-address: public-rpc-2
29 changes: 29 additions & 0 deletions config/health_examples/health_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
max-provider-latency: 150ms
subscription-days-left-alert: 10
interval: 5s
allowed_time_lag: 30s
query-retries: 5
identifier: health_example
cu-percent-threshold: 0.2
alert-suppression-interval: 60s
disable-alert-suppression: false
suppression-alert-count-threshold: 2
metrics-listen-address: ":7776"
disable-alert-logging: false
allow-insecure-provider-dialing: true
consumer_endpoints:
- chain-id: ETH1
api-interface: jsonrpc
network-address: http://127.0.0.1:3333
- chain-id: LAV1
api-interface: rest
network-address: http://127.0.0.1:3360
- chain-id: LAV1
api-interface: tendermintrpc
network-address: http://127.0.0.1:3361
- chain-id: LAV1
api-interface: grpc
network-address: 127.0.0.1:3362
#REPLACED
subscription_addresses:
provider_addresses:
12 changes: 12 additions & 0 deletions cookbook/param_changes/param_change_downtime.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"title": "Emergency Mode - Epoch Duration Update",
"description": "Change the Emergency Mode Epoch Duration",
"changes": [
{
"subspace": "downtime",
"key": "EpochDuration",
"value": "900000000000"
}
],
"deposit": "10000000ulava"
}
Loading

0 comments on commit 93b6f3e

Please sign in to comment.