diff --git a/sys-utils/libcmt/src/rollup.c b/sys-utils/libcmt/src/rollup.c index 07e18022..504d8465 100644 --- a/sys-utils/libcmt/src/rollup.c +++ b/sys-utils/libcmt/src/rollup.c @@ -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; } @@ -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);