Skip to content

Commit cc128f1

Browse files
committed
Update handler spec to reflect error code restructuring and API alignment
1 parent 6c9b3df commit cc128f1

File tree

1 file changed

+36
-23
lines changed

1 file changed

+36
-23
lines changed

docs/handler-spec.md

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,33 +31,37 @@ Handlers communicate with the test runner via **stdin/stdout**:
3131
```json
3232
{
3333
"id": "unique-request-id",
34-
"success": { /* method-specific result */ }
34+
"success": true
3535
}
3636
```
3737

3838
**Success response fields:**
3939
- `id` (string, required): Must match the request ID
40-
- `success` (any, required): Method-specific result data. Must be present on success (can be empty `{}`)
40+
- `success` (boolean, required): Must be `true` on successful operation
4141
- `error` (null or omitted): Must not be present on success
4242

4343
### Error Response
4444

4545
```json
4646
{
4747
"id": "unique-request-id",
48+
"success": false,
4849
"error": {
49-
"type": "error_category",
50-
"variant": "specific_error"
50+
"code": {
51+
"type": "error_type",
52+
"member": "ERROR_MEMBER_NAME"
53+
}
5154
}
5255
}
5356
```
5457

5558
**Error response fields:**
5659
- `id` (string, required): Must match the request ID
57-
- `success` (null or omitted): Must not be present on error
58-
- `error` (object, required): Error details
59-
- `type` (string, required): Error category/type
60-
- `variant` (string, optional): Specific error variant within the type. Whether the runner expects this field depends on the specific test case
60+
- `success` (boolean, required): Must be `false` on error
61+
- `error` (object, optional): Error details. Whether this field is required depends on the specific test case.
62+
- `code` (object, optional): Error code details
63+
- `type` (string, required): Error type (e.g., "btck_ScriptVerifyStatus")
64+
- `member` (string, required): Specific error member (e.g., "ERROR_INVALID_FLAGS_COMBINATION")
6165

6266
## Handler Requirements
6367

@@ -76,13 +80,13 @@ The conformance tests are organized into suites, each testing a specific aspect
7680

7781
Tests valid Bitcoin script verification scenarios across different transaction types.
7882

79-
**Method:** `script_pubkey.verify`
83+
**Method:** `btck_script_pubkey_verify`
8084

8185
**Expected Response Format:**
8286
```json
8387
{
8488
"id": "test-id",
85-
"success": {}
89+
"success": true
8690
}
8791
```
8892

@@ -91,26 +95,35 @@ Tests valid Bitcoin script verification scenarios across different transaction t
9195

9296
Tests error handling for invalid script verification scenarios.
9397

94-
**Method:** `script_pubkey.verify`
98+
**Method:** `btck_script_pubkey_verify`
9599

96-
**Expected Response Format:**
100+
**Expected Response Formats:**
101+
102+
**With specific error code:**
97103
```json
98104
{
99105
"id": "test-id",
106+
"success": false,
100107
"error": {
101-
"type": "ScriptVerify",
102-
"variant": "ErrorVariant"
108+
"code": {
109+
"type": "btck_ScriptVerifyStatus",
110+
"member": "ERROR_MEMBER_NAME"
111+
}
103112
}
104113
}
105114
```
106115

107-
**Error Variants:**
116+
**Generic failure (no error details):**
117+
```json
118+
{
119+
"id": "test-id",
120+
"success": false
121+
}
122+
```
123+
124+
**Error Members:**
108125

109-
| Variant | Description |
110-
|---------|-------------|
111-
| `TxInputIndex` | The specified input index is out of bounds. The `input_index` parameter is greater than or equal to the number of inputs in the transaction. |
112-
| `InvalidFlags` | Invalid verification flags were provided. The flags parameter contains bits that don't correspond to any defined verification flag. |
113-
| `InvalidFlagsCombination` | Invalid or inconsistent verification flags were provided. This occurs when the supplied `script_verify_flags` combination violates internal consistency rules. |
114-
| `SpentOutputsMismatch` | The spent_outputs array length doesn't match the input count. When spent_outputs is non-empty, it must contain exactly one output for each input in the transaction. |
115-
| `SpentOutputsRequired` | Spent outputs are required but were not provided. |
116-
| `Invalid` | Script verification failed. |
126+
| Member | Description |
127+
|--------|-------------|
128+
| `ERROR_INVALID_FLAGS_COMBINATION` | Invalid or inconsistent verification flags were provided. This occurs when the supplied `script_verify_flags` combination violates internal consistency rules. |
129+
| `ERROR_SPENT_OUTPUTS_REQUIRED` | Spent outputs are required but were not provided (e.g., for Taproot verification). |

0 commit comments

Comments
 (0)