Skip to content

Conversation

@linh2931
Copy link
Contributor

@linh2931 linh2931 commented Jun 3, 2025

Add support of call trace deserialization into ABI serializer. In particular, add support for deserializing binary fields data and return_value in call_trace.

A deserialized call trace looks like

{
  "call_trace": {
    "call_ordinal": 1,
    "sender_ordinal": 0,
    "receiver": "test",
    "read_only": false,
    "hex_data": "0000000000000019ab1ca3411266697273745f706172616d5f737472696e67",
    "data": {
      "header": {
        "version": 0,
        "func_name": "4729655554853568512"
      },
      "param": "first_param_string"
    },
    "elapsed": 3,
    "console": "console line",
    "console_markers": [
      0
    ],
    "except": null,
    "error_code": null,
    "error_id": null,
    "return_value_hex_data": "64000000",
    "return_value_data": 100
  }
}

Resolves #1220

Depends on CDT AntelopeIO/cdt#353

@linh2931 linh2931 requested review from heifner and spoonincode June 3, 2025 18:52
@linh2931 linh2931 linked an issue Jun 3, 2025 that may be closed by this pull request
@@ -34,114 +34,114 @@ DMLOG START_BLOCK 3
DMLOG CREATION_OP ROOT 0
DMLOG RLIMIT_OP ACCOUNT_USAGE UPD {"owner":"eosio","net_usage":{"last_ordinal":1262304002,"value_ex":0,"consumed":0},"cpu_usage":{"last_ordinal":1262304002,"value_ex":1157,"consumed":101},"ram_usage":2724}
DMLOG TRX_OP CREATE onblock da9fbe9042e1bc9bd64d7a4506534d492107a29f79ad671c1fea19ae3fb70eb4 01e10b5e02005132b41600000000010000000000ea305500000000221acfa4010000000000ea305500000000a8ed32329801013b3d4b0000000000ea30550000000000015ab65a885a31e441ac485ebd2aeba87bf7ee6e7bcc40bf3a24506ba1000000000000000000000000000000000000000000000000000000000000000062267e8b11d7d8f28e1f991a4de2b08cf92500861af2795765bdc9263cd6f4cd000000000001000021010ec7e080177b2c02b278d5088611686b49d739925a92d9bfcacd7fc6b74053bd000000
DMLOG APPLIED_TRANSACTION 3 da9fbe9042e1bc9bd64d7a4506534d492107a29f79ad671c1fea19ae3fb70eb403000000023b3d4b01000000037d8ee5c1ef56cd1e16137e82e35b78d60ab1d5cf659ff8b916867a2f01006400000000000000000000000000000000000000000001010000010000000000ea3055ccfe3b56076237b0b6da2f580652ee1420231b96d3d96b28183769ac932c9e5902000000000000000200000000000000010000000000ea3055020000000000000000000000000000ea30550000000000ea305500000000221acfa4010000000000ea305500000000a8ed32329801013b3d4b0000000000ea30550000000000015ab65a885a31e441ac485ebd2aeba87bf7ee6e7bcc40bf3a24506ba1000000000000000000000000000000000000000000000000000000000000000062267e8b11d7d8f28e1f991a4de2b08cf92500861af2795765bdc9263cd6f4cd000000000001000021010ec7e080177b2c02b278d5088611686b49d739925a92d9bfcacd7fc6b74053bd00000000000000000000da9fbe9042e1bc9bd64d7a4506534d492107a29f79ad671c1fea19ae3fb70eb403000000023b3d4b01000000037d8ee5c1ef56cd1e16137e82e35b78d60ab1d5cf659ff8b916867a2f00000000000000000000
DMLOG APPLIED_TRANSACTION 3 da9fbe9042e1bc9bd64d7a4506534d492107a29f79ad671c1fea19ae3fb70eb403000000023b3d4b01000000038159f32d3c8073a6a2f1ad5aa26e2e804a7815c2b5ef729e84fb803101006400000000000000000000000000000000000000000001010000010000000000ea3055ccfe3b56076237b0b6da2f580652ee1420231b96d3d96b28183769ac932c9e5902000000000000000200000000000000010000000000ea3055020000000000000000000000000000ea30550000000000ea305500000000221acfa4010000000000ea305500000000a8ed32329801013b3d4b0000000000ea30550000000000015ab65a885a31e441ac485ebd2aeba87bf7ee6e7bcc40bf3a24506ba1000000000000000000000000000000000000000000000000000000000000000062267e8b11d7d8f28e1f991a4de2b08cf92500861af2795765bdc9263cd6f4cd000000000001000021010ec7e080177b2c02b278d5088611686b49d739925a92d9bfcacd7fc6b74053bd00000000000000000000da9fbe9042e1bc9bd64d7a4506534d492107a29f79ad671c1fea19ae3fb70eb403000000023b3d4b01000000038159f32d3c8073a6a2f1ad5aa26e2e804a7815c2b5ef729e84fb803100000000000000000000
DMLOG CREATION_OP ROOT 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My guess was that this diff was because of the difference in abi_def. That is indeed the case.
...1736800000000000000
...173680000000000
The difference results in different actions and therefore different action digest and therefore different transaction digest and therefore different block digest.

I verified a block log created by nodeos 1.x with a setabi can be read by nodeos 2.x and also a block log created via nodeos 2.x can be read by a nodeos 1.x.

Therefore, I believe these deep-mind updates are valid.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for verifying this!

linh2931 added 2 commits June 4, 2025 13:52
…bedded in action traces are expanded; add a test to verify that works.
call_data_header data_header;
fc::datastream<const char*> ds( cal_trace.data.data(), cal_trace.data.size() );
fc::raw::unpack( ds, data_header );
std::string fname = eosio::chain::name(data_header.func_name).to_string();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data_header is not guaranteed to exist-- I think this should go within the try block so if the sync call does not have a data_header then you still output the hex_data instead of throwing the exception out. Also do you want to check version in data_header?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Will it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linh2931 linh2931 merged commit b78e911 into sync_call Jun 4, 2025
28 checks passed
@linh2931 linh2931 deleted the abi_support branch June 4, 2025 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SC: Support the new call section in ABI

4 participants