Skip to content

Missing state->address_step=3; in michelson_read_address? #160

@fishilico

Description

@fishilico

Hello,
While reading the state machine in src/operations.c I am wondering how this code works:

switch (state->address_step) {
case 2:
// Need 1 byte for signature, plus the rest of the hash.
if (state->addr_length != HASH_SIZE + 1) {
PARSE_ERROR();
}
CALL_SUBPARSER(parse_next_type, byte, &(state->subsub_state), sizeof(state->signature_type));
memcpy(&(state->signature_type), &(state->subsub_state.body), sizeof(state->signature_type));
case 3:
CALL_SUBPARSER(parse_next_type, byte, &(state->subsub_state), sizeof(state->key_hash));
memcpy(&(state->key_hash), &(state->subsub_state.body), sizeof(state->key_hash));

More precisely after case 0: ... state->address_step=1; and case 1: ... state->address_step=2;, why is there no state->address_step=3; on line 209, at the end of case 2:? The case block "falls through" into case 3 and then the function returns in CALL_SUBPARSER (line 212). When I add some printf statements in this function to analyze where the flow goes, it seems that the "subparsing" goes back to line 207 instead of line 212 and that the code in lines 213-215 is never executed. Did I understand the code correctly or did I miss something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions