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

invalid_type_inside_abi on block 14363575 #5523

Closed
rmeruane opened this issue Sep 4, 2018 · 4 comments
Closed

invalid_type_inside_abi on block 14363575 #5523

rmeruane opened this issue Sep 4, 2018 · 4 comments

Comments

@rmeruane
Copy link

rmeruane commented Sep 4, 2018

It's impossible to read block 14363575 over HTTP client, all eos nodes fail on that request. I have tested this on local EOSIO 1.2.3 node and also on several public nodes.

curl -X POST -d '{"block_num_or_id":14363575}' https://api.eosnewyork.io/v1/chain/get_block

@taokayan taokayan added the bug label Sep 4, 2018
@taokayan
Copy link
Contributor

taokayan commented Sep 4, 2018

Try this first:

diff --git a/libraries/chain/include/eosio/chain/abi_serializer.hpp b/libraries/chain/include/eosio/chain/abi_serializer.hpp
index 1e5bca6..d53455f 100644
--- a/libraries/chain/include/eosio/chain/abi_serializer.hpp
+++ b/libraries/chain/include/eosio/chain/abi_serializer.hpp
@@ -286,21 +286,25 @@ namespace impl {
          mvo("name", act.name);
          mvo("authorization", act.authorization);
 
-         auto abi = resolver(act.account);
-         if (abi.valid()) {
-            auto type = abi->get_action_type(act.name);
-            if (!type.empty()) {
-               try {
-                  mvo( "data", abi->_binary_to_variant( type, act.data, recursion_depth, deadline, max_serialization_time ));
-                  mvo("hex_data", act.data);
-               } catch(...) {
-                  // any failure to serialize data, then leave as not serailzed
+         try {
+            auto abi = resolver(act.account);
+            if (abi.valid()) {
+               auto type = abi->get_action_type(act.name);
+               if (!type.empty()) {
+                  try {
+                     mvo( "data", abi->_binary_to_variant( type, act.data, recursion_depth, deadline, max_serialization_time ));
+                     mvo("hex_data", act.data);
+                  } catch(...) {
+                     // any failure to serialize data, then leave as not serailzed
+                     mvo("data", act.data);
+                  }
+               } else {
                   mvo("data", act.data);
                }
             } else {
                mvo("data", act.data);
             }
-         } else {
+         } catch(...) {
             mvo("data", act.data);
          }
          out(name, std::move(mvo));

Sample output:

./cleos get block 14363575
{
  "timestamp": "2018-09-02T15:42:32.000",
  "producer": "eoshuobipool",
  "confirmed": 0,
  "previous": "00db2bb61eff8ce5fb2089c4f24d5a2bf5c43b006abe726b4957ddbea3dd568e",
  "transaction_mroot": "6327bfc813f1c78ec24b4376b809c4d0f2fdba4edf258445210d62bb29d640d0",
  "action_mroot": "366748fa9aec3bb408ea3383a780e5e4f34aebaf90f40873258ab806883714fd",
  "schedule_version": 311,
  "new_producers": null,
  "header_extensions": [],
  "producer_signature": "SIG_K1_KjYcKifhnU11ZwrmxmkzoccSAeAxFourHcnAHxqwWPKQfkMkECtrJ91CKQLSbJHkXVTf46XkriBfHhR1bZsXUGQz7TmBrJ",
  "transactions": [{
      "status": "executed",
      "cpu_usage_us": 2740,
      "net_usage_words": 0,
      "trx": "1483cf9d31b0ae40e03c10de7957b2e2446cf6f1689c6fa306e3b1c7cab6e564"
    },{
      "status": "executed",
      "cpu_usage_us": 290,
      "net_usage_words": 0,
      "trx": "ec2d6d1438029a2934594c3ebb04cf6b7fdff305e333d55df0a508c4206eee14"
    },{
      "status": "executed",
      "cpu_usage_us": 2488,
      "net_usage_words": 0,
      "trx": "ff1ad084359a30d018c02403d73bee7fccf165edd66cdb4cecf9adaf1b2d83e8"
    },{
      "status": "executed",
      "cpu_usage_us": 1450,
      "net_usage_words": 18,
      "trx": {
        "id": "6aed3a3564a702225086832510b251f9d825d466070c592bfeceec047370ea67",
        "signatures": [
          "SIG_K1_KbQEstM2h3Wm1no5SDAcCJ5z8za3rz5rAW7GMtoEPC6cBoLxf1Ub2LgNNHsAJspawZ8XjXk1PLXNq77wzB3FH3RNc2TPNz"
        ],
        "compression": "none",
        "packed_context_free_data": "",
        "context_free_data": [],
        "packed_trx": "1e058c5b622a007cb89b000000000100a6823403ea3055000000572d3ccdcd01a09866fa4c9abd6900000000a8ed323231a09866fa4c9abd691082422e65753055204e00000000000004454f53000000001036382d626c6f67796f75726c6966652d00",
        "transaction": {
          "expiration": "2018-09-02T15:43:26",
          "ref_block_num": 10850,
          "ref_block_prefix": 2612558848,
          "max_net_usage_words": 0,
          "max_cpu_usage_ms": 0,
          "delay_sec": 0,
          "context_free_actions": [],
          "actions": [{
              "account": "eosio.token",
              "name": "transfer",
              "authorization": [{
                  "actor": "haytonbuguge",
                  "permission": "active"
                }
              ],
              "data": {
                "from": "haytonbuguge",
                "to": "eosbetdice11",
                "quantity": "2.0000 EOS",
                "memo": "68-blogyourlife-"
              },
              "hex_data": "a09866fa4c9abd691082422e65753055204e00000000000004454f53000000001036382d626c6f67796f75726c6966652d"
            }
          ],
          "transaction_extensions": []
        }
      }
    },{
      "status": "executed",
      "cpu_usage_us": 220,
      "net_usage_words": 12,
      "trx": {
        "id": "a177985044af5762fe3ed671ead3fe2700c1c2518b11c6f6f149cc408bf604c2",
        "signatures": [
          "SIG_K1_KY9pEbyzxNbbs11juCsSkGWTT63cs93pzBc7zaWicipLbwKGgsv6iyQZ4KWArZEecBspyx99LMsoJAXckJbH9a4k7WrNGF"
        ],
        "compression": "none",
        "packed_context_free_data": "",
        "context_free_data": [],
        "packed_trx": "1e058c5b622a007cb89b000000000100118d273a68a64900808ac7e46b54440100118d273a68a64900000000a8ed32320000",
        "transaction": {
          "expiration": "2018-09-02T15:43:26",
          "ref_block_num": 10850,
          "ref_block_prefix": 2612558848,
          "max_net_usage_words": 0,
          "max_cpu_usage_ms": 0,
          "delay_sec": 0,
          "context_free_actions": [],
          "actions": [{
              "account": "danakilblock",
              "name": "cleartable",
              "authorization": [{
                  "actor": "danakilblock",
                  "permission": "active"
                }
              ],
              "data": ""
            }
          ],
          "transaction_extensions": []
        }
      }
    }
  ],
  "block_extensions": [],
  "id": "00db2bb74e3eec1a5d91d5242bb138db5bf0aa72f76fad8c92821a085d9c0b4a",
  "block_num": 14363575,
  "ref_block_prefix": 617976157
}

@mawenpeng
Copy link
Contributor

Seems like same as issue #5519

@eluzgin
Copy link

eluzgin commented Sep 4, 2018

Attaching actual block I retrieved from the log after reproducing the issue.
bad_block.txt

@jgiszczak
Copy link
Contributor

Solution merged and released.

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

No branches or pull requests

5 participants