Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add test specifications for TokenPauseTransaction #266

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions test-specifications/token-service/tokenPauseTransaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# TokenPauseTransaction - Test specification

## Description:
This test specification for TokenPauseTransaction is to be one of many for testing the functionality of the Hedera SDKs. The SDK under test will use the language specific JSON-RPC server return responses back to the test driver.

## Design:
Each test within the test specification is linked to one of the properties within TokenPauseTransaction. Each property is tested with a mix of boundaries. The inputs for each test are a range of valid, minimum, maximum, negative and invalid values for the method. The expected response of a passed test can be a correct error response code or seen as the result of node queries. A successful transaction (the transaction reached consensus and was applied to state) can be determined by getting a `TransactionReceipt` or `TransactionRecord`, or can be determined by using queries such as `TokenInfoQuery` or `TokenBalanceQuery` and investigating for the required changes (creations, updates, etc.). The mirror node can also be used to determine if a transaction was successful via its rest API. Error codes are obtained from the response code proto files.

**Transaction properties:**

https://docs.hedera.com/hedera/sdks-and-apis/sdks/token-service/pause-a-token

**TokenPause protobufs:**

https://github.com/hashgraph/hedera-protobufs/blob/main/services/token_pause.proto

**Response codes:**

https://github.com/hashgraph/hedera-protobufs/blob/main/services/response_code.proto

**Mirror Node APIs:**

https://docs.hedera.com/hedera/sdks-and-apis/rest-api

## JSON-RPC API Endpoint Documentation

### Method Name

`pauseToken`

### Input Parameters

| Parameter Name | Type | Required/Optional | Description/Notes |
|-------------------------|--------------------------------------------------|-------------------|-------------------------------|
| tokenId | string | optional | The ID of the token to pause. |
| commonTransactionParams | [json object](../commonTransactionParameters.md) | optional | |

### Output Parameters

| Parameter Name | Type | Description/Notes |
|----------------|--------|------------------------------------------------------------------------------------|
| status | string | The status of the submitted `TokenPauseTransaction` (from a `TransactionReceipt`). |

## Property Tests

### **Token ID:**

- The ID of the token to pause.

| Test no | Name | Input | Expected response | Implemented (Y/N) |
|---------|-----------------------------------------------------------|-----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|-------------------|
| 1 | Pauses a token | tokenId=<CREATED_TOKEN_ID>, commonTransactionParams.signers=[<CREATED_TOKEN_PAUSE_KEY>] | The token pause succeeds and the token is paused. | N |
| 2 | Pauses a token with no token ID | | The token pause fails with an INVALID_TOKEN_ID response code from the network. | N |
| 3 | Pauses a token without signing with the token's pause key | tokenId=<CREATED_TOKEN_ID> | The token pause fails with an INVALID_SIGNATURE response code from the network. | N |
| 4 | Pauses a token that doesn't exist | tokenId="123.456.789" | The token pause fails with an INVALID_TOKEN_ID response code from the network. | N |
| 5 | Pauses a token that is deleted | tokenId=<DELETED_TOKEN_ID>, commonTransactionParams.signers=[<DELETED_TOKEN_PAUSE_KEY>] | The token pause fails with an TOKEN_WAS_DELETED response code from the network. | N |
| 6 | Pauses a token that is empty | tokenId="" | The token pause fails with an SDK internal error. | N |
| 7 | Pauses a token twice | tokenId=<CREATED_TOKEN_ID>, commonTransactionParams.signers=[<CREATED_TOKEN_PAUSE_KEY>] | The token pause fails with an TOKEN_IS_PAUSED response code from the network. | N |

#### JSON Request Example

```json
{
"jsonrpc": "2.0",
"id": 99232,
"method": "pauseToken",
"params": {
"tokenId": "0.0.2533",
"commonTransactionParams": {
"signers": [
"302e020100300506032b65700422042031f8eb3e77a04ebe599c51570976053009e619414f26bdd39676a5d3b2782a1d"
]
}
}
}
```

#### JSON Response Example

```json
{
"jsonrpc": "2.0",
"id": 99232,
"result": {
"status": "SUCCESS"
}
}
```