Skip to content

Commit

Permalink
Merge branch 'main' into DO-2153-pr-artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit Zafran committed Mar 25, 2024
2 parents 3f11618 + 1b99cd2 commit fba63fa
Show file tree
Hide file tree
Showing 50 changed files with 2,476 additions and 646 deletions.
77 changes: 77 additions & 0 deletions .github/pr_labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
"C:cmd/lavad":
- changed-files:
- any-glob-to-any-file: "cmd/lavad/**/*"
"C:cmd/lavap":
- changed-files:
- any-glob-to-any-file: "cmd/lavap/**/*"
"C:cmd/lavavisor":
- changed-files:
- any-glob-to-any-file: "cmd/lavavisor/**/*"
"C:cmd/common":
- changed-files:
- any-glob-to-any-file: "cmd/common/**/*"
"C:protocol":
- changed-files:
- any-glob-to-any-file: "protocol/**/*"
"Team:Consensus":
- changed-files:
- any-glob-to-any-file: "x/**/*"
- any-glob-to-any-file: "app/**/*"
"Team:Protocol":
- changed-files:
- any-glob-to-any-file: "protocol/**/*"
- any-glob-to-any-file: "ecosystem/**/*"
"C:x/conflict":
- changed-files:
- any-glob-to-any-file: "x/conflict/**/*"
"C:x/downtime":
- changed-files:
- any-glob-to-any-file: "x/downtime/**/*"
"C:x/dualstaking":
- changed-files:
- any-glob-to-any-file: "x/dualstaking/**/*"
"C:x/epochstorage":
- changed-files:
- any-glob-to-any-file: "x/epochstorage/**/*"
"C:x/fixationstore":
- changed-files:
- any-glob-to-any-file: "x/fixationstore/**/*"
"C:x/pairing":
- changed-files:
- any-glob-to-any-file: "x/pairing/**/*"
"C:x/plans":
- changed-files:
- any-glob-to-any-file: "x/plans/**/*"
"C:x/projects":
- changed-files:
- any-glob-to-any-file: "x/projects/**/*"
"C:x/protocol":
- changed-files:
- any-glob-to-any-file: "x/protocol/**/*"
"C:x/rewards":
- changed-files:
- any-glob-to-any-file: "x/rewards/**/*"
"C:x/spec":
- changed-files:
- any-glob-to-any-file: "x/spec/**/*"
"C:x/subscription":
- changed-files:
- any-glob-to-any-file: "x/subscription/**/*"
"C:x/timerstore":
- changed-files:
- any-glob-to-any-file: "x/timerstore/**/*"
"Type: Build":
- changed-files:
- any-glob-to-any-file: "Makefile"
- any-glob-to-any-file: "Dockerfile"
- any-glob-to-any-file: "docker-compose.yml"
- any-glob-to-any-file: "scripts/*"
"Type: CI":
- changed-files:
- any-glob-to-any-file: ".github/**"
"Type: Docs":
- changed-files:
- any-glob-to-any-file: "docs/**/*"
"Type: Proto":
- changed-files:
- any-glob-to-any-file: "proto/**/*"
47 changes: 47 additions & 0 deletions .github/workflows/lint_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "Lint PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
contents: read

jobs:
main:
permissions:
pull-requests: write # for amannn/action-semantic-pull-request to analyze PRs
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
runs-on: ubuntu-latest
steps:
- uses: amannn/[email protected]
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
Hey there and thank you for opening this pull request! 👋🏼
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
Details:
```
${{ steps.lint_pr_title.outputs.error_message }}
```
# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true
19 changes: 19 additions & 0 deletions .github/workflows/pr_labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Pull Request Labeler"

on:
- pull_request_target

permissions:
contents: read

jobs:
labeler:
permissions:
contents: read # for actions/labeler to determine modified files
pull-requests: write # for actions/labeler to add labels to PRs
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
with:
configuration-path: .github/pr_labeler.yml
repo-token: "${{ secrets.GITHUB_TOKEN }}"
6 changes: 4 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ linters:
- stylecheck
- typecheck
- unconvert
#- unused we have a lot of unused code that we dont want to delete
#- unused we have a lot of unused code that we don't want to delete
- forcetypeassert
- gofmt
- goimports
Expand All @@ -56,6 +56,9 @@ issues:
- text: "ST1016:"
linters:
- stylecheck
- text: "SA1019:.*\"github.com/golang/protobuf/proto\" is deprecated.*" # proto is deprecated, but some places couldn't be removed
linters:
- staticcheck
- path: "migrations"
text: "SA1019:"
linters:
Expand All @@ -72,6 +75,5 @@ linters-settings:
suggest-new: true
nolintlint:
allow-unused: false
allow-leading-space: true
require-explanation: false
require-specific: false
15 changes: 2 additions & 13 deletions cmd/lavad/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"io"
"os"
"path/filepath"
"strings"

tmtypes "github.com/cometbft/cometbft/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
Expand Down Expand Up @@ -91,11 +90,6 @@ func NewRootCmd() (*cobra.Command, appparams.EncodingConfig) {
}

initRootCmd(rootCmd, encodingConfig)
overwriteFlagDefaults(rootCmd, map[string]string{
flags.FlagChainID: strings.ReplaceAll(app.Name, "-", ""),
flags.FlagKeyringBackend: "test",
})

addLogFlagsToSubCommands(rootCmd)
return rootCmd, encodingConfig
}
Expand Down Expand Up @@ -144,11 +138,6 @@ func NewLavaProtocolRootCmd() *cobra.Command {
}

initLavaProtocolRootCmd(rootCmd)
overwriteFlagDefaults(rootCmd, map[string]string{
flags.FlagChainID: strings.ReplaceAll(app.Name, "-", ""),
flags.FlagKeyringBackend: "test",
})

addLogFlagsToSubCommands(rootCmd)

return rootCmd
Expand Down Expand Up @@ -325,7 +314,7 @@ func addModuleInitFlags(startCmd *cobra.Command) {
// this line is used by starport scaffolding # root/arguments
}

func overwriteFlagDefaults(c *cobra.Command, defaults map[string]string) {
func OverwriteFlagDefaults(c *cobra.Command, defaults map[string]string) {
set := func(s *pflag.FlagSet, key, val string) {
if f := s.Lookup(key); f != nil {
f.DefValue = val
Expand All @@ -337,7 +326,7 @@ func overwriteFlagDefaults(c *cobra.Command, defaults map[string]string) {
set(c.PersistentFlags(), key, val)
}
for _, c := range c.Commands() {
overwriteFlagDefaults(c, defaults)
OverwriteFlagDefaults(c, defaults)
}
}

Expand Down
9 changes: 9 additions & 0 deletions cmd/lavad/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package main
import (
_ "net/http/pprof"
"os"
"strings"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/lavanet/lava/app"
Expand Down Expand Up @@ -47,6 +49,13 @@ func main() {
testCmd.AddCommand(rpcconsumer.CreateTestRPCConsumerCobraCommand())
testCmd.AddCommand(rpcprovider.CreateTestRPCProviderCobraCommand())
testCmd.AddCommand(statetracker.CreateEventsCobraCommand())

cmd.OverwriteFlagDefaults(rootCmd, map[string]string{
flags.FlagChainID: strings.ReplaceAll(app.Name, "-", ""),
flags.FlagKeyringBackend: "test",
flags.FlagGasAdjustment: statetracker.DefaultGasAdjustment,
})

if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil {
switch e := err.(type) {
case server.ErrorCode:
Expand Down
9 changes: 9 additions & 0 deletions cmd/lavap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"fmt"
_ "net/http/pprof"
"os"
"strings"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/lavanet/lava/app"
Expand Down Expand Up @@ -63,6 +65,13 @@ func main() {
testCmd.AddCommand(connection.CreateTestConnectionProbeCobraCommand())
testCmd.AddCommand(monitoring.CreateHealthCobraCommand())
rootCmd.AddCommand(cache.CreateCacheCobraCommand())

cmd.OverwriteFlagDefaults(rootCmd, map[string]string{
flags.FlagChainID: strings.ReplaceAll(app.Name, "-", ""),
flags.FlagKeyringBackend: "test",
flags.FlagGasAdjustment: statetracker.DefaultGasAdjustment,
})

if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil {
switch e := err.(type) {
case server.ErrorCode:
Expand Down
19 changes: 19 additions & 0 deletions cookbook/param_changes/slashing_proposal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"messages": [
{
"@type": "/cosmos.slashing.v1beta1.MsgUpdateParams",
"authority": "lava@10d07y265gmmuvt4z0w9aw880jnsr700jz6yq37",
"params": {
"signed_blocks_window": "3500",
"min_signed_per_window": "0.500000000000000000",
"downtime_jail_duration": "600s",
"slash_fraction_double_sign": "0.050000000000000000",
"slash_fraction_downtime": "0.005000000000000000"
}
}
],
"title": "change slashing params to boost security",
"summary": "boost security by adding slashing, allow validators more time to recover by increasing the window",
"deposit": "1ulava",
"expedited": false
}
Loading

0 comments on commit fba63fa

Please sign in to comment.