Skip to content

Commit 63b9124

Browse files
committed
Explain the Sentinel interface in more depth
1 parent acf2a2a commit 63b9124

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

sentinel.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,27 @@ The process of metering is [explained in its own chapter](./metering.md).
88

99
The Sentinel is a system contract which means its code is fixed and is part of the genesis or hardfork ewasm is enabled on.
1010
As a result, changing or updating it requires a hard fork.
11+
12+
The Sentinel contract has two interfaces:
13+
- raw interface
14+
- ABI encoded interface
15+
16+
## Error handling
17+
18+
In both modes, the contract will use an invalid instruction (e.g. regular failure) when an unexpected issue occurs,
19+
or the `revert` operation if the supplied input is invalid.
20+
21+
## Raw interface
22+
23+
In the raw interface it accepts any valid WebAssembly binary, applies the Sentinel steps, and returns the transformed
24+
WebAssembly binary. There is no encapsulation of any kind.
25+
26+
## ABI encoded interface
27+
28+
The ABI encoded interface is demonstrated by the following Solidity interface:
29+
```solidity
30+
interface Sentinel {
31+
// Expects a WebAssembly binary and returns a transformed WebAssembly binary.
32+
function validateAndMeter(bytes) external view returns (bytes);
33+
}
34+
```

0 commit comments

Comments
 (0)