Skip to main content

rell.test

rell.test namespace provides types and functions for creating, manipulating, and executing test blocks and transactions, as well as asserting their expected behavior.

Test block, transaction, and operation types

  • rell.test.block: Represents a Rell block for testing purposes.
  • rell.test.tx: Represents a Rell transaction for testing purposes.
  • rell.test.op: Represents a Rell operation within a transaction for testing purposes.

Structures

rell.test.keypair

A struct containing a public and private keypair for signing transactions with.

constuctor(pub: byte_array, priv: byte_array)

Properties

  • val pub: byte_array - the public key of this keypair
  • val priv: byte_array - the private key of this keypair

Constants

rell.test.keypairs

The test framework contains the following predefined rell.test.keypair:

rell.test.keypairs.{bob, alice, trudy, charlie, dave, eve, frank, grace, heidi}: rell.test.keypair

rell.test.pubkeys

The test framework contains the following predefined public keys:

rell.test.pubkeys.{bob, alice, trudy, charlie, dave, eve, frank, grace, heidi}: byte_array

rell.test.privkeys

The test framework contains the following predefined private keys:

rell.test.privkeys.{bob, alice, trudy, charlie, dave, eve, frank, grace, heidi}: byte_array

rell.test.DEFAULT_FIRST_BLOCK_TIME: timestamp

The default first block time (2020-01-01 00:00:00 UTC).

rell.test.DEFAULT_BLOCK_INTERVAL: timestamp

The default block interval (10 seconds).

rell.test.BLOCKCHAIN_SIGNER_KEYPAIR: rell.test.keypair

The node keypair that signs all blocks within the test framework Defined as

rell.test.keypair(
priv = x'4242424242424242424242424242424242424242424242424242424242424242',
pub = x'0324653eac434488002cc06bbfb7f10fe18991e35f9fe4302dbea6d2353dc0ab1c'
)

Properties

rell.test.last_block_time: timestamp

Returns the last block time

rell.test.last_block_time_or_null: timestamp?

Returns the last block time or null if it's not set.

rell.test.next_block_time: timestamp

Returns the next block time.

rell.test.block_interval: timestamp

Returns the block interval.

Functions

function rell.test.set_block_interval(interval: integer): integer

Sets the block interval and returns the previous interval.

function rell.test.set_next_block_time(time: timestamp): unit

Sets the next block time directly.

function rell.test.set_next_block_time_delta(delta: integer): unit

Sets the next block time by adding a delta to the last block time.

function rell.test.nop(): rell.test.op

Creates a No-op operation. Useful for ensuring uniqueness of a transaction

Parameters:

  • nonce - Optional parameter. Can be an integer, byte_array or text

Returns:

  • rell.test.op - Corresponding to this nop.