You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Align test specification with bitcoinkernel.h exported symbols (#7)
- Standardize test parameters to match C function signatures and names
- Restructure response format with improved success/error semantics
- Remove test cases for unexported errors and flags (not in bitcoinkernel.h)
- Add response validation unit tests
- Update handler specification to reflect new response structure
Co-authored-by: stickies-v <stickies-v@protonmail.com>
Copy file name to clipboardExpand all lines: docs/handler-spec.md
+36-38Lines changed: 36 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,40 +24,32 @@ Handlers communicate with the test runner via **stdin/stdout**:
24
24
**Fields:**
25
25
-`id` (string, required): Unique identifier for this request
26
26
-`method` (string, required): The operation to perform. Each unique method must be implemented by the handler to exercise the corresponding binding API operation.
27
-
-`params` (object, required): Method-specific parameters (can be `null` or `{}`)
-`id` (string, required): Must match the request ID
40
-
-`success` (any, required): Method-specific result data. Must be present on success (can be empty `{}`)
41
-
-`error` (null or omitted): Must not be present on success
42
-
43
-
### Error Response
44
-
45
-
```json
46
-
{
47
-
"id": "unique-request-id",
34
+
"result": null,
48
35
"error": {
49
-
"type": "error_category",
50
-
"variant": "specific_error"
36
+
"code": {
37
+
"type": "error_type",
38
+
"member": "ERROR_MEMBER_NAME"
39
+
}
51
40
}
52
41
}
53
42
```
54
43
55
-
**Error response fields:**
44
+
**Fields:**
56
45
-`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
46
+
-`result` (any, optional): The return value, or `null` for void/nullptr operations. Must be `null` on error
47
+
-`error` (object, optional): Error details. Must be `null` on success. An empty object `{}` is used to indicate an error is raised without further details, it is NOT equivalent to `null`
48
+
-`code` (object, optional): Error code details
49
+
-`type` (string, required): Error type (e.g., "btck_ScriptVerifyStatus")
50
+
-`member` (string, required): Specific error member (e.g., "ERROR_INVALID_FLAGS_COMBINATION")
51
+
52
+
**Note:** Throughout this protocol, an omitted field is semantically equivalent to `null`.
61
53
62
54
## Handler Requirements
63
55
@@ -74,43 +66,49 @@ The conformance tests are organized into suites, each testing a specific aspect
Tests valid Bitcoin script verification scenarios across different transaction types.
69
+
Test cases where the script verification operation executes successfully and returns a boolean result (true for valid scripts, false for invalid scripts).
Tests error handling for invalid script verification scenarios.
91
+
Test cases where the verification operation fails to determine validity of the script due to bad user input.
93
92
94
-
**Method:**`script_pubkey.verify`
93
+
**Method:**`btck_script_pubkey_verify`
95
94
96
95
**Expected Response Format:**
97
96
```json
98
97
{
99
98
"id": "test-id",
99
+
"result": null,
100
100
"error": {
101
-
"type": "ScriptVerify",
102
-
"variant": "ErrorVariant"
101
+
"code": {
102
+
"type": "btck_ScriptVerifyStatus",
103
+
"member": "ERROR_MEMBER_NAME"
104
+
}
103
105
}
104
106
}
105
107
```
106
108
107
-
**Error Variants:**
109
+
**Error Members:**
108
110
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. |
111
+
| Member | Description |
112
+
|--------|-------------|
113
+
|`ERROR_INVALID_FLAGS_COMBINATION`| Invalid or inconsistent verification flags were provided. This occurs when the supplied `script_verify_flags` combination violates internal consistency rules. |
114
+
|`ERROR_SPENT_OUTPUTS_REQUIRED`| Spent outputs are required but were not provided (e.g., for Taproot verification). |
0 commit comments