Problem: client can't trust validators field in genesis api (CRO-101)#584
Conversation
3a275f7 to
4ca1a18
Compare
Merge conflict (retrying...) |
4ca1a18 to
d0d5aab
Compare
Canceled |
|
Fixed the failed tests. |
|
🔒 Permission denied Existing reviewers: click here to make yihuang a reviewer |
Codecov Report
@@ Coverage Diff @@
## master #584 +/- ##
==========================================
- Coverage 67.42% 67.32% -0.11%
==========================================
Files 125 125
Lines 14700 14671 -29
==========================================
- Hits 9912 9877 -35
- Misses 4788 4794 +6
|
d0d5aab to
0c40b8e
Compare
|
bors r+ |
579: Problem:(CRO-574) integration test cannot run on linux r=tomtau a=leejw51crypto Solution: add fixes for linux fix env error add sudo 580: Bump unicase from 2.5.1 to 2.6.0 r=tomtau a=dependabot-preview[bot] Bumps [unicase](https://github.com/seanmonstar/unicase) from 2.5.1 to 2.6.0. <details> <summary>Release notes</summary> *Sourced from [unicase's releases](https://github.com/seanmonstar/unicase/releases).* > ## v2.6.0 > - Fix `UniCase::eq` in Unicode mode so that it doesn't equal a substring of the other. > - Make crate `no_std`. </details> <details> <summary>Commits</summary> - [`7b116bc`](seanmonstar/unicase@7b116bc) v2.6.0 - [`c14856b`](seanmonstar/unicase@c14856b) Fix Unicode::eq to not equal when one side is a substring of the other ([#39](https://github-redirect.dependabot.com/seanmonstar/unicase/issues/39)) - [`4788cba`](seanmonstar/unicase@4788cba) update version_check - [`fbab380`](seanmonstar/unicase@fbab380) Implement no_std support ([#34](https://github-redirect.dependabot.com/seanmonstar/unicase/issues/34)) - See full diff in [compare view](seanmonstar/unicase@v2.5.1...v2.6.0) </details> <br /> [](https://dependabot.com/compatibility-score.html?dependency-name=unicase&package-manager=cargo&previous-version=2.5.1&new-version=2.6.0) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language - `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com): - Update frequency (including time of day and day of week) - Pull request limits (per update run and/or open at any time) - Out-of-range updates (receive only lockfile updates, if desired) - Security updates (receive only security updates, if desired) </details> 584: Problem: client can't trust validators field in genesis api (CRO-101) r=tomtau a=yihuang Solution: Validate validators in ``RequestInitChain``, make sure the consistency. Co-authored-by: jongwhan lee <leejw51@gmail.com> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: yihuang <huang@crypto.com>
Build failed (retrying...) |
580: Bump unicase from 2.5.1 to 2.6.0 r=tomtau a=dependabot-preview[bot] Bumps [unicase](https://github.com/seanmonstar/unicase) from 2.5.1 to 2.6.0. <details> <summary>Release notes</summary> *Sourced from [unicase's releases](https://github.com/seanmonstar/unicase/releases).* > ## v2.6.0 > - Fix `UniCase::eq` in Unicode mode so that it doesn't equal a substring of the other. > - Make crate `no_std`. </details> <details> <summary>Commits</summary> - [`7b116bc`](seanmonstar/unicase@7b116bc) v2.6.0 - [`c14856b`](seanmonstar/unicase@c14856b) Fix Unicode::eq to not equal when one side is a substring of the other ([#39](https://github-redirect.dependabot.com/seanmonstar/unicase/issues/39)) - [`4788cba`](seanmonstar/unicase@4788cba) update version_check - [`fbab380`](seanmonstar/unicase@fbab380) Implement no_std support ([#34](https://github-redirect.dependabot.com/seanmonstar/unicase/issues/34)) - See full diff in [compare view](seanmonstar/unicase@v2.5.1...v2.6.0) </details> <br /> [](https://dependabot.com/compatibility-score.html?dependency-name=unicase&package-manager=cargo&previous-version=2.5.1&new-version=2.6.0) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language - `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com): - Update frequency (including time of day and day of week) - Pull request limits (per update run and/or open at any time) - Out-of-range updates (receive only lockfile updates, if desired) - Security updates (receive only security updates, if desired) </details> 584: Problem: client can't trust validators field in genesis api (CRO-101) r=tomtau a=yihuang Solution: Validate validators in ``RequestInitChain``, make sure the consistency. Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: yihuang <huang@crypto.com>
Build failed (retrying...) |
Build failed |
tomtau
left a comment
There was a problem hiding this comment.
seems the chain-abci crashes in integration test due to validators not being consistent -- i think it's because tendermint init is called multiple times to create "genesis.json", from the first one, it takes the pubkey value used in app_data... and it appends it the same app_data (+ copies the validator key). it's ok if the node was the where tendermint init was called, but it'd fail with a different node, as the validators field may be different.
so i guess updating the prepare.sh of integration tests may be necessary -- @calvinaco @calvinlauco is that correct?
prepare script run |
0c40b8e to
1221188
Compare
|
Moved tests in |
|
I think the inconsistent validator is because of the voting power difference: |
Solution: Validate validators in RequestInitChain, make sure the consistency.
1221188 to
93a809b
Compare
|
Integration testing |
@yihuang |
Actually, it may be even better to update in |
But currently, dev-utils only output |
Yes, this requires user to update power in But the quick fix I am working on will update the |
I just wrote a python script, i don't know how to do this in bash ;D $ cat integration-tests/fix_genesis.py
import sys
import base64
import hashlib
import json
GENESIS = json.load(open(sys.argv[1]))
def get_voting_power(state):
cointype, coin = state
assert cointype == 'Bonded'
return str(int(int(coin) / (10 ** 8)))
def validator_addr(pubkey_base64):
return hashlib.sha256(base64.b64decode(pubkey_base64)).hexdigest().upper()[:40]
GENESIS['validators'] = [
{
'address': validator_addr(node[2]['consensus_pubkey_b64']),
'pub_key': {
'type': 'tendermint/PubKeyEd25519',
'value': node[2]['consensus_pubkey_b64'],
},
'power': get_voting_power(GENESIS['app_state']['distribution'][addr]),
}
for addr, node in GENESIS['app_state']['council_nodes'].items()
]
json.dump(GENESIS, open(sys.argv[1], 'w'), indent=4) |
Awesome! Let's use this script first 😜 |
Solution: Add a python script to modify validates according to app_state.
|
bors try |
tryBuild succeeded |
Build failed |
|
the failed build seems related to this: #595 |
|
bors retry |
584: Problem: client can't trust validators field in genesis api (CRO-101) r=tomtau a=yihuang Solution: Validate validators in ``RequestInitChain``, make sure the consistency. 586: Problem:(CRO-540) syncing does not work in HD wallet r=tomtau a=leejw51 Solution: add private, public keys to storage Co-authored-by: yihuang <huang@crypto.com> Co-authored-by: jongwhan lee <leejw51@gmail.com>
Solution:
Validate validators in
RequestInitChain, make sure the consistency.