How would one go about validating the data from the block header of a return data value action? It seems like a cool feature, but you'd need a full history node to validate wouldn't you?
1 Answer
In block header, you can find action_mroot
. action_mroot
is the root hash of merkle tree of action_receipt
s. action_receipt
contains act_digest
, and act_digest
is constructed by hashing action
itself and action_return_value
.
You can validate action_return_value
by comparing the hash value (of action and its return value) and act_digest
in action receipt.
// eos/libraries/chain/apply_context.cpp
act_digest = generate_action_digest(
[this](const char* data, uint32_t datalen) {
return trx_context.hash_with_checktime<digest_type>(data, datalen);
},
*act,
action_return_value // here
);