Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preferred settings support #1171

Merged
merged 35 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5ceb038
bump version
jhernandezb Jan 5, 2025
2d46988
update shasum
jhernandezb Jan 5, 2025
5fe4945
bump wasmvm
jhernandezb Jan 5, 2025
bdc4df4
test inintial file
jhernandezb Jan 5, 2025
e8e22b4
add test step
jhernandezb Jan 5, 2025
a16ac84
add to pipeline
jhernandezb Jan 5, 2025
b28eab9
add build step
jhernandezb Jan 5, 2025
76022eb
add build step
jhernandezb Jan 5, 2025
7795cab
split pipelinne
jhernandezb Jan 6, 2025
dbfd875
convert to yml to support imports
jhernandezb Jan 6, 2025
e88a257
merge main
jhernandezb Jan 29, 2025
14f427a
bump to go 1.23
jhernandezb Jan 29, 2025
4391ae7
bump go alpine
jhernandezb Jan 29, 2025
1cc2a9d
fix build script
jhernandezb Jan 29, 2025
8228ceb
add docker dind service
jhernandezb Jan 29, 2025
2bd47cb
build docker
jhernandezb Jan 29, 2025
38afd2a
update docker version
jhernandezb Jan 29, 2025
f73270a
debug docker
jhernandezb Jan 29, 2025
be37107
test
jhernandezb Jan 29, 2025
7570228
test direct path
jhernandezb Jan 29, 2025
bb6876a
sleep
jhernandezb Jan 29, 2025
eaf3055
test
jhernandezb Jan 29, 2025
08bfed4
Test
jhernandezb Jan 29, 2025
1871ae8
mount volumes
jhernandezb Jan 29, 2025
8531661
fix go version
jhernandezb Jan 29, 2025
b839b55
build docker and update go and alpine versions
jhernandezb Jan 29, 2025
3283cb9
enable preferred settings
jhernandezb Jan 29, 2025
312a636
Merge branch 'jhernandezb/ci-starlark' of github.com:public-awesome/s…
jhernandezb Jan 29, 2025
bbcc2e2
run on start only
jhernandezb Jan 29, 2025
4bd5313
Merge branch 'jhernandezb/ci-starlark' of github.com:public-awesome/s…
jhernandezb Jan 29, 2025
fc676cc
update golang version
jhernandezb Jan 29, 2025
963e762
fix libwasm hash
jhernandezb Jan 29, 2025
d2472c2
Merge branch 'jhernandezb/ci-starlark' of github.com:public-awesome/s…
jhernandezb Jan 29, 2025
98aa1b2
fix lint issues
jhernandezb Jan 29, 2025
e22505b
bump ibc-hooks
jhernandezb Jan 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .drone.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
load("scripts/drone/pipelines/test_and_build.star", "pipeline_test_and_build")

def main(ctx):
return [
pipeline_test_and_build(ctx)
]
55 changes: 55 additions & 0 deletions .drone.star.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
kind: pipeline
name: test_and_build
services:
- image: docker:dind
name: dind
privileged: true
volumes:
- name: dockersock
path: /var/run
steps:
- commands:
- git fetch --tags
image: alpine/git
name: fetch
- commands:
- sleep 10
- ls -l /var/run/docker.sock
- test -S /var/run/docker.sock && echo 'Docker socket found' || echo 'Docker socket
missing'
image: alpine
name: debug_dind
volumes:
- name: dockersock
path: /var/run
- commands:
- ./scripts/go-test.sh
environment:
GOPROXY: http://goproxy
image: publicawesome/golang:1.23.5-devtooling
name: test
- commands:
- apk add --no-cache ca-certificates build-base git
- wget https://github.com/CosmWasm/wasmvm/releases/download/v2.1.4/libwasmvm_muslc.x86_64.a
-O /lib/libwasmvm_muslc.x86_64.a
- echo 'a4a3d09b36fabb65b119d5ba23442c23694401fcbee4451fe6b7e22e325a4bac /lib/libwasmvm_muslc.x86_64.a'
| sha256sum -c
- LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build
- echo 'Ensuring binary is statically linked ...' && (file $PWD/bin/starsd | grep
'statically linked')
environment:
GOPROXY: http://goproxy
image: golang:1.23.5-alpine3.20
name: build
- commands:
- docker build -t publicawesome/stargaze:latest .
image: docker:24
name: build_docker
volumes:
- name: dockersock
path: /var/run
type: docker
volumes:
- name: dockersock
temp: {}
22 changes: 11 additions & 11 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ steps:
branch: no-cache

- name: test
image: publicawesome/golang:1.22.7-devtooling
image: publicawesome/golang:1.23.5-devtooling
volumes:
- name: cache
path: /go
Expand All @@ -42,7 +42,7 @@ steps:
environment:
GOPROXY: http://goproxy
- name: build
image: golang:1.22.7-alpine3.19
image: golang:1.23.5-alpine3.20
volumes:
- name: cache
path: /go
Expand Down Expand Up @@ -77,12 +77,12 @@ steps:
password:
from_secret: docker_password
tags:
- 15.0.0-alpha.5
- 15.0.0-alpha.6
when:
event:
- push
branch:
- jhernandezb/fix-cron
- jhernandezb/ci-starlark
- main
- name: docker_release
image: plugins/docker
Expand All @@ -99,7 +99,7 @@ steps:
- tag

- name: release
image: golang:1.22.7
image: golang:1.23.5
environment:
GITHUB_TOKEN:
from_secret: github_token
Expand Down Expand Up @@ -194,7 +194,7 @@ steps:
environment:
GOPROXY: http://goproxy
- name: stargaze
image: publicawesome/golang:1.22.7-devtooling
image: publicawesome/golang:1.23.5-devtooling
volumes:
- name: cache
path: /go
Expand Down Expand Up @@ -282,7 +282,7 @@ steps:
when:
branch: no-cache
- name: build-wrapper
image: publicawesome/golang:1.22.7-devtooling
image: publicawesome/golang:1.23.5-devtooling
volumes:
- name: cache
path: /go
Expand Down Expand Up @@ -353,7 +353,7 @@ steps:
- ./scripts/ci/upgrade/proposal.sh
- name: stargaze-upgraded
pull: always
image: publicawesome/stargaze:15.0.0-alpha.5
image: publicawesome/stargaze:15.0.0-alpha.6
commands:
- ./scripts/ci/upgrade/run-upgrade.sh
environment:
Expand All @@ -372,7 +372,7 @@ steps:
- http://icad:26657
- name: check-params
pull: always
image: publicawesome/stargaze:15.0.0-alpha.5
image: publicawesome/stargaze:15.0.0-alpha.6
commands:
- starsd q mint params --node http://stargaze-upgraded:26657
- starsd q alloc params --node http://stargaze-upgraded:26657
Expand Down Expand Up @@ -411,7 +411,7 @@ steps:
trigger:
branch:
- main
- jhernandezb/fix-cron
- jhernandezb/ci-starlark
event:
- pull_request
- push
Expand All @@ -424,6 +424,6 @@ volumes:

---
kind: signature
hmac: 7f6a696633927ee7fcac8511be795df0f17c229369d245c4c7cb4ca83c09ac96
hmac: b4fff1025b0382cb7da82819a4193894007fe959061dbfe709ab9e142b4933da

...
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# docker build . -t publicawesome/stargaze:latest
# docker run --rm -it publicawesome/stargaze:latest /bin/sh
FROM golang:1.22.7-alpine3.19 AS go-builder
FROM golang:1.23.5-alpine3.20 AS go-builder


RUN set -eux; apk add --no-cache ca-certificates build-base git;
Expand All @@ -26,7 +26,7 @@ RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build


# --------------------------------------------------------
FROM alpine:3.19
FROM alpine:3.20

COPY --from=go-builder /code/bin/starsd /usr/bin/starsd
RUN apk add -U --no-cache ca-certificates
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ endif

check_go_version:
@echo "Go version: $(GO_MAJOR_VERSION).$(GO_MINOR_VERSION)"
ifneq ($(GO_MINOR_VERSION),22)
@echo "ERROR: Go version 1.22 is required for this version of Stargaze"
ifneq ($(GO_MINOR_VERSION),23)
@echo "ERROR: Go version 1.23 is required for this version of Stargaze"
exit 1
endif

Expand Down Expand Up @@ -188,3 +188,7 @@ proto-format:

proto-lint:
@$(protoImage) buf lint --error-format=json


drone-generate:
drone starlark --format --target .drone.star.yml
3 changes: 3 additions & 0 deletions cmd/starsd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@
panic(err)
}

rootCmd.PersistentPreRunE = chainPreRuns(rootCmd.PersistentPreRunE, SetPreferredSettings, LogPreferredSettings)

Check warning on line 138 in cmd/starsd/cmd/root.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/root.go#L138

Added line #L138 was not covered by tests

return rootCmd
}

Expand Down Expand Up @@ -181,6 +183,7 @@
func addModuleInitFlags(startCmd *cobra.Command) {
crisis.AddModuleInitFlags(startCmd)
wasm.AddModuleInitFlags(startCmd)
startCmd.Flags().Bool(flagSkipPreferredSettings, false, "Skip preferred settings")

Check warning on line 186 in cmd/starsd/cmd/root.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/root.go#L186

Added line #L186 was not covered by tests
startCmd.PreRunE = chainPreRuns(CheckLibwasmVersion, startCmd.PreRunE)
}

Expand Down
92 changes: 92 additions & 0 deletions cmd/starsd/cmd/settings.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package cmd

import (
"time"

"github.com/cosmos/cosmos-sdk/server"
"github.com/spf13/cobra"
)

const flagSkipPreferredSettings = "skip-preferred-settings"

type PreferredSetting struct {
ViperKey string
Value string
Set func(serverCtx *server.Context, key, value string) error
}

var preferredSettings = []PreferredSetting{
{
ViperKey: "consensus.timeout_commit",
Value: "3s",
Set: func(serverCtx *server.Context, key, value string) error {
serverCtx.Viper.Set(key, value)
serverCtx.Config.Consensus.TimeoutCommit = 3 * time.Second
return nil
},

Check warning on line 26 in cmd/starsd/cmd/settings.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/settings.go#L22-L26

Added lines #L22 - L26 were not covered by tests
},
{
ViperKey: "consensus.timeout_propose",
Value: "2s",
Set: func(serverCtx *server.Context, key, value string) error {
serverCtx.Viper.Set(key, value)
serverCtx.Config.Consensus.TimeoutPropose = 2 * time.Second
return nil
},

Check warning on line 35 in cmd/starsd/cmd/settings.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/settings.go#L31-L35

Added lines #L31 - L35 were not covered by tests
},
{
ViperKey: "wasm.memory_cache_size",
Value: "1024",
Set: func(serverCtx *server.Context, key, value string) error {
serverCtx.Viper.Set(key, value)
return nil
},

Check warning on line 43 in cmd/starsd/cmd/settings.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/settings.go#L40-L43

Added lines #L40 - L43 were not covered by tests
},
}

func SetPreferredSettings(cmd *cobra.Command, _ []string) error {
if cmd.Name() != "start" {
return nil

Check warning on line 49 in cmd/starsd/cmd/settings.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/settings.go#L47-L49

Added lines #L47 - L49 were not covered by tests
}

skip, err := cmd.Flags().GetBool(flagSkipPreferredSettings)
if err != nil {
return err

Check warning on line 54 in cmd/starsd/cmd/settings.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/settings.go#L52-L54

Added lines #L52 - L54 were not covered by tests
}
if skip {
return nil

Check warning on line 57 in cmd/starsd/cmd/settings.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/settings.go#L56-L57

Added lines #L56 - L57 were not covered by tests
}

serverCtx := server.GetServerContextFromCmd(cmd)

Check warning on line 60 in cmd/starsd/cmd/settings.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/settings.go#L60

Added line #L60 was not covered by tests

for _, setting := range preferredSettings {
err := setting.Set(serverCtx, setting.ViperKey, setting.Value)
if err != nil {
return err

Check warning on line 65 in cmd/starsd/cmd/settings.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/settings.go#L62-L65

Added lines #L62 - L65 were not covered by tests
}
}

return server.SetCmdServerContext(cmd, serverCtx)

Check warning on line 69 in cmd/starsd/cmd/settings.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/settings.go#L69

Added line #L69 was not covered by tests
}

func LogPreferredSettings(cmd *cobra.Command, _ []string) error {
if cmd.Name() != "start" {
return nil

Check warning on line 74 in cmd/starsd/cmd/settings.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/settings.go#L72-L74

Added lines #L72 - L74 were not covered by tests
}
serverCtx := server.GetServerContextFromCmd(cmd)

Check warning on line 76 in cmd/starsd/cmd/settings.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/settings.go#L76

Added line #L76 was not covered by tests

skip, err := cmd.Flags().GetBool(flagSkipPreferredSettings)
if err != nil {
return err

Check warning on line 80 in cmd/starsd/cmd/settings.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/settings.go#L78-L80

Added lines #L78 - L80 were not covered by tests
}

if !skip {
serverCtx.Logger.Info("using preferred settings use --skip-preferred-settings to disable")

Check warning on line 84 in cmd/starsd/cmd/settings.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/settings.go#L83-L84

Added lines #L83 - L84 were not covered by tests
}

serverCtx.Logger.Info("using timeout_commit", "value", serverCtx.Config.Consensus.TimeoutCommit.String())
serverCtx.Logger.Info("using timeout_propose", "value", serverCtx.Config.Consensus.TimeoutPropose.String())
serverCtx.Logger.Info("using wasm.memory_cache_size", "value", serverCtx.Viper.Get("wasm.memory_cache_size"))

Check warning on line 89 in cmd/starsd/cmd/settings.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/settings.go#L87-L89

Added lines #L87 - L89 were not covered by tests

return nil

Check warning on line 91 in cmd/starsd/cmd/settings.go

View check run for this annotation

Codecov / codecov/patch

cmd/starsd/cmd/settings.go#L91

Added line #L91 was not covered by tests
}
4 changes: 2 additions & 2 deletions docker/Dockerfile.go-devtools
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# docker build . -t publicawesome/golang:1.22.7-devtooling -f docker/Dockerfile.go-devtools
FROM golang:1.22.7
# docker build . -t publicawesome/golang:1.23.5-devtooling -f docker/Dockerfile.go-devtools
FROM golang:1.23.5
RUN apt-get update && \
apt-get install -y cmake && \
apt-get -y clean && \
Expand Down
2 changes: 1 addition & 1 deletion e2e/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEV
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/Shopify/toxiproxy v2.2.1+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
github.com/StirlingMarketingGroup/go-namecase v1.0.0 h1:2CzaNtCzc4iNHirR+5ru9OzGg8rQp860gqLBFqRI02Y=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ replace (
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0

// TODO: update afer official release
github.com/cosmos/ibc-apps/modules/ibc-hooks/v8 => github.com/public-awesome/ibc-apps/modules/ibc-hooks/v8 v8.0.0-20241211032059-0cbb0ab1dd93
github.com/cosmos/ibc-apps/modules/ibc-hooks/v8 => github.com/public-awesome/ibc-apps/modules/ibc-hooks/v8 v8.0.0-20250129183033-079b03c57592
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1
// TODO: remove after https://github.com/spf13/viper/issues/1706 gets fixed
github.com/spf13/viper => github.com/spf13/viper v1.17.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -950,8 +950,8 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/public-awesome/ibc-apps/modules/ibc-hooks/v8 v8.0.0-20241211032059-0cbb0ab1dd93 h1:lP4IhTGA5ofKrtxbmOonyYlwpFnpoMlaNVBdm6rJIAs=
github.com/public-awesome/ibc-apps/modules/ibc-hooks/v8 v8.0.0-20241211032059-0cbb0ab1dd93/go.mod h1:goY+Rwme+gTLS1jMIfVZ8t7+g6sfU3KFSaT/anjTi3o=
github.com/public-awesome/ibc-apps/modules/ibc-hooks/v8 v8.0.0-20250129183033-079b03c57592 h1:9d3J5hp6Byh46DucY2v+Gokcwjx/oO5bigXmjyk3MFQ=
github.com/public-awesome/ibc-apps/modules/ibc-hooks/v8 v8.0.0-20250129183033-079b03c57592/go.mod h1:Ey2qRry7072+p/PWIk9ceL2HfJmW30XgI+7Zxd8r30M=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
Expand Down
Loading
Loading