# rollup.finish

Accepts or rejects the previous request, yields the machine, and blocks until the next request arrives. This is the low-level request cycle primitive — [`run`](/cmio/reference/run) calls it for you.

## Usage

```ts twoslash
import { Rollup } from '@deroll/cmio';

const rollup = new Rollup();

const request = rollup.finish({ accept: true });

if (request.type === 'advance') {
    request;
    // ^?
} else {
    request;
    // ^?
}
```

## Returns

`RollupRequest` — a discriminated union, narrowed by `type`:

```ts twoslash
import type { Rollup } from '@deroll/cmio';
// ---cut---
type AdvanceRequest = {
    type: 'advance';
    /** Network chain id. */
    chainId: bigint;
    /** Application contract address (0x-prefixed hex, 20 bytes). */
    appContract: `0x${string}`;
    /** Input sender address (0x-prefixed hex, 20 bytes). */
    msgSender: `0x${string}`;
    /** L1 block number the input was included in. */
    blockNumber: bigint;
    /** L1 block timestamp (UNIX epoch seconds). */
    blockTimestamp: bigint;
    /** RANDAO mix of the post beacon state of the previous block. */
    prevRandao: bigint;
    /** Input index among all inputs ever sent to the application. */
    index: bigint;
    /** Input payload. */
    payload: Buffer;
};

type InspectRequest = {
    type: 'inspect';
    /** Query payload. */
    payload: Buffer;
};
```

## Parameters

### options.accept

* Type: `boolean`
* Default: `true`

Whether to accept the request handled since the previous `finish` call. Inside the machine, rejecting reverts the application state to before that request and discards its outputs.

## Behavior

The call is **synchronous and blocking on purpose**: yielding pauses the entire guest — including Node's event loop — until the next request, so nothing could run concurrently anyway. On the host mock it returns immediately with the next configured input.

## Errors

| Condition | Error |
| --- | --- |
| No more inputs (mock) | `RollupError` with the negative errno in `errno` |
| Device closed | `Error` (`close()` was called) |
