Skip to content

Commit

Permalink
R4R: LSM (v1.4) (#796)
Browse files Browse the repository at this point in the history
* bump cosmos-sdk and ibc-go

* wip: lsm v1.4

* fix tests, and fix lsm validator lookup post v1.4

* lint fixes

* using the err response here results in a weird pointer issue. no idea why. supressing as the test will fail hard later anyway!

* test fixes

* minor fixes and refactor

* gofumpt icq-relayer

* lint

* fix code coverage?
  • Loading branch information
Joe Bowman authored Nov 30, 2023
1 parent aa4f358 commit a8a541d
Show file tree
Hide file tree
Showing 60 changed files with 14,381 additions and 1,293 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/buildtest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.20.5"
go-version: "1.20.11"
env:
GOOS: ${{ matrix.targetos }}
GOARCH: ${{ matrix.arch }}
Expand Down Expand Up @@ -65,11 +65,10 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.20.5"
go-version: "1.20.11"
env:
GOOS: ${{ matrix.targetos }}
GOARCH: ${{ matrix.arch }}

- name: Setup Golang caches
uses: actions/cache@v3
with:
Expand All @@ -90,9 +89,9 @@ jobs:
excludelist+=" $(find ./ -type f -name '*.pb.go')"
excludelist+=" $(find ./ -type f -name '*.pb.gw.go')"
excludelist+=" $(find ./ -type f -path './test/*.go')"
excludelist+=" $(find ./ -type f -path './osmosis-types/*.go')"
excludelist+=" $(find ./ -type f -path './third-party-chains/*.go')"
for filename in ${excludelist}; do
filename=$(echo $filename | sed 's/^./github.com\/ingenuity-build\/quicksilver/g')
filename=$(echo $filename | sed 's/^./github.com\/quicksilver-zone\/quicksilver/g')
echo "Excluding ${filename} from coverage report..."
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
done
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.20.5"
go-version: "1.20.11"

- name: Setup Golang caches
uses: actions/cache@v3
Expand Down
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
FROM golang:1.20-alpine3.18 AS builder
<<<<<<< HEAD
FROM 1.20.11-alpine3.18 AS builder
=======
FROM golang:1.20.11-alpine3.18 AS builder
>>>>>>> ff736a96 (v1.2.17 (#756))
RUN apk add --no-cache git musl-dev openssl-dev linux-headers ca-certificates build-base

WORKDIR /src/app/
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ BUILD_TARGETS := build install

check_version:
ifneq ($(GO_MINOR_VERSION),20)
@echo "ERROR: Go version 1.20 is required for building Quicksilver. There are consensus breaking changes between binaries compiled with and without Go 1.20."
@echo "ERROR: Go version 1.20 is required for building Quicksilver. There are consensus breaking changes between binaries compiled with different Go versions."
exit 1
endif

Expand Down
62 changes: 43 additions & 19 deletions docs/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1692,12 +1692,8 @@ paths:
if (any.is(Foo.class)) {
foo = any.unpack(Foo.class);
}
// or ...
if (any.isSameTypeAs(Foo.getDefaultInstance())) {
foo = any.unpack(Foo.getDefaultInstance());
}
Example 3: Pack and unpack a message in Python.
Example 3: Pack and unpack a message in Python.
foo = Foo(...)
any = Any()
Expand All @@ -1707,7 +1703,7 @@ paths:
any.Unpack(foo)
...
Example 4: Pack and unpack a message in Go
Example 4: Pack and unpack a message in Go
foo := &pb.Foo{...}
any, err := anypb.New(foo)
Expand Down Expand Up @@ -1735,8 +1731,10 @@ paths:
name "y.z".
JSON
====
The JSON representation of an `Any` value uses the regular
Expand Down Expand Up @@ -2005,12 +2003,8 @@ paths:
if (any.is(Foo.class)) {
foo = any.unpack(Foo.class);
}
// or ...
if (any.isSameTypeAs(Foo.getDefaultInstance())) {
foo = any.unpack(Foo.getDefaultInstance());
}
Example 3: Pack and unpack a message in Python.
Example 3: Pack and unpack a message in Python.
foo = Foo(...)
any = Any()
Expand All @@ -2020,7 +2014,7 @@ paths:
any.Unpack(foo)
...
Example 4: Pack and unpack a message in Go
Example 4: Pack and unpack a message in Go
foo := &pb.Foo{...}
any, err := anypb.New(foo)
Expand Down Expand Up @@ -2048,8 +2042,10 @@ paths:
name "y.z".
JSON
====
The JSON representation of an `Any` value uses the regular
Expand Down Expand Up @@ -2333,15 +2329,12 @@ paths:
- Msg
/quicksilver/tx/v1/interchainstaking/reopen_channel:
post:
operationId: GovReopenChannel
operationId: GovSetLsmCaps
responses:
'200':
description: A successful response.
schema:
type: object
description: >-
MsgGovReopenChannelResponse defines the MsgGovReopenChannel
response type.
default:
description: An unexpected error response.
schema:
Expand Down Expand Up @@ -2375,10 +2368,17 @@ paths:
type: string
description:
type: string
connection_id:
type: string
port_id:
chain_id:
type: string
caps:
type: object
properties:
validator_cap:
type: string
validator_bond_cap:
type: string
global_cap:
type: string
authority:
type: string
tags:
Expand Down Expand Up @@ -2950,6 +2950,14 @@ paths:
jailed_since:
type: string
format: date-time
validator_bond_shares:
type: string
title: Number of shares self bonded from the validator
liquid_shares:
type: string
title: >-
Number of shares either tokenized or owned by a
liquid staking provider
aggregate_intent:
type: array
items:
Expand Down Expand Up @@ -3240,6 +3248,14 @@ paths:
jailed_since:
type: string
format: date-time
validator_bond_shares:
type: string
title: Number of shares self bonded from the validator
liquid_shares:
type: string
title: >-
Number of shares either tokenized or owned by a
liquid staking provider
aggregate_intent:
type: array
items:
Expand Down Expand Up @@ -4237,6 +4253,14 @@ paths:
jailed_since:
type: string
format: date-time
validator_bond_shares:
type: string
title: Number of shares self bonded from the validator
liquid_shares:
type: string
title: >-
Number of shares either tokenized or owned by a liquid
staking provider
pagination:
type: object
properties:
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ require (
github.com/cometbft/cometbft-db v0.8.0
github.com/confio/ics23/go v0.9.0
github.com/cosmos/cosmos-proto v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.46.15
github.com/cosmos/cosmos-sdk v0.46.16
github.com/cosmos/gogoproto v1.4.3
github.com/cosmos/ibc-go/v5 v5.3.1
github.com/cosmos/ibc-go/v5 v5.3.2
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.3
github.com/golangci/golangci-lint v1.54.1
Expand Down Expand Up @@ -100,7 +100,7 @@ require (
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/iavl v0.19.6 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.4 // indirect
github.com/creachadair/taskgroup v0.6.0 // indirect
github.com/curioswitch/go-reassign v0.2.0 // indirect
github.com/daixiang0/gci v0.11.0 // indirect
Expand Down Expand Up @@ -287,8 +287,8 @@ require (
github.com/yagipy/maintidx v1.0.0 // indirect
github.com/yeya24/promlinter v0.2.0 // indirect
github.com/ykadowak/zerologlint v0.1.3 // indirect
github.com/zondax/hid v0.9.1 // indirect
github.com/zondax/ledger-go v0.14.2 // indirect
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect
gitlab.com/bosi/decorder v0.4.0 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
go.tmz.dev/musttag v0.7.1 // indirect
Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -375,22 +375,22 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis=
github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o=
github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I=
github.com/cosmos/cosmos-sdk v0.46.15 h1:50QSEO4ZU9QUHJ8Ul9N/o/hn/IE5dL7DwL/OY1wcoMg=
github.com/cosmos/cosmos-sdk v0.46.15/go.mod h1:9MRixWsgoJ2UmVsCRRePtENFPP3cM+gTC5azEpxgllo=
github.com/cosmos/cosmos-sdk v0.46.16 h1:RVGv1+RulLZeNyfCaPZrZtv0kY7ZZNAI6JGpub0Uh6o=
github.com/cosmos/cosmos-sdk v0.46.16/go.mod h1:05U50tAsOzQ8JOAePshJCbJQw5ib1YJR6IXcqyVI1Xg=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
github.com/cosmos/gogoproto v1.4.3 h1:RP3yyVREh9snv/lsOvmsAPQt8f44LgL281X0IOIhhcI=
github.com/cosmos/gogoproto v1.4.3/go.mod h1:0hLIG5TR7IvV1fme1HCFKjfzW9X2x0Mo+RooWXCnOWU=
github.com/cosmos/iavl v0.19.6 h1:XY78yEeNPrEYyNCKlqr9chrwoeSDJ0bV2VjocTk//OU=
github.com/cosmos/iavl v0.19.6/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw=
github.com/cosmos/ibc-go/v5 v5.3.1 h1:zuaIWMEoXM9egWmmAqzBPYLvEjYgB6xy6wZoc8xsZ5U=
github.com/cosmos/ibc-go/v5 v5.3.1/go.mod h1:Q2W1rjtwR738fqFQhE66dZ0frsLlr+Wiezlwei0TMGo=
github.com/cosmos/ibc-go/v5 v5.3.2 h1:PPSs5hNAjYd8jVfHvXsqfnCYd/r9C7wpu+O2A4TOO5g=
github.com/cosmos/ibc-go/v5 v5.3.2/go.mod h1:Q2W1rjtwR738fqFQhE66dZ0frsLlr+Wiezlwei0TMGo=
github.com/cosmos/interchain-accounts v0.3.2 h1:7S5rSndahpjkzUvG00kKZrTZsEuVHuVC9a7p0qDVcF8=
github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo=
github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA=
github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA=
github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI=
github.com/cosmos/ledger-cosmos-go v0.12.4 h1:drvWt+GJP7Aiw550yeb3ON/zsrgW0jgh5saFCr7pDnw=
github.com/cosmos/ledger-cosmos-go v0.12.4/go.mod h1:fjfVWRf++Xkygt9wzCsjEBdjcf7wiiY35fv3ctT+k4M=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
Expand Down Expand Up @@ -1256,10 +1256,10 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo=
github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM=
github.com/zondax/ledger-go v0.14.2 h1:NDaba434N7JUVKg4P4nFv6TOjSkUosYb9sdiw3c61Zk=
github.com/zondax/ledger-go v0.14.2/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320=
github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U=
github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM=
github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw=
github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI=
gitlab.com/bosi/decorder v0.4.0 h1:HWuxAhSxIvsITcXeP+iIRg9d1cVfvVkmlF7M68GaoDY=
gitlab.com/bosi/decorder v0.4.0/go.mod h1:xarnteyUoJiOTEldDysquWKTVDCKo2TOIOIibSuWqOg=
go-simpler.org/assert v0.5.0 h1:+5L/lajuQtzmbtEfh69sr5cRf2/xZzyJhFjoOz/PPqs=
Expand Down
2 changes: 1 addition & 1 deletion icq-relayer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20-alpine3.18 as build
FROM 1.20.11-alpine3.18 as build

WORKDIR /src/app

Expand Down
6 changes: 2 additions & 4 deletions icq-relayer/cmd/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ const (
defaultCoinType uint32 = sdk.CoinType
)

var (
// FlagAccountPrefix allows the user to override the prefix for a given account
FlagAccountPrefix = ""
)
// FlagAccountPrefix allows the user to override the prefix for a given account
var FlagAccountPrefix = ""

// keysCmd represents the keys command
func keysCmd() *cobra.Command {
Expand Down
7 changes: 1 addition & 6 deletions icq-relayer/pkg/runner/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ type Query struct {
}

func handleHistoricRequests(queries []qstypes.Query, sourceChainId string, logger log.Logger, metrics prommetrics.Metrics) {

metrics.HistoricQueries.WithLabelValues("historic-queries").Set(float64(len(queries)))

if len(queries) == 0 {
Expand Down Expand Up @@ -365,7 +364,6 @@ func handleEvent(event coretypes.ResultEvent, logger log.Logger, metrics prommet
}

func RunGRPCQuery(ctx context.Context, client *lensclient.ChainClient, method string, reqBz []byte, md metadata.MD, metrics prommetrics.Metrics) (abcitypes.ResponseQuery, metadata.MD, error) {

// parse height header
height, err := lensclient.GetHeightFromMetadata(md)
if err != nil {
Expand Down Expand Up @@ -422,6 +420,7 @@ func retryLightblock(ctx context.Context, client *lensclient.ChainClient, height
}
return lightBlock.(*tmtypes.LightBlock), err
}

func doRequestWithMetrics(query Query, logger log.Logger, metrics prommetrics.Metrics) {
startTime := time.Now()
metrics.Requests.WithLabelValues("requests", query.Type).Inc()
Expand Down Expand Up @@ -546,7 +545,6 @@ func doRequest(query Query, logger log.Logger, metrics prommetrics.Metrics) {
// does not contain the Tx object (that we don't use, because the TxProof already contains a byte representation of tx anyway!)
// Note: this function is compatible with 0.34 and 0.37 representations of transactions.
func Tx(client *lensclient.ChainClient, hash []byte) (tmtypes.TxProof, int64, error) {

params := map[string]interface{}{
"hash": hash,
"prove": true,
Expand Down Expand Up @@ -611,7 +609,6 @@ func Tx(client *lensclient.ChainClient, hash []byte) (tmtypes.TxProof, int64, er
}

return result.Proof, int64(height), nil

}

// a minimised representation of the Tx emitted by a Tx query, only containing Height and Proof and thus compatbiel with tm0.34 and tm0.37.
Expand Down Expand Up @@ -670,7 +667,6 @@ func getHeader(ctx context.Context, client, submitClient *lensclient.ChainClient
clientHeight, ok := trustedHeight.(clienttypes.Height)
if !ok {
return nil, fmt.Errorf("error: Could coerce trusted height")

}

if !historicOk && clientHeight.RevisionHeight >= uint64(requestHeight+1) {
Expand Down Expand Up @@ -808,7 +804,6 @@ func unique(msgSlice []sdk.Msg, logger log.Logger) []sdk.Msg {
}

func Close() error {

query := tmquery.MustParse(fmt.Sprintf("message.module='%s'", "interchainquery"))

for _, chainClient := range globalCfg.Cl {
Expand Down
2 changes: 1 addition & 1 deletion proto/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM bufbuild/buf:latest as BUILDER
FROM golang:1.20-alpine
FROM 1.20.11-alpine

RUN apk add --no-cache \
nodejs \
Expand Down
Loading

0 comments on commit a8a541d

Please sign in to comment.