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

fix multisig account pubkeys migration #8788

Closed
wants to merge 70 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
a334a59
Stargate Release PR -- v0.40.0 Final (#8284)
clevinson Jan 8, 2021
b6b79e3
Backport/reproducible builds (#8381)
robert-zaremba Jan 19, 2021
c657222
fix GET /upgrade/current query (#8280) (#8372)
amaury1093 Jan 19, 2021
0e9a6b2
build(deps): bump github.com/armon/go-metrics from 0.3.5 to 0.3.6 (#8…
amaury1093 Jan 19, 2021
c18ba39
fix zero time checks (#8282) (#8374)
amaury1093 Jan 19, 2021
062b21b
build(deps): bump github.com/gogo/protobuf from 1.3.1 to 1.3.2 (#8291…
amaury1093 Jan 19, 2021
f2de540
Fix sequence value in auth sign signature only (#8287) (#8383)
amaury1093 Jan 19, 2021
ca2ff62
fix: wrappedError.Is (#8355) (#8377)
robert-zaremba Jan 19, 2021
07a68b5
fix: wrappedError.Is (#8355) (#8377)
robert-zaremba Jan 19, 2021
52f0baa
Update gogo proto deps with v1.3.2 security fixes (#8350) (#8386)
amaury1093 Jan 19, 2021
5acc12a
Fix ibc client (#8341) (#8375)
robert-zaremba Jan 19, 2021
1c76416
fix proto generation (#8361) (#8389)
robert-zaremba Jan 19, 2021
079f3ee
Add missing unpack interfaces functions to IBC (#8359) (#8379)
robert-zaremba Jan 19, 2021
e474138
backport: client denom metadata queries (#8364)
fedekunze Jan 19, 2021
df5bf85
Backport/changelog (#8390)
robert-zaremba Jan 19, 2021
7cb7a3a
update to tendermint v0.34.3 (#8388) (#8391)
amaury1093 Jan 19, 2021
5b45deb
stargate: balance and metadata validation (#8421)
fedekunze Jan 26, 2021
5179e7e
backport #8418 (#8424)
fedekunze Jan 26, 2021
f67c4f9
Reorder IBC channel callbacks (#8441)
Jan 26, 2021
e6dac1d
ibc: MsgTransfer amino JSON, commits from @fedekunze (#8440)
Jan 26, 2021
c54025d
chore: update RELEASE_NOTES.md (#8443)
fdymylja Jan 26, 2021
f8a6987
Merge pull request #8444 from cosmos/release/v0.40.x
Jan 26, 2021
a72c975
backport #8479 (#8486)
fedekunze Feb 2, 2021
2437b66
snapshots: fix flaky tests [o.41-cherry-pick] (#8484)
Feb 4, 2021
ad46b2f
Fix keyring import from older versions. (#8489)
Feb 4, 2021
37e1d93
Add packet_connection attribute to packet lifecycle methods (#8483)
colin-axner Feb 4, 2021
8a79ec1
fix: tendermint subcommands should not create missing files (#8493)
Feb 4, 2021
5bd006c
bank: don't ignore errors returned by Balance.GetAddress() (#8534)
Feb 8, 2021
e009135
add cosmovisot to running a node (#8320)
jgimeno Jan 13, 2021
41d50c8
Update chain-upgrade-guide-040.md (#8326)
Feb 9, 2021
08a012d
docs: Update x/staking spec (#8395)
amaury1093 Feb 1, 2021
6221c31
Misc documentation fixes (#8452)
hjorthjort Jan 28, 2021
34b8d1c
fixing typo at 'os' backend session (#8477)
victorfrancax1 Feb 4, 2021
e0647bd
Update cosmovisor.md (#8552)
okwme Feb 10, 2021
2a5818c
Run pro-gen again
amaury1093 Feb 12, 2021
c878615
docs: rest_grpc updates (#8582)
tac0turtle Feb 15, 2021
2c52cb4
Merge pull request #8576 from cosmos/am-backport-docs
Feb 15, 2021
35a243a
[backport/v0.41.x] Removed GetValidator caching to fix concurrency er…
amaury1093 Feb 15, 2021
5b2856f
Make gRPC requests go through tendermint Query (#8549) (#8585)
amaury1093 Feb 16, 2021
3873289
[backport/v0.41.x] build(deps): bump github.com/tendermint/tendermint…
amaury1093 Feb 16, 2021
40aab82
docs: Remove deprecated "Interfaces" section (#8294) (#8594)
amaury1093 Feb 16, 2021
963de42
fix: bind values from env variables to flags (#8337) (#8488)
troian Feb 17, 2021
d685701
[backport/v0.41.x]: Compatibility with the ARM architecture (#8450)
Feb 17, 2021
3e6b7e8
[backport/v0.41.x] x/crisis - general audit and cleanup (#8269) (#8303)
aleem1314 Feb 17, 2021
421133b
codec/types: avoid unnecessary allocations for NewAnyWithCustomTypeUR…
mergify[bot] Feb 17, 2021
d2b8fea
crypto/hd: make DerivePrivateKeyForPath error and not panic on traili…
mergify[bot] Feb 17, 2021
a941e58
Release Notes and CHANGELOG for v0.41.1 (#8596)
amaury1093 Feb 17, 2021
37b7221
release v0.41.2 (#8615)
Feb 18, 2021
6ef4bed
testutil/network: fix build (#8617)
boz Feb 18, 2021
128cb54
Release v0.41.3 (#8623)
Feb 18, 2021
bdec113
Update baseapp docs (#8630) (#8644)
mergify[bot] Feb 22, 2021
ba8de90
backport: x/{auth, bank, distr} docs basic cleanup (#8268) (#8304)
atheeshp Feb 22, 2021
02aa30e
server: fix interceptConfigs (bp #8641) (#8659)
mergify[bot] Feb 22, 2021
819af54
docs: update master docs (bp #8353) (#8672)
mergify[bot] Feb 24, 2021
7060935
Add multisign batch command (bp #7787) (#8691)
mergify[bot] Feb 25, 2021
72cfca1
update tendermint to v0.34.8 (#8701) (#8702)
mergify[bot] Feb 25, 2021
e766410
docs: Add mention to use gRPC v1.33.2 (#8658) (#8699)
mergify[bot] Feb 25, 2021
50744f8
Add warning notice in changelog for v0.41.x bug (ref: #8461) (bp #870…
mergify[bot] Feb 26, 2021
ce82077
fix REST endpoints in migration docs (bp #8648) (#8687)
mergify[bot] Feb 26, 2021
16fbb50
auth: allow 0 coin accounts in genesis (bp #8714) (#8716)
mergify[bot] Feb 26, 2021
2e60065
fix: per 8711 fix typo and minor command text edit for multi sign bat…
mergify[bot] Feb 27, 2021
5a6b846
Backport genesis speed ups to 0.41.x (#8722)
zmanian Mar 1, 2021
0e0e5e9
Use x/auth/client for querying Txs (#8732)
amaury1093 Mar 1, 2021
b8134c1
Allow REST endpoint to query txs with multisig (bp #8730) (#8731)
mergify[bot] Mar 1, 2021
ee90640
update CHANGELOG
Mar 1, 2021
ba3ac53
crypto/keyring: fix offline keys migration (#8738)
Mar 2, 2021
4afd4f4
further reduce logging (#8752) (#8753)
mergify[bot] Mar 2, 2021
3aaf1bc
update: release notes for v0.41.4 (#8748)
fdymylja Mar 2, 2021
70603b6
Fix multisig account migration
akhilkumarpilli Mar 4, 2021
1ebd023
Modify multisig check
akhilkumarpilli Mar 4, 2021
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
2 changes: 1 addition & 1 deletion build.sh → .build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set -ue
# - DEBUG

# Source builder's functions library
. /usr/local/share/cosmos-sdk/buildlib.sh
. /usr/local/share/tendermint/buildlib.sh

# These variables are now available
# - BASEDIR
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/proto-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build & Push SDK Proto Builder
on:
push:
branches:
- master
paths:
- "contrib/devtools/dockerfile"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=tendermintdev/sdk-proto-gen
VERSION=noop
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then
VERSION=latest
fi
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
echo ::set-output name=tags::${TAGS}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUBTM_USERNAME }}
password: ${{ secrets.DOCKERHUBTM_TOKEN }}

- name: Publish to Docker Hub
uses: docker/build-push-action@v2
with:
context: ./docker-build-sdk-proto
file: ./docker-build-sdk-proto/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
22 changes: 21 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@ jobs:
path: ~/go/bin
key: ${{ runner.os }}-go-tparse-binary

build:
runs-on: ubuntu-latest
strategy:
matrix:
go-arch: ["amd64", "arm", "arm64"]
steps:
- uses: actions/checkout@v2
- uses: actions/[email protected]
with:
go-version: 1.15
- uses: technote-space/get-diff-action@v4
id: git_diff
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- name: Build
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make build

test-cosmovisor:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -181,7 +201,7 @@ jobs:
if: env.GIT_DIFF
- name: test & coverage report creation
run: |
cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -json -timeout 30m -race -tags='cgo ledger test_ledger_mock' > ${{ matrix.part }}-race-output.txt
xargs --arg-file=pkgs.txt.part.${{ matrix.part }} go test -mod=readonly -json -timeout 30m -race -tags='cgo ledger test_ledger_mock' | tee ${{ matrix.part }}-race-output.txt
if: env.GIT_DIFF
- uses: actions/upload-artifact@v2
with:
Expand Down
318 changes: 150 additions & 168 deletions CHANGELOG.md

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Cosmos SDK v0.41.4 "Stargate" Release Notes

This release includes the addition of the multisign-batch command, minor bug fixes, and performance improvements.

See the [Cosmos SDK v0.41.4 milestone](https://github.com/cosmos/cosmos-sdk/milestone/40?closed=1) on our issue tracker for details.

## multisign-batch command

Multisign-batch command was added and it allows generating multiple multisig transactions by merging batches of signatures.

## Query tx with multisig addresses

Now the rest endpoint allows to query transactions with multisig addresses.

## Improvements

Major performance improvements in store and balance which will speed up genesis verification and initialization.

Genesis now allows 0 coin account balances. This means that genesis initialization will not fail if an address with no balance will be included.

## Bugfixes

The keys migration command (i.e. `keys migrate`) is now functional for offline, multisign, and ledger keys.

Minor bugfixes were included regarding missing errors and fields on some responses.

## Tendermint new release

Tendermint was upgraded to v0.34.8. This release of Tendermint introduces various changes that should make the logs much, much quieter. See [Tendermint's changelog](https://github.com/tendermint/tendermint/blob/v0.34.8/CHANGELOG.md#v0.34.8) for more information.
34 changes: 32 additions & 2 deletions baseapp/grpcrouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package baseapp

import (
"fmt"
"reflect"

gogogrpc "github.com/gogo/protobuf/grpc"
abci "github.com/tendermint/tendermint/abci/types"
Expand All @@ -12,13 +13,19 @@ import (
"github.com/cosmos/cosmos-sdk/client/grpc/reflection"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

var protoCodec = encoding.GetCodec(proto.Name)

// GRPCQueryRouter routes ABCI Query requests to GRPC handlers
type GRPCQueryRouter struct {
routes map[string]GRPCQueryHandler
routes map[string]GRPCQueryHandler
// returnTypes is a map of FQ method name => its return type. It is used
// for cache purposes: the first time a method handler is run, we save its
// return type in this map. Then, on subsequent method handler calls, we
// decode the ABCI response bytes using the cached return type.
returnTypes map[string]reflect.Type
interfaceRegistry codectypes.InterfaceRegistry
serviceData []serviceData
}
Expand All @@ -34,7 +41,8 @@ var _ gogogrpc.Server = &GRPCQueryRouter{}
// NewGRPCQueryRouter creates a new GRPCQueryRouter
func NewGRPCQueryRouter() *GRPCQueryRouter {
return &GRPCQueryRouter{
routes: map[string]GRPCQueryHandler{},
returnTypes: map[string]reflect.Type{},
routes: map[string]GRPCQueryHandler{},
}
}

Expand Down Expand Up @@ -89,8 +97,17 @@ func (qrt *GRPCQueryRouter) RegisterService(sd *grpc.ServiceDesc, handler interf
if qrt.interfaceRegistry != nil {
return codectypes.UnpackInterfaces(i, qrt.interfaceRegistry)
}

return nil
}, nil)

// If it's the first time we call this handler, then we save
// the return type of the handler in the `returnTypes` map.
// The return type will be used for decoding subsequent requests.
if _, found := qrt.returnTypes[fqName]; !found {
qrt.returnTypes[fqName] = reflect.TypeOf(res)
}

if err != nil {
return abci.ResponseQuery{}, err
}
Expand Down Expand Up @@ -127,3 +144,16 @@ func (qrt *GRPCQueryRouter) SetInterfaceRegistry(interfaceRegistry codectypes.In
reflection.NewReflectionServiceServer(interfaceRegistry),
)
}

// returnTypeOf returns the return type of a gRPC method handler. With the way the
// `returnTypes` cache map is set up, the return type of a method handler is
// guaranteed to be found if it's retrieved **after** the method handler ran at
// least once. If not, then a logic error is return.
func (qrt *GRPCQueryRouter) returnTypeOf(method string) (reflect.Type, error) {
returnType, found := qrt.returnTypes[method]
if !found {
return nil, sdkerrors.Wrapf(sdkerrors.ErrLogic, "cannot find %s return type", method)
}

return returnType, nil
}
83 changes: 47 additions & 36 deletions baseapp/grpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,78 @@ package baseapp

import (
"context"
"strconv"
"reflect"

gogogrpc "github.com/gogo/protobuf/grpc"
grpcmiddleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpcrecovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/client"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
grpctypes "github.com/cosmos/cosmos-sdk/types/grpc"
"github.com/cosmos/cosmos-sdk/types/tx"
)

// GRPCQueryRouter returns the GRPCQueryRouter of a BaseApp.
func (app *BaseApp) GRPCQueryRouter() *GRPCQueryRouter { return app.grpcQueryRouter }

// RegisterGRPCServer registers gRPC services directly with the gRPC server.
func (app *BaseApp) RegisterGRPCServer(server gogogrpc.Server) {
// Define an interceptor for all gRPC queries: this interceptor will create
// a new sdk.Context, and pass it into the query handler.
interceptor := func(grpcCtx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
// If there's some metadata in the context, retrieve it.
md, ok := metadata.FromIncomingContext(grpcCtx)
if !ok {
return nil, status.Error(codes.Internal, "unable to retrieve metadata")
}
func (app *BaseApp) RegisterGRPCServer(clientCtx client.Context, server gogogrpc.Server) {
// Define an interceptor for all gRPC queries: this interceptor will route
// the query through the `clientCtx`, which itself queries Tendermint.
interceptor := func(grpcCtx context.Context, req interface{}, info *grpc.UnaryServerInfo, _ grpc.UnaryHandler) (interface{}, error) {
// Two things can happen here:
// 1. either we're broadcasting a Tx, in which case we call Tendermint's broadcast endpoint directly,
// 2. or we are querying for state, in which case we call ABCI's Query.

// Get height header from the request context, if present.
var height int64
if heightHeaders := md.Get(grpctypes.GRPCBlockHeightHeader); len(heightHeaders) > 0 {
height, err = strconv.ParseInt(heightHeaders[0], 10, 64)
if err != nil {
return nil, sdkerrors.Wrapf(
sdkerrors.ErrInvalidRequest,
"Baseapp.RegisterGRPCServer: invalid height header %q: %v", grpctypes.GRPCBlockHeightHeader, err)
}
if err := checkNegativeHeight(height); err != nil {
return nil, err
// Case 1. Broadcasting a Tx.
if reqProto, ok := req.(*tx.BroadcastTxRequest); ok {
if !ok {
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "expected %T, got %T", (*tx.BroadcastTxRequest)(nil), req)
}

return client.TxServiceBroadcast(grpcCtx, clientCtx, reqProto)
}

// Case 2. Querying state.
inMd, _ := metadata.FromIncomingContext(grpcCtx)
abciRes, outMd, err := client.RunGRPCQuery(clientCtx, grpcCtx, info.FullMethod, req, inMd)
if err != nil {
return nil, err
}

// Create the sdk.Context. Passing false as 2nd arg, as we can't
// actually support proofs with gRPC right now.
sdkCtx, err := app.createQueryContext(height, false)
// We need to know the return type of the grpc method for
// unmarshalling abciRes.Value.
//
// When we call each method handler for the first time, we save its
// return type in the `returnTypes` map (see the method handler in
// `grpcrouter.go`). By this time, the method handler has already run
// at least once (in the RunGRPCQuery call), so we're sure the
// returnType maps is populated for this method. We're retrieving it
// for decoding.
returnType, err := app.GRPCQueryRouter().returnTypeOf(info.FullMethod)
if err != nil {
return nil, err
}

// Attach the sdk.Context into the gRPC's context.Context.
grpcCtx = context.WithValue(grpcCtx, sdk.SdkContextKey, sdkCtx)
// returnType is a pointer to a struct. Here, we're creating res which
// is a new pointer to the underlying struct.
res := reflect.New(returnType.Elem()).Interface()

// Add relevant gRPC headers
if height == 0 {
height = sdkCtx.BlockHeight() // If height was not set in the request, set it to the latest
err = protoCodec.Unmarshal(abciRes.Value, res)
if err != nil {
return nil, err
}

// Send the metadata header back. The metadata currently includes:
// - block height.
err = grpc.SendHeader(grpcCtx, outMd)
if err != nil {
return nil, err
}
md = metadata.Pairs(grpctypes.GRPCBlockHeightHeader, strconv.FormatInt(height, 10))
grpc.SetHeader(grpcCtx, md)

return handler(grpcCtx, req)
return res, nil
}

// Loop through all services and methods, add the interceptor, and register
Expand Down
2 changes: 2 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version: v1beta1

build:
roots:
- proto
Expand Down
20 changes: 4 additions & 16 deletions client/grpc/reflection/reflection.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading