Skip to content

max_reply_size does not account for Complex errors #36

@mkeeter

Description

@mkeeter

When writing a function that returns a Complex error, the error data is returned by serializing it and copying it into the caller's memory.

Right now, we check that caller has provided a large enough buffer here, faulting the caller if they failed us.

However, the generated code for max_reply_size doesn't take Complex errors into account; it only checks the Ok return value.

Given this definition:

        "fancy_error": (
            reply: Result(
                ok: "()",
                err: Complex("FancyNetError"),
            ),
            encoding: Hubpack,
        ),

The generated REPLY_SIZE is simply

pub const FANCY_ERROR_REPLY_SIZE: usize =<() as hubpack::SerializedSize>::MAX_SIZE;

(and this constant is used in the generated max_reply_size).

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