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

error for "get_block_header_state" #4485

Closed
yankunsam opened this issue Jul 4, 2018 · 16 comments
Closed

error for "get_block_header_state" #4485

yankunsam opened this issue Jul 4, 2018 · 16 comments
Assignees
Labels

Comments

@yankunsam
Copy link
Contributor

cleos get block --header-state   11
Error 3100002: unknown block

@andriantolie
Copy link
Contributor

If you start your nodeos with --verbose-http-errors you will see the above command will give a more detailed error message like this:

$ cleos get block --header-state 11
Error 3100002: unknown block
Error Details:
Could not find reversible block: 11

cleos get block --header-state can't be used once a block is deemed irreversible

@yankunsam
Copy link
Contributor Author

Thanks. So it is expected ? In which case , "--header-state" will be used?

@jgiszczak
Copy link
Contributor

jgiszczak commented Jul 5, 2018

Yes it's expected. --header-state can be used for the most recent ~360 blocks in a fully functioning 21 producer network.

@yankunsam
Copy link
Contributor Author

@jgiszczak 360? It did work for me(eos v1.0.8)

sam@sam-machine:~$ cleos get info
{
  "server_version": "5875549c",
  "chain_id": "c40a90d6bcb4b9b2c2d4c0916ee97a29af42a420372af44fa4f538ddef9e6b83",
  "head_block_num": 2228,
  "last_irreversible_block_num": 2227,
  "last_irreversible_block_id": "000008b351c16d86dbed624a36111cbc091402194a9d908b8c5000c05c699471",
  "head_block_id": "000008b4a7a2da7d7a35834b2fe68ab9cf3ecdcad4c4db761ffb3336d4dbae5c",
  "head_block_time": "2018-07-05T21:20:55.500",
  "head_block_producer": "eosio",
  "virtual_block_cpu_limit": 1852309,
  "virtual_block_net_limit": 9729146,
  "block_cpu_limit": 199900,
  "block_net_limit": 1048576
}
sam@sam-machine:~$ cleos get block --header-state 2226
Error 3100002: unknown block
sam@sam-machine:~$ cleos get info
{
  "server_version": "5875549c",
  "chain_id": "c40a90d6bcb4b9b2c2d4c0916ee97a29af42a420372af44fa4f538ddef9e6b83",
  "head_block_num": 2250,
  "last_irreversible_block_num": 2249,
  "last_irreversible_block_id": "000008c9beb42e8a8819add64951014ce2a28534e79964b5261664201be907f8",
  "head_block_id": "000008ca0f9ee04dc61e75fca610e705fd93fda2f3e17e745b5ca7478a256cb7",
  "head_block_time": "2018-07-05T21:21:06.500",
  "head_block_producer": "eosio",
  "virtual_block_cpu_limit": 1893521,
  "virtual_block_net_limit": 9945656,
  "block_cpu_limit": 199900,
  "block_net_limit": 1048576
}

@jgiszczak
Copy link
Contributor

cleos -u https://api.eosnewyork.io:443 get block --header-state 4356167
{
  "id": "00427847fa25d2ac0267349bf70bfe0498cfc4831f5c20d54e61acce476a31f8",
  "block_num": 4356167,
  "header": {
    "timestamp": "2018-07-05T21:30:43.000",
    "producer": "eosantpoolbp",
    "confirmed": 0,
    "previous": "00427846d0adc6d0ffc39a839555e7fb65f0aa69f1e5736a37d9db52388b2141", 
    "transaction_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
    "action_mroot": "658797e4a636217ff1df049e50c55333438898b18c8d9b8d556e65ef7be2efa8",
    "schedule_version": 109,
    "header_extensions": [],
    "producer_signature": "SIG_K1_KbXqQAhZtJacySTnQW5XQ7Wuyr5bE2mB6Aj8viA6KZUfQre83tWLnQibLQrGAqZ1W6KkYdFBhKAEFjk6CznpV3mfSPPEkK"
  },
  "dpos_proposed_irreversible_blocknum": 4356008,
  "dpos_irreversible_blocknum": 4355840,
  "bft_irreversible_blocknum": 0,
  "pending_schedule_lib_num": 4301434,
  "pending_schedule_hash": "845b24af3804a56f2974335b4e1fe6f2166ec366929290fefe1e2128052c1c6b",
  "pending_schedule": {
    "version": 109,
    "producers": []
  },
  "active_schedule": {
    "version": 109,
    "producers": [{
        "producer_name": "argentinaeos",
        "block_signing_key": "EOS7n4UUEDQRWeJ5UmCf9yqWXY5fsTtbo78HyYa5uBbM1xwa5DwRj"  
      },{

truncated for brevity. It works. Are you using a recently compiled version of both nodeos and cleos?

@yankunsam
Copy link
Contributor Author

yankunsam commented Jul 5, 2018

Yes. Both of them are v1.0.8.

sam@sam-machine:/media/sam/work/fork/oasis-eos/eos/build$ cleos version client
Build version: 5875549c
sam@sam-machine:/media/sam/work/fork/oasis-eos/eos/build$ cleos -u https://api.eosnewyork.io:443 get block --header-state 4356167
Error 3100002: unknown block
sam@sam-machine:/media/sam/work/fork/oasis-eos/eos/build$

@jgiszczak
Copy link
Contributor

Yes of course your attempt to retrieve that mainnet block failed. After 30 minutes, 4356167 had long since turned irreversible. Run cleos -u https://api.eosnewyork.io:443 get info to find out the head block, then request a recent enough block number. You should get a valid response.

@yankunsam
Copy link
Contributor Author

Yes. I got it.

sam@sam-machine:/media/sam/work/fork/oasis-eos/eos/build$ cleos -u https://api.eosnewyork.io:443 get block --header-state 4363820
{
  "id": "0042962cd05b3583892e896b379ea079c78c3deb5e75c74b1242c30edd4d2937",
  "block_num": 4363820,
  "header": {
    "timestamp": "2018-07-05T22:34:29.500",
    "producer": "eosliquideos",
    "confirmed": 0,
    "previous": "0042962b9c848893fcfca3d1e2078d88adc631707251e46ccf683f7f13a27e27",
    "transaction_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
    "action_mroot": "5010d8ceda20df29a8d5dd0108428e4d150846c3ded7ef7988b11e078e91ecc7",
    "schedule_version": 109,
    "header_extensions": [],
    "producer_signature": "SIG_K1_Kgw5SQHsvjr49PdchQZYvuPCe5gnvsaTzErFZGhRPArak6W3uxW4c9wZ1GV2fAtErQZwjzn3AyMU8oEtST8y7vR3bQo9QE"
  },
  "dpos_proposed_irreversible_blocknum": 4363652,
  "dpos_irreversible_blocknum": 4363484,
  "bft_irreversible_blocknum": 0,
  "pending_schedule_lib_num": 4301434,
  "pending_schedule_hash": "845b24af3804a56f2974335b4e1fe6f2166ec366929290fefe1e2128052c1c6b",
  "pending_schedule": {
    "version": 109,
    "producers": []
  },

But why it does not work for my local network. I also use the "get info" to find out the head block.

@jgiszczak
Copy link
Contributor

Have you fully bootstrapped your local network, including creating the needed system accounts and installing the eosio.system contract?

@yankunsam
Copy link
Contributor Author

Yes. I set the bios token system contract and also create system account like eosio.msig...

@jgiszczak
Copy link
Contributor

I don't know what to tell you. I've never managed to get my local node into a state where it's unable to answer get block --header-state queries. I suggest verifying everything, from accounts and contracts to healthy block production. Something isn't in the state you think it's in.

@andriantolie
Copy link
Contributor

I copied the following snippet from your previous comments:

sam@sam-machine:~$ cleos get info
{
  "server_version": "5875549c",
  "chain_id": "c40a90d6bcb4b9b2c2d4c0916ee97a29af42a420372af44fa4f538ddef9e6b83",
  "head_block_num": 2228,
  "last_irreversible_block_num": 2227,
  "last_irreversible_block_id": "000008b351c16d86dbed624a36111cbc091402194a9d908b8c5000c05c699471",
  "head_block_id": "000008b4a7a2da7d7a35834b2fe68ab9cf3ecdcad4c4db761ffb3336d4dbae5c",
  "head_block_time": "2018-07-05T21:20:55.500",
  "head_block_producer": "eosio",
  "virtual_block_cpu_limit": 1852309,
  "virtual_block_net_limit": 9729146,
  "block_cpu_limit": 199900,
  "block_net_limit": 1048576
}
sam@sam-machine:~$ cleos get block --header-state 2226
Error 3100002: unknown block
sam@sam-machine:~$ cleos get info
{
  "server_version": "5875549c",
  "chain_id": "c40a90d6bcb4b9b2c2d4c0916ee97a29af42a420372af44fa4f538ddef9e6b83",
  "head_block_num": 2250,
  "last_irreversible_block_num": 2249,
  "last_irreversible_block_id": "000008c9beb42e8a8819add64951014ce2a28534e79964b5261664201be907f8",
  "head_block_id": "000008ca0f9ee04dc61e75fca610e705fd93fda2f3e17e745b5ca7478a256cb7",
  "head_block_time": "2018-07-05T21:21:06.500",
  "head_block_producer": "eosio",
  "virtual_block_cpu_limit": 1893521,
  "virtual_block_net_limit": 9945656,
  "block_cpu_limit": 199900,
  "block_net_limit": 1048576
}

If the above snippet is what you mean by not working in your local node, it's because you are trying to query header state of an irreversible block. Notice that your last irreversible block is 2227 there and you query block 2226, which for sure has been deemed irreversible. If you only have one producer in your local node, your last irreversible block is just one block behind your head block, so you can only use --header-state on your head block.

@yankunsam
Copy link
Contributor Author

@andriantolie So you mean that "cleos get block --header-state " only works for other node that did behind a lot of blocks? And it is useful for 21 super block producer network?

@andriantolie
Copy link
Contributor

That's not exactly what I mean, theoretically, you can also do it in your node if you call it by passing the head block num before the next block is produced (which means you only have less than 500ms to do it). However, normally a chain has 21 block producers, so you can normally call it for the most recent ~360 blocks.

@yankunsam
Copy link
Contributor Author

@andriantolie Thanks. :)

@riccardopersiani
Copy link

Is there a way to get block_header_state for the past blocks as well?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants