Commit Graph

8496 Commits

Author SHA1 Message Date
technicallyty d3bcc15b11
x/feegrant API Audit changes (#9194)
* -add comments to proto fields
-add comments to msg and query server
-remove decorator from docs
-add coments to msgs.go
-remove decorator from godoc

* Update x/feegrant/spec/04_events.md

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>

* refactor and add to docs
*refactor proto msg names and functions
*add docs pertaining to auth's ante handler for deducted fees

* lint

* update comment

* gofmt

Co-authored-by: technicallyty <48813565+tytech3@users.noreply.github.com>
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-05-03 12:34:48 +00:00
Cuong Manh Le 711976efc1
store/internal: validate keys before calling ProofsFromMap (#9235)
Otherwise, an empty key as input or present in data can cause a panic at
runtime.

Caught by oss-fuzz: https://oss-fuzz.com/testcase-detail/4647668077953024

Fixes #9233
2021-05-02 15:53:59 -07:00
Cuong Manh Le 72873a072f
crypto/types: optimize compact bit array one count (#9216)
By using bits.OnesCount8 instead of bitwise operations.

Benchmark result on Apple M1:

name                     old time/op    new time/op    delta
NumTrueBitsBefore/new-8    88.5ns ± 1%     9.1ns ± 0%  -89.68%  (p=0.000 n=10+10)

name                     old alloc/op   new alloc/op   delta
NumTrueBitsBefore/new-8     0.00B          0.00B          ~     (all equal)

name                     old allocs/op  new allocs/op  delta
NumTrueBitsBefore/new-8      0.00           0.00          ~     (all equal)

Fixes #9125
2021-04-30 21:08:14 +00:00
atheeshp f04b5dcb96
fix zero coins (#9229)
* fix zero coins issue

* fix tests

* udpate tests

* Review change

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* add change log

* review changes

* review changes

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2021-04-30 16:54:08 +00:00
Amaury dfe3e7a8d7
Remove ServiceMsgs from ADR-031 (#9139)
* wip

* wip

* wip

* wip on refactoring adr 031 type URLs

* Fix msg_service_router

* Fix gov client queries

* Fix some modules tests

* Remove all instances of "*.Msg/*"

* Uncomment code

* Remove commented code

* // simulation.NewWeightedOperation(

* Fix CopyTx

* Fix more tests

* Fix x/gov test

* proto.MessageName->sdk.MsgName

* Fix authz tests

* Use MsgRoute in feegrant and staking/authz

* Fix more tests

* Fix sims?

* Add norace tag

* Add CL

* rebuild rosetta api test data

* Update ADR

* Rename MsgRoute -> MsgTypeURL

* Fix codec registration

* Remove sdk.GetLegacySignBytes

* Update types/tx_msg.go

* Update x/authz/simulation/operations.go

* Move LegacyMsg to legacytx

* Update CHANGELOG.md

Co-authored-by: Aaron Craelius <aaron@regen.network>

* Remove NewAnyWithCustomTypeURL

* Keep support for ServiceMsgs

* Fix TxBody UnpackInterfaces

* Fix test

* Address review

* Remove support for ServiceMsg typeURLs

* Fix lint

* Update changelog

* Fix tests

* Use sdk.MsgTypeURL everywhere

* Fix tests

* Fix rosetta, run make rosetta-data

* Fix rosetta thanks to froydi

* Address reviews

* Fix test

* Remove stray log

* Update CL

Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
2021-04-30 11:00:47 +00:00
Greg Morrison 6fbded9664
Improve readability in handleQueryP2P (#9205)
* refactor(abci handleP2PQuery): improve readability via control flow

* refactor(acbi handleQueryP2P): fix logic control flow to ensure early return

* refactor(abci handleQueryP2P): move var declaration to prevent unnecessary initialization

* support(CHANGELOG): add description for abci handleQueryP2P changes

Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
2021-04-30 09:34:28 +00:00
Federico Kunze e25f80d34c
gov, params: refactor tests (#9137)
* gov, params: refactor tests

* wrap up params tests

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-04-30 08:41:25 +00:00
dependabot[bot] 4f4c035c89
build(deps): bump github.com/prometheus/common from 0.21.0 to 0.23.0 (#9213)
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.21.0 to 0.23.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.21.0...v0.23.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
2021-04-29 13:00:16 +00:00
Robert Zaremba be4a965599
codec: Rename codec and marshaler interfaces (#9226)
* codec: Rename codec and marshaler interfaces, ref: 8413

* codec: remove BinaryBare

* changelog update

* Update comments and documentation

* adding doc string comments

* Update CHANGELOG.md

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update codec/codec.go

Co-authored-by: Marko <marbar3778@yahoo.com>

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Marko <marbar3778@yahoo.com>
2021-04-29 10:46:22 +00:00
yihuang c94e9eb1bb
fix validator address prefix (#9212)
Co-authored-by: Marko <marbar3778@yahoo.com>
2021-04-29 07:11:32 +00:00
Riccardo Montagnin afa818a58f
Added a "new_shares" attribute inside the delegate event type (#9214)
* Added a "new_shares" attribute inside the delegate event type

* ADded CHANGELOG entry
2021-04-29 06:57:46 +00:00
Cuong Manh Le 6ad84c5065
x/gov/keeper: fix flaky TestPaginatedVotesQuery (#9223)
When testing with -race, sometimes the random source generate the same
string for consecutive calls, causing duplicated voter address. So the
number of votes in DB is not 20.

To fix this, we ensure unique addresses are generated, by using a map
for tracking which one was produced, and skip the duplicated address and
generated new one. Testing with:

	go test -race -v -count=1000 -run=TestPaginatedVotesQuery

now passes.

Updates #9010
2021-04-28 17:08:42 +00:00
MD Aleem a2911d0dc6
x/feegrant state machine audit updates (#9176)
* replace panic with error

* improve test coverage

* add time based tests to basic-fee

* add periodic fee tests

* wip

* add msg_server tests

* improve getFeeGrant

* fix failing test

* fix test

* fix comments

* refactor

* review changes

* review changes

* fix errors

* Update x/feegrant/types/basic_fee_test.go

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>

* review changes

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
2021-04-28 15:39:58 +00:00
technicallyty 0cbed20db8
x/feegrant audit: clean up / add test coverage to types package (#9193)
* Squashed commit of the following:

commit 58dc50051226a9eeb8d0ebea5bb0908fe5b9637f
Author: technicallyty <48813565+tytech3@users.noreply.github.com>
Date:   Fri Apr 23 15:09:27 2021 -0700

    remove comments

commit a84107e1b3eaa31324cb0f4f097b49f02af79c69
Author: technicallyty <48813565+tytech3@users.noreply.github.com>
Date:   Fri Apr 23 15:02:41 2021 -0700

    add tests for msgs.go

commit 2ad16869237e9631b402c93cde650c3fc554daf2
Author: technicallyty <48813565+tytech3@users.noreply.github.com>
Date:   Fri Apr 23 13:20:21 2021 -0700

    specify test name

commit b7121277c9be586a7c80d010ec401e50b510e02a
Merge: c0c134d971 3c65c3dacd
Author: technicallyty <48813565+tytech3@users.noreply.github.com>
Date:   Fri Apr 23 12:54:55 2021 -0700

    Merge branch 'master' into ty-9115-types_tests

commit c0c134d97107194dc4f9d3c501a15d023ae083e5
Author: technicallyty <48813565+tytech3@users.noreply.github.com>
Date:   Thu Apr 22 19:59:11 2021 -0700

    -add test case to cli_test.go for filtered fee
    -clean up identifiers
    -remove redundant import alias from filtered_fee.go

commit f7ab3699da39be3ab886f96962d28d23438d2e8e
Author: technicallyty <48813565+tytech3@users.noreply.github.com>
Date:   Thu Apr 22 09:57:31 2021 -0700

    remove unecessary constant

commit 9db59a82a7337cf5a7a3569c6900a44a6c81e8b4
Merge: a3e75ceb8a e28271b8e6
Author: technicallyty <48813565+tytech3@users.noreply.github.com>
Date:   Thu Apr 22 09:19:20 2021 -0700

    Merge branch 'master' into ty-9115-types_tests

commit a3e75ceb8a510ad9db43dd96073c43b7a8b062b0
Merge: 4d3dafab85 bffcae54a1
Author: technicallyty <48813565+tytech3@users.noreply.github.com>
Date:   Wed Apr 21 12:04:39 2021 -0700

    Merge branch 'master' into ty-9115-types_tests

commit 4d3dafab85d85526a7c94b045289605289ee6b0d
Author: technicallyty <48813565+tytech3@users.noreply.github.com>
Date:   Wed Apr 21 12:03:41 2021 -0700

    cleanup id's / add test case

commit e8f6924931ba95e592bfc3057ba167700458da41
Author: technicallyty <48813565+tytech3@users.noreply.github.com>
Date:   Wed Apr 21 10:55:29 2021 -0700

    add test for 0 allowance / remove unused field on exp test

commit 516b6ef89a4582ad681cc6c5c101cf50a9a54fb5
Author: technicallyty <48813565+tytech3@users.noreply.github.com>
Date:   Tue Apr 20 15:22:48 2021 -0700

    make names more clear, remove unused field

* fix imports

* fix tests

* rename test field

Co-authored-by: technicallyty <48813565+tytech3@users.noreply.github.com>
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
Co-authored-by: MD Aleem <72057206+aleem1314@users.noreply.github.com>
2021-04-28 14:18:38 +00:00
colin axnér f45838ff3c
update contributor docs (#9190)
* update contributor docs

* revert changes to release section

* fix formatting

Co-authored-by: Marko <marbar3778@yahoo.com>
2021-04-28 13:02:52 +00:00
Marko f32597e510
remove unused list (#9219) 2021-04-28 12:46:22 +00:00
Devashish Dixit 15edf3c38f
Add more details in error message for invalid vote option (#9185)
Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
2021-04-28 10:19:08 +00:00
Aaron Craelius e8e5c08655
Add labeler action (#9204)
* Add labeler action

* Update .github/labeler.yml

Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>

* Update .github/labeler.yml

Co-authored-by: Cory <cjlevinson@gmail.com>

* update labels

* update labels

* Update .github/labeler.yml

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* update labels

Co-authored-by: Cory <cjlevinson@gmail.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2021-04-27 14:52:19 -04:00
Marie Gauthier 3ab1bc2346
x/feegrant completeness audit updates (#9177)
* Updates to Genesis

* Move grpc_query tests to keeper pkg

* Unify CLI command usage message

* Use timestamp for time based expiration in cli

* Update FlagExpiration

* Update wording

* Add test case for invalid expiration

* Update cli Long description

* Update exp date examples

* Use constants
2021-04-27 13:37:26 +00:00
atheeshp fc256a3683
x/feegrant simulation audit changes (#9145)
* simulation genesis changes

* update msg types

* refactor

* update operations test

* fix sims

* fix tests

* fix tests

* address review changes

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
2021-04-27 07:42:48 +00:00
Riccardo Montagnin fdbc32e50c
Fixed the --recover flag not working properly inside the init command (#9201)
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-04-26 18:33:30 +00:00
Emmanuel T Odeke 49bf0774bc
crypto/types: fix negative index accesses in CompactUnmarshal,GetIndex,SetIndex (#9196)
Fixes unchecked negative index access that'd cause panics, in CompactBitArray's:
* CompactUnmarshal, which blindly used the result of binary.Uvarint
* GetIndex
* SetIndex

Fixes #9164
Fixes #9165
2021-04-26 16:40:27 +00:00
billy rennekamp 9f835e7f74
Merge pull request #9169 from cosmos/okwme-adr-committee
Proposal for expanding the ADR committee
2021-04-26 18:01:21 +02:00
billy rennekamp 03eac1e914
Update CODEOWNERS 2021-04-26 17:56:42 +02:00
billy rennekamp 985b9017ef
Update CONTRIBUTING.md
removed secondary entirely
2021-04-26 17:55:59 +02:00
billy rennekamp 3e8b5ca689
Merge branch 'master' into okwme-adr-committee 2021-04-26 17:41:14 +02:00
billy rennekamp 3530299dde
Update .github/CODEOWNERS
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-04-26 17:40:17 +02:00
billy rennekamp 8de11ba657
Update CONTRIBUTING.md
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-04-26 17:40:10 +02:00
Robert Zaremba 71b7fb829e
setup: reuses proto container (#9192)
* setup: reuses proto container

* push docker image

* set image name

* revert and use latest

Co-authored-by: marbar3778 <marbar3778@yahoo.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
2021-04-26 11:15:46 +00:00
colin axnér 556134c89b
remove IBC ADRs (#9191)
* remove IBC ADRs

* remove ADR references from README

Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-04-26 11:05:24 +00:00
Marko 338dac40f6
remove docs deployment (#9202) 2021-04-26 10:54:07 +00:00
dependabot[bot] 7c8ff2d4d4
build(deps): bump github.com/grpc-ecosystem/go-grpc-middleware (#9186)
Bumps [github.com/grpc-ecosystem/go-grpc-middleware](https://github.com/grpc-ecosystem/go-grpc-middleware) from 1.2.2 to 1.3.0.
- [Release notes](https://github.com/grpc-ecosystem/go-grpc-middleware/releases)
- [Changelog](https://github.com/grpc-ecosystem/go-grpc-middleware/blob/master/CHANGELOG.md)
- [Commits](https://github.com/grpc-ecosystem/go-grpc-middleware/compare/v1.2.2...v1.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-26 10:38:48 +00:00
dependabot[bot] 1f780087e5
build(deps): bump github.com/armon/go-metrics from 0.3.6 to 0.3.7 (#9187)
Bumps [github.com/armon/go-metrics](https://github.com/armon/go-metrics) from 0.3.6 to 0.3.7.
- [Release notes](https://github.com/armon/go-metrics/releases)
- [Commits](https://github.com/armon/go-metrics/compare/v0.3.6...v0.3.7)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2021-04-26 07:31:01 +00:00
Aaron Craelius 3c65c3dacd
Make integration test suites reusable by apps (#6711)
* WIP on refactoring new integration tests.

* godocs

* godocs

* Fix ineff assign

* Updates

* Updates

* fix test

* refactor crisis, distr testsuites

* fix import issue

* refactor x/auth

* refactor x/authz

* refactor x/evidence

* refactor x/feegrant

* refactor x/genutil

* refactor x/gov

* refactor x/mint

* refactor x/params

* refactor x/{auth_vesting, slashing, staking}

* fix lint

* fix tests & lint

* fix lint

* fix tests

* lint

* lint

* fix lint memory

* add missing `norace` build flag

* update feegrant cfg

* fix lint

Co-authored-by: atheesh <atheesh@vitwit.com>
Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>
2021-04-23 14:49:49 -04:00
Barrie Byron 5ea817a6fb
Update README.md (#9181)
the getting started link is busted, how about we send folks to Starport? and fix a few minor editorial nits
2021-04-22 21:02:53 +00:00
billy rennekamp e1bd6cf8fa
Update CONTRIBUTING.md
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-04-22 19:21:39 +02:00
billy rennekamp f572523357
Update CONTRIBUTING.md 2021-04-22 14:22:36 +02:00
Cuong Manh Le e28271b8e6
types: make NewDecFromStr returns error for too large decimal (#9157)
Otherwise, NewDecFromStr may accept very large input, causing Dec
methods panic, e.g Dec.TruncateInt

Found by oss-fuzz: https://oss-fuzz.com/testcase-detail/6454129938530304

Fixes #9160
2021-04-22 11:21:27 +01:00
billy rennekamp f99b7b1cbf
Proposal for expanding the ADR committee
Conversation in the gaia discord seems to merit an update to the ADR committee. I haven't spoken to any of the individuals to confirm their interest or availability but I'd like to use this as a more productive forum to push the conversation further. Especially looking for comment from those proposed (@marbar3778 @ebuchman @robert-zaremba @amaurym @zmanian @sunnya97 @fedekunze @odeke-em  )
2021-04-22 11:05:52 +02:00
dependabot[bot] 1a15412b92
build(deps): bump github.com/prometheus/common from 0.20.0 to 0.21.0 (#9167)
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.20.0 to 0.21.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.20.0...v0.21.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-22 08:06:26 +00:00
Emmanuel T Odeke 417832fa9a
crypto/types: check for overflow and unreasonably large element count (#9163)
Ensure that we don't pass overflowed values into make, because
a clever attacker could see that to cause:

    (bits+7)/8

to become negative, they just have to make (bits+7) become negative
simply by >=maxint-6

but also reject unreasonably large element count like >2**32, which
while arbitrary is super duper large for a bit array.

Fixes #9162
2021-04-21 20:09:41 -07:00
Sunny Aggarwal bffcae54a1
Add hooks to governance actions (#9133)
* add governance hooks

* fix lint

* fix lint

* CHANGELOG

* sh -> gh

* improve comments

* add test

* add more tests

* rename two of the hooks

Co-authored-by: ahmedaly113 <ahmedaly113@outlook.com>
2021-04-21 12:59:30 -04:00
Cory 603e89541f
Add support for permanent locked vesting accounts (#8520)
* add basics for permanent locked vesting account support

* remove sdk.Msg support for PermanentLockedVestingAccount

* add tests for PermanentLockedVestingAccount

* remove unecessary tests

* drop unecessary create vesting acct msgs

* Update x/auth/vesting/types/vesting_account.go

Co-authored-by: Aaron Craelius <aaron@regen.network>

* Update x/auth/vesting/types/vesting_account.go

Co-authored-by: Aaron Craelius <aaron@regen.network>

* Update x/auth/vesting/types/vesting_account.go

Co-authored-by: Aaron Craelius <aaron@regen.network>

* Update x/auth/vesting/types/vesting_account_test.go

Co-authored-by: Aaron Craelius <aaron@regen.network>

* Review changes

* Factorize init function

* Factorize more

* Comments

* Fix build after rename

Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
2021-04-21 16:18:28 +00:00
dependabot[bot] 045c45f550
build(deps): bump codecov/codecov-action from v1.4.0 to v1.4.1 (#9154)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from v1.4.0 to v1.4.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v1.4.0...967e2b38a85a62bd61be5529ada27ebc109948c2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-21 13:29:32 +00:00
dependabot[bot] 9fd866e382
build(deps): bump github.com/confio/ics23/go from 0.6.3 to 0.6.6 (#9142)
Bumps [github.com/confio/ics23/go](https://github.com/confio/ics23) from 0.6.3 to 0.6.6.
- [Release notes](https://github.com/confio/ics23/releases)
- [Commits](https://github.com/confio/ics23/compare/v0.6.3...go/v0.6.6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-20 09:40:25 +00:00
Marko b1cf4793d0
consistency in antehandler (#9144) 2021-04-20 09:21:37 +00:00
Frojdi Dymylja 83645e0360
ADR036: Arbitrary signature (#7727)
* add: arbitrary signature adr draft

* fix: adr number

* change: adjust scope, address feedback

* fix: missing sentence

* change: address wording

Co-authored-by: Robert Zaremba <robert@zaremba.ch>

* change: address wording and formatting

Co-authored-by: Robert Zaremba <robert@zaremba.ch>

* change: address formatting

Co-authored-by: Robert Zaremba <robert@zaremba.ch>

* change: message name, address modal verbs changes

* change: document how MsgSignData should be used

* change: address wording

Co-authored-by: Robert Zaremba <robert@zaremba.ch>

* add: how verification works

* Update docs/architecture/adr-036-arbitrary-signature.md

* Update docs/architecture/adr-036-arbitrary-signature.md

Co-authored-by: Robert Zaremba <robert@zaremba.ch>

* Apply suggestions from code review

* Update docs/architecture/adr-036-arbitrary-signature.md

* add: expand further discussion items

* fix: wording

* add: context references

* change: split offchain tx specific from MsgSignData

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Marko <marbar3778@yahoo.com>
2021-04-19 16:18:48 +00:00
Cuong Manh Le d3769b2fbc
internal/conv: fix wrong string to bytes implementation (#9141)
UnsafeStrToBytes is currently not safe for -d=checkptr=2, since when it
cast from smaller struct (string) to bigger struct ([]byte). That causes
checkptr complains as the casting straddle multiple heap objects.

To fix this, we have to get the string header first, then use its fields
to construct the slice.

New implementation performs the same speed with the old (wrong) one.

name                old time/op    new time/op    delta
UnsafeStrToBytes-8    25.7ns ± 1%    25.7ns ± 3%   ~     (p=0.931 n=10+17)

name                old alloc/op   new alloc/op   delta
UnsafeStrToBytes-8     7.00B ± 0%     7.00B ± 0%   ~     (all equal)

name                old allocs/op  new allocs/op  delta
UnsafeStrToBytes-8      0.00           0.00        ~     (all equal)

While at it, also simplify UnsafeBytesToStr implementation, since when
we can pass the slice directly to unsafe.Pointer, instead of getting the
slice header first.
2021-04-19 14:51:05 +01:00
dependabot[bot] 1bb71f85ce
build(deps): bump codecov/codecov-action from v1.3.2 to v1.4.0 (#9136)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from v1.3.2 to v1.4.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v1.3.2...0e28ff86a50029a44d10df6ed4c308711925a6a8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-19 09:30:17 +00:00
Riccardo Montagnin 96fe999343
Set proper default command output (#8628)
* Set proper default command output

* Removed duplicated cmd.SetErr(cmd.ErrOrStderr()) and cmd.SetOut(cmd.OutOrStdout())

* Moved command initialization and added CHANGELOG

* fix: groom all uses of cmd.Print*

* Ran make format

Co-authored-by: Michael FIG <mfig@agoric.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
2021-04-17 00:21:32 +00:00