Compilation and Testing
Validate Gate
POST https://api.hexagate.com/api/v1/invariants/validate
Compile and run the rules specified in the gate file on specified blocks.
Request Body
gate*
str
The text of the gate file to compile
chain_id*
int
from_block
int
The block to test the rules on
(Default is current block)
to_block
int
If provided, the rules will be checked on the block range between from and to. The maximum range is 10 blocks.
params
dict[str, any]
The parameters used for gate compilation (Used in param statements in the gate file)
mocks
dict[str, any]
Allows users to override values of declared data sources (useful for testing)
trace
bool
If true, return the value of all named sources at each block. Defaults to false.
{
"count": <How many invariants were run>,
"failed": [
["Invariant description", <Block number>],
],
"exceptions": [
["Rule description", "Runtime exception"],
],
"trace": { // Optional
"source_name": [<Val1>, <Val2>>]
}
}Response Body
failed*
array[array[str]]
Gate rules failures
exceptions*
array[array[str]]
Gate run time exceptions
trace
dict[str, str]
Sources' value
Last updated