Finschia / ostracon

Ostracon, a consensus algorithm, is forked from Tendermint Core. We have added VRF to Tendermint BFT. It adds randomness to PoS Validator elections and improves security.
Apache License 2.0
70 stars 28 forks source link

fix: Improve mocks generation #604

Closed kokeshiM0chi closed 1 year ago

kokeshiM0chi commented 1 year ago

Description

Mockery was supposed to be installed in the local environment, but that assumption is not necessarily guaranteed. It is something that a repository should guarantee.

In this PR, a fix was made to manage the mockery package with go.mod and execute it directly with script.

The path is specified as a relative path according to Tendermint as follows. The reason is to avoid conflicts during backporting.

Ex.

//go:generate ../scripts/mockery_generate.sh [interface name]

This PR exists in tendermint/tendermint, but since Go 1.17 we can go run external packages directly, so we don't need to use docker.

Main: https://github.com/tendermint/tendermint/pull/9094

Two Mockery improvement PR exist in the 34.x version, but cherry-pick is not desirable because it includes more than just Mock changes.

https://github.com/tendermint/tendermint/pull/8863 https://github.com/tendermint/tendermint/pull/9114

This PR is for making Mockery work correctly.

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

codecov[bot] commented 1 year ago

Codecov Report

Merging #604 (5496309) into main (c80f1b7) will decrease coverage by 0.06%. The diff coverage is 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #604 +/- ## ========================================== - Coverage 66.31% 66.25% -0.06% ========================================== Files 277 277 Lines 36969 36969 ========================================== - Hits 24515 24494 -21 - Misses 10688 10713 +25 + Partials 1766 1762 -4 ``` | [Impacted Files](https://app.codecov.io/gh/Finschia/ostracon/pull/604?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia) | Coverage Δ | | |---|---|---| | [abci/client/client.go](https://app.codecov.io/gh/Finschia/ostracon/pull/604?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia#diff-YWJjaS9jbGllbnQvY2xpZW50Lmdv) | `80.85% <ø> (ø)` | | | [abci/client/grpc\_client.go](https://app.codecov.io/gh/Finschia/ostracon/pull/604?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia#diff-YWJjaS9jbGllbnQvZ3JwY19jbGllbnQuZ28=) | `69.37% <ø> (ø)` | | | [abci/client/local\_client.go](https://app.codecov.io/gh/Finschia/ostracon/pull/604?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia#diff-YWJjaS9jbGllbnQvbG9jYWxfY2xpZW50Lmdv) | `99.20% <ø> (ø)` | | | [abci/client/socket\_client.go](https://app.codecov.io/gh/Finschia/ostracon/pull/604?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia#diff-YWJjaS9jbGllbnQvc29ja2V0X2NsaWVudC5nbw==) | `72.96% <ø> (ø)` | | | [abci/example/kvstore/helpers.go](https://app.codecov.io/gh/Finschia/ostracon/pull/604?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia#diff-YWJjaS9leGFtcGxlL2t2c3RvcmUvaGVscGVycy5nbw==) | `100.00% <ø> (ø)` | | | [abci/example/kvstore/kvstore.go](https://app.codecov.io/gh/Finschia/ostracon/pull/604?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia#diff-YWJjaS9leGFtcGxlL2t2c3RvcmUva3ZzdG9yZS5nbw==) | `73.83% <ø> (ø)` | | | [abci/example/kvstore/persistent\_kvstore.go](https://app.codecov.io/gh/Finschia/ostracon/pull/604?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia#diff-YWJjaS9leGFtcGxlL2t2c3RvcmUvcGVyc2lzdGVudF9rdnN0b3JlLmdv) | `50.00% <ø> (ø)` | | | [abci/types/application.go](https://app.codecov.io/gh/Finschia/ostracon/pull/604?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia#diff-YWJjaS90eXBlcy9hcHBsaWNhdGlvbi5nbw==) | `0.00% <ø> (ø)` | | | [abci/types/pubkey.go](https://app.codecov.io/gh/Finschia/ostracon/pull/604?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia#diff-YWJjaS90eXBlcy9wdWJrZXkuZ28=) | `0.00% <ø> (ø)` | | | [behaviour/peer\_behaviour.go](https://app.codecov.io/gh/Finschia/ostracon/pull/604?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia#diff-YmVoYXZpb3VyL3BlZXJfYmVoYXZpb3VyLmdv) | `75.00% <ø> (ø)` | | | ... and [118 more](https://app.codecov.io/gh/Finschia/ostracon/pull/604?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia) | | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/Finschia/ostracon/pull/604/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia)