Skip to content

Commit 7ac23d7

Browse files
authored
Merge pull request #151 from ewasm/sentinel
Explain the Sentinel interface in more depth
2 parents acf2a2a + 78e9813 commit 7ac23d7

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

Diff for: sentinel.md

+27
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,30 @@ 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+
The raw interface is used by the node for contract validation during deployment, while the ABI encoded interface is a more
17+
friendly way to interact with the contract otherwise.
18+
19+
## Error handling
20+
21+
In both modes, the contract will use an invalid instruction (e.g. regular failure) when an unexpected issue occurs,
22+
or the `revert` operation if the supplied input is invalid.
23+
24+
## Raw interface
25+
26+
In the raw interface it accepts any valid WebAssembly binary, applies the Sentinel steps, and returns the transformed
27+
WebAssembly binary. There is no encapsulation of any kind.
28+
29+
## ABI encoded interface
30+
31+
The ABI encoded interface is demonstrated by the following Solidity interface:
32+
```solidity
33+
interface Sentinel {
34+
// Expects a WebAssembly binary and returns a transformed WebAssembly binary.
35+
function validateAndMeter(bytes) external view returns (bytes);
36+
}
37+
```

Diff for: system_contracts.md

-6
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ important processing steps:
2222

2323
See the [dedicated chapter](./sentinel.md) about it.
2424

25-
Input:
26-
- **variable length**: *ewasm contract code*
27-
28-
Output:
29-
- **variable length**: *ewasm contract code*
30-
3125
## EVM Transcompiler
3226

3327
Address: `0x000000000000000000000000000000000000000b`

0 commit comments

Comments
 (0)