Skip to content

Commit

Permalink
fix read inspect in libcmt
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmikhalevich committed Mar 25, 2024
1 parent 635f996 commit 763b954
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions sys-utils/libcmt/src/rollup.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,17 @@ int cmt_rollup_read_inspect_state(cmt_rollup_t *me, cmt_rollup_inspect_t *inspec
}
if (!inspect) {
return -EINVAL;
}
cmt_buf_t rx[1] = {cmt_io_get_rx(me->io)};
inspect->payload_length = cmt_buf_length(rx);
inspect->payload = rx->begin;

cmt_buf_t rd[1] = {cmt_io_get_rx(me->io)};
cmt_buf_t st[1] = {{rd->begin + 4, rd->end}}; // EVM offsets are from after funsel
cmt_buf_t of[1];

size_t payload_length = 0;
if (DBG(cmt_abi_check_funsel(rd, EVM_INSPECT)) ||
DBG(cmt_abi_get_bytes_s(rd, of)) ||
DBG(cmt_abi_get_bytes_d(st, of, &payload_length, &inspect->payload)))
return -ENOBUFS;
inspect->payload_length = payload_length;
return 0;
}

Expand Down Expand Up @@ -288,7 +295,13 @@ int cmt_rollup_finish(cmt_rollup_t *me, cmt_rollup_finish_t *finish) {
}

if (!finish->accept_previous_request) {
<<<<<<< HEAD
return revert(me->io); /* revert should not return! */
=======
revert(me->io);
/* revert should not return! */
return -ECANCELED;
>>>>>>> 4e40b83 (fix read inspect in libcmt)
}

cmt_merkle_get_root_hash(me->merkle, cmt_io_get_tx(me->io).begin);
Expand Down

0 comments on commit 763b954

Please sign in to comment.