Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Problem: light client doesn't verify the fetched staking state #1313

Closed
tomtau opened this issue Mar 27, 2020 · 4 comments
Closed

Problem: light client doesn't verify the fetched staking state #1313

tomtau opened this issue Mar 27, 2020 · 4 comments
Assignees
Milestone

Comments

@tomtau
Copy link
Contributor

tomtau commented Mar 27, 2020

  1. abci query when "proof=true" should return the inclusion proof for the queried state: https://docs.tendermint.com/master/spec/abci/abci.html#query validators don't need to store this, but full nodes for (historical) querying may need to extend the storage of app_hash=>height, app_hash=>(height, trie root) unless it's already done
  2. light client should keep track of the state trie root (and app hash?) from sync, so that it can verify the inclusion proof
yihuang added a commit to yihuang/chain that referenced this issue Apr 22, 2020
…d staking state

Solution:
- Support query merkle inclusion proof
- Also support query historical staking state
- Query json encoded staking from abci_query directly crypto-com#1464
yihuang added a commit to yihuang/chain that referenced this issue Apr 22, 2020
…d staking state

Solution:
- Support query merkle inclusion proof
- Also support query historical staking state
- Query json encoded staking from abci_query directly crypto-com#1464
yihuang added a commit to yihuang/chain that referenced this issue Apr 22, 2020
…d staking state

Solution:
- Support query merkle inclusion proof
- Also support query historical staking state
- Query json encoded staking from abci_query directly crypto-com#1464
yihuang added a commit to yihuang/chain that referenced this issue Apr 22, 2020
…d staking state

Solution:
- Support query merkle inclusion proof
- Also support query historical staking state
- Query json encoded staking from abci_query directly crypto-com#1464
@tomtau tomtau added this to the CRO Sprint 29 milestone Apr 22, 2020
yihuang added a commit to yihuang/chain that referenced this issue Apr 22, 2020
…d staking state

Solution:
- Support query merkle inclusion proof
- Also support query historical staking state
- Query json encoded staking from abci_query directly crypto-com#1464
yihuang added a commit to yihuang/chain that referenced this issue Apr 22, 2020
…d staking state

Solution:
- Support query merkle inclusion proof
- Also support query historical staking state
- Query json encoded staking from abci_query directly crypto-com#1464
yihuang added a commit to yihuang/chain that referenced this issue Apr 23, 2020
…d staking state

Solution:
- Support query merkle inclusion proof
- Also support query historical staking state
- Query json encoded staking from abci_query directly crypto-com#1464
bors bot added a commit that referenced this issue Apr 23, 2020
1458: Problem (Fix #1457): No mock mode for developing on non-sgx platform r=tomtau a=yihuang

Solution:
- Add mock mode

The basic idea is described in #1457.

1466: Problem (WIP #1313): light client doesn't verify the fetched staking state r=tomtau a=yihuang

Solution:
- Support query merkle inclusion proof
- Also support query historical staking state
- Query json encoded staking from abci_query directly #1464

This feature(query historical staked state) is also needed to make the reward integration tests more stable.
Added a new abci_query path "staking" which is like "account", but it returns JSON directly, also support the new features (historical query, proof), the next step will be update the "staking_state" API in client-rpc and client-cli to use the new one.

Co-authored-by: yihuang <[email protected]>
@yihuang
Copy link
Collaborator

yihuang commented Apr 24, 2020

Proposal:

  • Query staking state with client-rpc/client-cli will verify the proof by default.

    Only support query staking state at the latest block height of last synced, the proof is verified against the recent synced state.

  • If you want to query staking state at arbitrary historical block height or most recent height, you can simply call abci_query directly, if you want to verify the proof in this case, you need to do it on your own (get a trusted merkle root hash at the same height first).

@leejw51crypto
Copy link
Collaborator

but verification needs whole trie,
how about delegating to the full node?

@yihuang
Copy link
Collaborator

yihuang commented Apr 24, 2020

but verification needs whole trie,
how about delegating to the full node?

It verifies the Merkel proof against the root hash in chain state.

@tomtau
Copy link
Contributor Author

tomtau commented Apr 24, 2020

but verification needs whole trie,
how about delegating to the full node?

it doesn't need it -- that's the point of a "light client"... It only needs to know the validator set + "root" (embedded in app hash) and be given the merkle proof from the leaf to the root

yihuang added a commit to yihuang/chain that referenced this issue Apr 28, 2020
…d staking state

Solution:
- Add staking_root in sync state
- Verify staking and proof against the trusted staking_root in sync state
yihuang added a commit to yihuang/chain that referenced this issue Apr 29, 2020
…d staking state

Solution:
- Add staking_root in sync state
- Verify staking and proof against the trusted staking_root in sync state
yihuang added a commit to yihuang/chain that referenced this issue Apr 29, 2020
…d staking state

Solution:
- Add staking_root in sync state
- Verify staking and proof against the trusted staking_root in sync state
yihuang added a commit to yihuang/chain that referenced this issue Apr 29, 2020
…d staking state

Solution:
- Add staking_root in sync state
- Remove the "account" path in favor of the new "staking" path
- Client staking state command add wallet name parameter,
  and verify staking state and proof against the trusted staking_root in sync state
- Need to sync wallet before fetching the new staking state now.
yihuang added a commit to yihuang/chain that referenced this issue Apr 29, 2020
…d staking state

Solution:
- Add staking_root in sync state
- Remove the "account" path in favor of the new "staking" path
- Client staking state command add wallet name parameter,
  and verify staking state and proof against the trusted staking_root in sync state
- Need to sync wallet before fetching the new staking state now.
yihuang added a commit to yihuang/chain that referenced this issue Apr 29, 2020
…d staking state

Solution:
- Add staking_root in sync state
- Remove the "account" path in favor of the new "staking" path
- Client staking state command add wallet name parameter,
  and verify staking state and proof against the trusted staking_root in sync state
- Need to sync wallet before fetching the new staking state now.
yihuang added a commit to yihuang/chain that referenced this issue Apr 30, 2020
…d staking state

Solution:
- Add staking_root in sync state
- Remove the "account" path in favor of the new "staking" path
- Client staking state command add wallet name parameter,
  and verify staking state and proof against the trusted staking_root in sync state
- Need to sync wallet before fetching the new staking state now.
yihuang added a commit to yihuang/chain that referenced this issue Apr 30, 2020
…d staking state

Solution:
- Add staking_root in sync state
- Remove the "account" path in favor of the new "staking" path
- Client staking state command add wallet name parameter,
  and verify staking state and proof against the trusted staking_root in sync state
- Need to sync wallet before fetching the new staking state now.
bors bot added a commit that referenced this issue May 1, 2020
1511: Problem (Fix #1313): light client doesn't verify the fetched staking state r=tomtau a=yihuang

Solution:
- Add staking_root in sync state
- Remove the "account" path in favor of the new "staking" path
- Client staking state command add wallet name parameter,
  and verify staking state and proof against the trusted staking_root in sync state
- Need to sync wallet before fetching the new staking state now. (you can still get any staking state without verification by request abci_query API directly)

1516: Problem (Fix #1515): unbond tx don't subtract fee from bonded r=tomtau a=yihuang

Solution:
- Fix the bug and add unit test


Co-authored-by: yihuang <[email protected]>
bors bot added a commit that referenced this issue May 1, 2020
1511: Problem (Fix #1313): light client doesn't verify the fetched staking state r=tomtau a=yihuang

Solution:
- Add staking_root in sync state
- Remove the "account" path in favor of the new "staking" path
- Client staking state command add wallet name parameter,
  and verify staking state and proof against the trusted staking_root in sync state
- Need to sync wallet before fetching the new staking state now. (you can still get any staking state without verification by request abci_query API directly)

Co-authored-by: yihuang <[email protected]>
yihuang added a commit to yihuang/chain that referenced this issue May 1, 2020
…d staking state

Solution:
- Add staking_root in sync state
- Remove the "account" path in favor of the new "staking" path
- Client staking state command add wallet name parameter,
  and verify staking state and proof against the trusted staking_root in sync state
- Need to sync wallet before fetching the new staking state now.
yihuang added a commit to yihuang/chain that referenced this issue May 1, 2020
…d staking state

Solution:
- Add staking_root in sync state
- Remove the "account" path in favor of the new "staking" path
- Client staking state command add wallet name parameter,
  and verify staking state and proof against the trusted staking_root in sync state
- Need to sync wallet before fetching the new staking state now.
yihuang added a commit to yihuang/chain that referenced this issue May 3, 2020
…d staking state

Solution:
- Add staking_root in sync state
- Remove the "account" path in favor of the new "staking" path
- Client staking state command add wallet name parameter,
  and verify staking state and proof against the trusted staking_root in sync state
- Need to sync wallet before fetching the new staking state now.
bors bot added a commit that referenced this issue May 5, 2020
1511: Problem (Fix #1313): light client doesn't verify the fetched staking state r=tomtau a=yihuang

Solution:
- Add staking_root in sync state
- Remove the "account" path in favor of the new "staking" path
- Client staking state command add wallet name parameter,
  and verify staking state and proof against the trusted staking_root in sync state
- Need to sync wallet before fetching the new staking state now. (you can still get any staking state without verification by request abci_query API directly)

Co-authored-by: yihuang <[email protected]>
@bors bors bot closed this as completed in aef3d47 May 5, 2020
tomtau added a commit that referenced this issue May 20, 2020
Problem (Fix #1621): Can't deposit into other's new staking address

Solution:
- Remove the restriction from client network ops code
- Add check and double confirmation in client-cli

Problem (#1483): client-rpc library and server dependencies are mixed
Solution:
- Seperate them, less dependencies in client-rpc library

Problem (Fix #1313): light client doesn't verify the fetched staking …
…state

Solution:
- Add staking_root in sync state
- Remove the "account" path in favor of the new "staking" path
- Client staking state command add wallet name parameter,
  and verify staking state and proof against the trusted staking_root in sync state
- Need to sync wallet before fetching the new staking state now.
allthatjazzleo pushed a commit to allthatjazzleo/chain that referenced this issue May 28, 2020
…d staking state

Solution:
- Support query merkle inclusion proof
- Also support query historical staking state
- Query json encoded staking from abci_query directly crypto-com#1464
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants