Go to file
Emmanuel T Odeke 56fc3fc572
codec/types: avoid unnecessary allocations for NewAnyWithCustomTypeURL on error (#8605)
Avoids a bleed out attack in which a node can be made to allocate
memory slowly or very fast in small strides, by sending bad data
to code that invokes NewAnyWithCustomTypeURL, in which we
unconditionally returned a new Any object. On a 64-bit machine,
this would waste 96 bytes per invocation even on error.

Added a test to ensure zero allocations with a fixed error returned.
Also added a benchmark which shows reduction in wasted allocations and
wasted CPU time:

```shell
$ benchstat before.txt after.txt
name                                            old time/op    new time/op    delta
NewAnyWithCustomTypeURLWithErrorReturned-8      142ns ± 6%      55ns ±12%   -61.65%  (p=0.000 n=9+10)

name                                            old alloc/op   new alloc/op   delta
NewAnyWithCustomTypeURLWithErrorReturned-8      96.0B ± 0%      0.0B       -100.00%  (p=0.000 n=10+10)

name                                            old allocs/op  new allocs/op  delta
NewAnyWithCustomTypeURLWithErrorReturned-8      1.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)
```

Fixes #8537
2021-02-17 10:13:00 +00:00
.github atlas: evidence (#8561) 2021-02-15 13:51:42 +00:00
baseapp Make gRPC requests go through tendermint Query (#8549) 2021-02-15 10:01:44 +00:00
client Add pagination to GetValidatorSetByHeight response (#8567) 2021-02-15 10:41:39 +00:00
codec codec/types: avoid unnecessary allocations for NewAnyWithCustomTypeURL on error (#8605) 2021-02-17 10:13:00 +00:00
contrib Refactor store keys for variable-length addresses (#8363) 2021-02-01 13:17:44 +00:00
cosmovisor cosmovisor: ln -s docs/run-node/cosmovisor.md cosmovisor/README.md (#8526) 2021-02-05 15:17:52 +00:00
crypto adr-028 address generation (#8415) 2021-02-15 15:32:51 +00:00
docs Modify IBC client governance unfreezing to reflect ADR changes (#8405) 2021-02-16 15:31:40 +00:00
proto Modify IBC client governance unfreezing to reflect ADR changes (#8405) 2021-02-16 15:31:40 +00:00
scripts fix proto generation (#8361) 2021-01-18 12:41:34 -03:00
server Make gRPC requests go through tendermint Query (#8549) 2021-02-15 10:01:44 +00:00
simapp Modify IBC client governance unfreezing to reflect ADR changes (#8405) 2021-02-16 15:31:40 +00:00
snapshots snapshots: document use of ioutil.TempDir() (#8508) 2021-02-04 09:54:01 +00:00
std Add ADR 031 BaseApp and codec infrastructure (#7519) 2020-10-15 13:07:59 +00:00
store store/multistore: revert a height limit increase from #8396 (#8466) 2021-01-29 18:46:23 +00:00
telemetry Minor Code Cleanup - gRPC queries (#6862) 2020-07-28 12:53:35 +00:00
tests Add in-place store migrations (#8485) 2021-02-10 17:49:31 +00:00
testutil Make gRPC requests go through tendermint Query (#8549) 2021-02-15 10:01:44 +00:00
third_party/proto gRPC-gateway routes as alternative to legacy tendermint REST endpoints (#7965) 2020-11-25 15:58:11 +00:00
types adr-028 address generation (#8415) 2021-02-15 15:32:51 +00:00
version version --long displays replaced build dependencies (#7941) 2020-11-16 10:00:34 +00:00
x Modify IBC client governance unfreezing to reflect ADR changes (#8405) 2021-02-16 15:31:40 +00:00
.build.sh fix library file path (#8301) 2021-01-12 10:08:42 +00:00
.clang-format Fix clang-format to specific version (#7350) 2020-10-27 10:04:34 +00:00
.codecov.yml CI: Fix codecov flag project config (#7994) 2020-11-20 09:13:25 -05:00
.dockerignore Add basic Dockerfile to build all binaries and export gaiad 2018-04-10 12:39:47 +02:00
.gitattributes Merge PR #6426: Migrate API Server 2020-06-15 13:39:09 -04:00
.gitignore All Makefile proto commands use Docker (#7931) 2020-11-13 16:36:58 +00:00
.golangci.yml linter: enable nolintlint (#6162) 2020-05-08 08:46:12 +00:00
.goreleaser.yml ci: automate release post tag push (#6230) 2020-05-25 20:02:08 +02:00
.mergify.yml Tweak mergify config 2020-03-01 16:18:22 +00:00
buf.yaml fix proto generation (#8361) 2021-01-18 12:41:34 -03:00
CHANGELOG.md Modify IBC client governance unfreezing to reflect ADR changes (#8405) 2021-02-16 15:31:40 +00:00
CODE_OF_CONDUCT.md Update CODE_OF_CONDUCT.md (#7381) 2020-09-28 11:28:30 +02:00
CONTRIBUTING.md Update CONTRIBUTING.md Point Release Procedure (#7999) 2020-12-11 01:50:07 +00:00
docker-compose.yml buildsystem: simplify Makefile and ci automation (#7189) 2020-08-31 15:39:05 +02:00
Dockerfile Makefile: simplify and clean-up (#7453) 2020-10-05 10:22:18 +02:00
go.mod build(deps): bump github.com/spf13/cobra from 1.1.2 to 1.1.3 (#8566) 2021-02-12 10:19:07 -03:00
go.sum build(deps): bump github.com/spf13/cobra from 1.1.2 to 1.1.3 (#8566) 2021-02-12 10:19:07 -03:00
LICENSE Add README.md to Basecoin; Update licenses 2018-01-28 18:17:19 -08:00
Makefile Compatibility with the ARM architecture (#8396) 2021-01-27 11:07:45 +00:00
README.md update readme to link starport instead of scaffold (#7613) 2020-10-21 08:08:20 +00:00
SECURITY.md update SECURITY.md (#6263) 2020-05-21 11:12:51 +02:00
STABLE_RELEASES.md Stable Releases: Definition and Process (#6394) 2020-07-14 10:28:53 +02:00

Cosmos SDK

banner

The Cosmos-SDK is a framework for building blockchain applications in Golang. It is being used to build Gaia, the first implementation of the Cosmos Hub.

WARNING: The SDK has mostly stabilized, but we are still making some breaking changes.

Note: Requires Go 1.15+

Quick Start

To learn how the SDK works from a high-level perspective, go to the SDK Intro.

If you want to get started quickly and learn how to build on top of the SDK, please follow the SDK Application Tutorial. You can also fork the tutorial's repository to get started building your own Cosmos SDK application.

For more, please go to the Cosmos SDK Docs.

Cosmos Hub Mainnet

The Cosmos Hub application, gaia, has moved to its own repository. Go there to join the Cosmos Hub mainnet and more.

Starport

If you are starting a new app or a new module you can use Starport to help you get started and speed up development. If you have any questions or find a bug, feel free to open an issue in the repo.

Disambiguation

This Cosmos-SDK project is not related to the React-Cosmos project (yet). Many thanks to Evan Coury and Ovidiu (@skidding) for this Github organization name. As per our agreement, this disambiguation notice will stay here.