block

type block

A test block builder; i.e. a builder for test blockchain blocks.

A test block consists of a list of test transactions that are executed when the block is built. A test transaction consists of a list of test operation calls, and a list of signing keypairs.

Test block timestamps

The timestamps of Rell test blocks are deterministic, and determined by the following rules:

  1. If the next block's timestamp was set explicitly via rell.test.set_next_block_time() or rell.test.set_next_block_time_delta(), that timestamp is used for the next block, and is then discarded (and will not be used by subsequent blocks).

  2. If the next block's timestamp was not set explicitly, and there is a previous block, the next block's timestamp is the timestamp of the previous block plus the block interval (rell.test.block_interval, which can be set with rell.test.set_block_interval()).

  3. If the next block's timestamp was not set explicitly, and there is no previous block, the timestamp of the next (and first) block will be 2020-01-01 00:00:00 UTC.

Since

0.10.4

See also

Constructors

Link copied to clipboard
constructor(txs: list<rell.test.tx>)

Construct a test block builder from the specified list of transactions.

constructor(txs: rell.test.tx...)

Construct a test block builder from the specified transactions.

constructor(ops: list<rell.test.op>)

Construct a test block builder with a single test transaction consisting of the specified list of test operation calls.

constructor(ops: rell.test.op...)

Construct a test block builder with a single test transaction consisting of the specified test operation calls.

Functions

Link copied to clipboard
function copy(): rell.test.block

Copy this test block builder.

Link copied to clipboard
function run()

Build a test block from this test block builder.

Link copied to clipboard

Build a test block from this test block builder, asserting that the building fails (i.e. throws an exception).

Typically used to test operation calls that must throw an exception.

function run_must_fail(expected_message: text): rell.test.failure

Build a test block from this test block builder, asserting that the building fails; i.e. throws an exception; with the given exception message.

Typically used to test operation calls that must throw an exception.

Link copied to clipboard

Add a single test transaction to this test block builder; the test transaction consisting of the specified list of test operation calls.

Add a list of test transactions to this test block builder.

function tx(ops: rell.test.op...): rell.test.block

Add a single test transaction to this test block builder; the test transaction consisting of the specified test operation calls.

function tx(txs: rell.test.tx...): rell.test.block

Add test transactions to this test block builder.