Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 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
4603a46
add sr25519 keys sign algo
xbuidler Feb 19, 2021
28a7253
lint
xbuidler Feb 19, 2021
121a045
lint
xbuidler Feb 19, 2021
c0c9018
remove unused var
xbuidler Feb 19, 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 }}
20 changes: 20 additions & 0 deletions .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/setup-go@v2.1.3
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
310 changes: 135 additions & 175 deletions CHANGELOG.md

Large diffs are not rendered by default.

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

This release fixes a build failure caused by a small API breakage introduced in Tendermint v0.34.7. It is **highly recommended** that all applications using v0.41.2 upgrade to v0.41.3 as soon as possible.

See the [Cosmos SDK v0.41.3 milestone](https://github.com/cosmos/cosmos-sdk/milestone/39?closed=1) on our issue tracker for details.
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