Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

light client cannot work when the number of validators is equal 100 #6010

Closed
chengwenxi opened this issue Jan 29, 2021 · 0 comments · Fixed by #6022
Closed

light client cannot work when the number of validators is equal 100 #6010

chengwenxi opened this issue Jan 29, 2021 · 0 comments · Fixed by #6022
Assignees
Labels
C:light Component: Light T:bug Type Bug (Confirmed)

Comments

@chengwenxi
Copy link

chengwenxi commented Jan 29, 2021

Tendermint version (use tendermint version or git rev-parse --verify HEAD if installed from source):

unreleased-master-b1646e51e263d579b4cc522668b4a2b81c1f56bd(v0.34.*)

What happened:

If the number of validators is equal 100(defined by maxPerPage), the light client cannot work.

How to reproduce it

  • Option 1: Modify maxPerPage to 1 and run a network with one validator, https://github.com/chengwenxi/tendermint/tree/vincent-maxPerPage-1

    1. run a testnet network

      tendermint testnet --v 1
      tendermint node --home mytestnet/node0/ --proxy-app kvstore
    2. run a light client proxy server

      tendermint light chain-98I3B2 -p http://localhost:26657 --height 102 --hash 68778AD7342039B2DC46047B8221DAECCE0E2F663AEA16EFD51F94BF7A72DF26 -w http://localhost:26657

    It will be stuck for a long time and then return the following error:

    I[2021-01-29|16:16:45.341] Removing all light blocks                    
    I[2021-01-29|16:16:45.347] Downloading trusted light block using options 
    ERROR: client failed to respond. Tried to replace primary but: no witnesses connected. please reset light client
    
  • Option 2: Use an existing network with 100 validators. The IRISnet bifrost testnet that based on tendermint@v0.34.1 and the validators has reached 100, we can access it by public node 34.80.22.255:26657.

    tendermint light bifrost-2 -p http://34.80.22.255:26657 --height 140150 --hash 0401E3281401DEFBFCCAF650B98A950282A7043AC5962331ECD02ADD8A2D56F5 -w http://34.80.22.255:26657

    It returns the same error as Option 1.

Why happened:

In function validatorSet,
we retry call p.client.Validators to get all validators by pages, if the len(validatorSet) = maxPerPage, p.client.Validators will return page should be within [1, {total_page}] range, ​{page}, see https://github.com/tendermint/tendermint/blob/master/rpc/core/env.go#L111.

Proposal

Minor fix: ignore this error in function validatorSet.

@melekes melekes added C:light Component: Light T:bug-unconfirmed Type Bug (has been reported but not verified or triaged) labels Feb 1, 2021
@melekes melekes self-assigned this Feb 1, 2021
@melekes melekes added T:bug Type Bug (Confirmed) and removed T:bug-unconfirmed Type Bug (has been reported but not verified or triaged) labels Feb 1, 2021
melekes added a commit that referenced this issue Feb 1, 2021
also, restrict the number of pages to avoid iterating forever

Closes #6010
melekes added a commit that referenced this issue Feb 1, 2021
also, restrict the number of pages to avoid iterating forever

Closes #6010

- rpc/client: change timeout type to be time.Duration in NewWithTimeout
- light/provider/http: set 5s timeout for all requests to avoid blocking forever
@mergify mergify bot closed this as completed in #6022 Feb 1, 2021
mergify bot pushed a commit that referenced this issue Feb 1, 2021
melekes added a commit that referenced this issue Feb 1, 2021
melekes added a commit that referenced this issue Feb 4, 2021
melekes added a commit that referenced this issue Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:light Component: Light T:bug Type Bug (Confirmed)
Projects
None yet
2 participants