change timestamp from unsigned to signed

This commit is contained in:
MYLS 2018-12-26 16:09:18 +08:00
parent aebe14d75f
commit dc2b13e29e
3 changed files with 85 additions and 37 deletions

View File

@ -40,7 +40,7 @@ message Block {
bytes hash = 2; // `null` bytes hash = 2; // `null`
bytes parent_hash = 3; // bytes parent_hash = 3; //
repeated bytes witnesses = 4; // repeated bytes witnesses = 4; //
uint64 timestamp = 5; // UNIX时间戳 int64 timestamp = 5; // UNIX时间戳
uint64 size = 6; // uint64 size = 6; //
bytes transactions_root = 7; // bytes transactions_root = 7; //
repeated Transaction transactions = 8; // repeated Transaction transactions = 8; //

View File

@ -21,7 +21,7 @@ service TransactionLedger {
message Transaction { message Transaction {
bytes block_hash = 1; // `null` bytes block_hash = 1; // `null`
uint32 index = 2; // index`null` uint32 index = 2; // index`null`
bytes hash = 3; // bytes hash = 3; //
TransactionType type = 4; // TransactionType type = 4; //
bytes from = 5; // bytes from = 5; //
@ -38,7 +38,7 @@ message Block {
bytes hash = 2; // `null` bytes hash = 2; // `null`
repeated bytes parent_hashes = 3; // repeated bytes parent_hashes = 3; //
repeated bytes witnesses = 4; // repeated bytes witnesses = 4; //
uint64 timestamp = 5; // UNIX时间戳 int64 timestamp = 5; // UNIX
uint64 size = 6; // uint64 size = 6; //
bytes transactions_root = 7; // bytes transactions_root = 7; //
repeated Transaction transactions = 8; // repeated Transaction transactions = 8; //

58
test.md
View File

@ -1,3 +1,5 @@
# Test
## Basic types ## Basic types
### ClientVersionResponse ### ClientVersionResponse
@ -25,7 +27,7 @@ enum TransactionType {
```proto ```proto
message Transaction { message Transaction {
bytes block_hash = 1; // 事务所在的区块的哈希,当事务处于待确认状态时为`null` bytes block_hash = 1; // 事务所在的区块的哈希,当事务处于待确认状态时为`null`
uint32 index = 2; // 事务在区块中的位置index当事务处于待确认状态时为`null` uint32 index = 2; // 事务在区块中的位置 index当事务处于待确认状态时为`null`
bytes hash = 3; // 事务的哈希 bytes hash = 3; // 事务的哈希
TransactionType type = 4; // 事务类型 TransactionType type = 4; // 事务类型
bytes from = 5; // 发送账户地址 bytes from = 5; // 发送账户地址
@ -64,8 +66,8 @@ message Block {
uint64 index = 1; // 事务链本地区块索引,当区块处于待确认状态时为`null` uint64 index = 1; // 事务链本地区块索引,当区块处于待确认状态时为`null`
bytes hash = 2; // 区块的哈希,当区块处于待确认状态时为`null` bytes hash = 2; // 区块的哈希,当区块处于待确认状态时为`null`
repeated bytes parent_hashes = 3; // 父区块的哈希 repeated bytes parent_hashes = 3; // 父区块的哈希
bytes witnesses = 4; // 见证者账户地址 repeated bytes witnesses = 4; // 见证者账户地址
uint64 timestamp = 5; // 区块产生时的UNIX时间戳 int64 timestamp = 5; // 区块产生时的 UNIX 时间戳,单位为秒
uint64 size = 6; // 区块大小的字节数 uint64 size = 6; // 区块大小的字节数
bytes transactions_root = 7; // 区块的事务树根 bytes transactions_root = 7; // 区块的事务树根
repeated Transaction transactions = 8; // 事务对象的数组,或为空 repeated Transaction transactions = 8; // 事务对象的数组,或为空
@ -81,7 +83,7 @@ message Block {
bytes hash = 2; // 区块的哈希,当区块处于待确认状态时为`null` bytes hash = 2; // 区块的哈希,当区块处于待确认状态时为`null`
bytes parent_hash = 3; // 父区块的哈希 bytes parent_hash = 3; // 父区块的哈希
repeated bytes witnesses = 4; // 见证者账户地址的数组 repeated bytes witnesses = 4; // 见证者账户地址的数组
uint64 timestamp = 5; // 区块产生时的UNIX时间戳 int64 timestamp = 5; // 区块产生时的UNIX时间戳
uint64 size = 6; // 区块大小的字节数 uint64 size = 6; // 区块大小的字节数
bytes transactions_root = 7; // 区块的事务树根 bytes transactions_root = 7; // 区块的事务树根
repeated Transaction transactions = 8; // 事务对象的数组,或为空 repeated Transaction transactions = 8; // 事务对象的数组,或为空
@ -112,11 +114,13 @@ bdchain.api.ClientVersionResponse
##### 1 ##### 1
**Request** **Request**
``` ```
(empty) (empty)
``` ```
**Response** **Response**
```yaml ```yaml
version: 'TxLedgerGo/v0.0.1alpha/darwin/go1.11' version: 'TxLedgerGo/v0.0.1alpha/darwin/go1.11'
``` ```
@ -146,11 +150,13 @@ message CreateLedgerResponse {
##### 1 ##### 1
**Request** **Request**
```yaml ```yaml
name: 'test' name: 'test'
``` ```
**Response** **Response**
```yaml ```yaml
ok: true ok: true
``` ```
@ -160,15 +166,19 @@ ok: true
**Request** **Request**
Client: Client:
```yaml ```yaml
name: null name: null
``` ```
On the wire: On the wire:
```yaml ```yaml
name: '' (defualt value) name: '' (defualt value)
``` ```
**Error** **Error**
```yaml ```yaml
code: Code.InvalidArgument code: Code.InvalidArgument
message: 'name must not be empty' message: 'name must not be empty'
@ -198,11 +208,13 @@ message GetLedgersResponse {
##### 1 ##### 1
**Request** **Request**
``` ```
(empty) (empty)
``` ```
**Response** **Response**
```yaml ```yaml
ledgers: ledgers:
- 'first' - 'first'
@ -235,11 +247,13 @@ message BlockCountResponse {
##### 1 ##### 1
**Request** **Request**
```yaml ```yaml
ledger: 'test' ledger: 'test'
``` ```
**Response** **Response**
```yaml ```yaml
block_count: 2018 block_count: 2018
``` ```
@ -249,15 +263,19 @@ block_count: 2018
**Request** **Request**
Client: Client:
```yaml ```yaml
ledger: null ledger: null
``` ```
On the wire: On the wire:
```yaml ```yaml
ledger: '' (defualt value) ledger: '' (defualt value)
``` ```
**Error** **Error**
```yaml ```yaml
code: Code.InvalidArgument code: Code.InvalidArgument
message: 'ledger must not be empty' message: 'ledger must not be empty'
@ -292,6 +310,7 @@ message GetBlocksResponse {
##### 1 ##### 1
**Request** **Request**
```yaml ```yaml
ledger: 'test' ledger: 'test'
from_index: 2018 from_index: 2018
@ -300,6 +319,7 @@ full_transactions: true
``` ```
**Response** **Response**
```yaml ```yaml
blocks: blocks:
- index: 2018 - index: 2018
@ -344,12 +364,14 @@ blocks:
##### 2 ##### 2
**Request** **Request**
```yaml ```yaml
ledger: 'test' ledger: 'test'
from_index: 2018 from_index: 2018
``` ```
**Response** **Response**
```yaml ```yaml
blocks: blocks:
- index: 2018 - index: 2018
@ -506,7 +528,7 @@ blocks:
- 0x0404040404040404040404040404040404040404 (in bytes) - 0x0404040404040404040404040404040404040404 (in bytes)
- 0x1313131313131313131313131313131313131313 (in bytes) - 0x1313131313131313131313131313131313131313 (in bytes)
- index: 2027 - index: 2027
hash: 0x1010101010101010101010101010101010101010101010101010101010101010 (in bytes) hash: 0x1010101010101010101010101010101010101010 (in bytes)
parent_hashes: parent_hashes:
- 0x0404040404040404040404040404040404040404 (in bytes) - 0x0404040404040404040404040404040404040404 (in bytes)
- 0x1313131313131313131313131313131313131313 (in bytes) - 0x1313131313131313131313131313131313131313 (in bytes)
@ -556,6 +578,7 @@ message SendTransactionResponse {
##### 1 ##### 1
**Request** **Request**
```yaml ```yaml
ledger: 'test' ledger: 'test'
transaction: transaction:
@ -566,6 +589,7 @@ transaction:
``` ```
**Response** **Response**
```yaml ```yaml
hash: 0xd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5ed (in bytes) hash: 0xd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5ed (in bytes)
``` ```
@ -573,6 +597,7 @@ hash: 0xd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5ed (in byt
##### 2 ##### 2
**Request** **Request**
```yaml ```yaml
ledger: 'test' ledger: 'test'
transaction: transaction:
@ -583,6 +608,7 @@ transaction:
``` ```
**Error** **Error**
```yaml ```yaml
code: Code.InvalidArgument code: Code.InvalidArgument
message: 'Multiple invalid arguments' message: 'Multiple invalid arguments'
@ -617,11 +643,13 @@ bdchain.api.ClientVersionResponse
##### 1 ##### 1
**Request** **Request**
``` ```
(empty) (empty)
``` ```
**Response** **Response**
```yaml ```yaml
version: 'AcChainGo/v0.0.1alpha/darwin/go1.11' version: 'AcChainGo/v0.0.1alpha/darwin/go1.11'
``` ```
@ -651,11 +679,13 @@ message BlockNumberResponse {
##### 1 ##### 1
**Request** **Request**
```yaml ```yaml
ledger: 'test' ledger: 'test'
``` ```
**Response** **Response**
```yaml ```yaml
block_number: 2018 block_number: 2018
``` ```
@ -665,15 +695,19 @@ block_number: 2018
**Request** **Request**
Client: Client:
```yaml ```yaml
ledger: null ledger: null
``` ```
On the wire: On the wire:
```yaml ```yaml
ledger: '' (defualt value) ledger: '' (defualt value)
``` ```
**Error** **Error**
```yaml ```yaml
code: Code.InvalidArgument code: Code.InvalidArgument
message: 'ledger must not be empty' message: 'ledger must not be empty'
@ -705,6 +739,7 @@ Block
##### 1 ##### 1
**Request** **Request**
```yaml ```yaml
ledger: 'test' ledger: 'test'
number: 2018 number: 2018
@ -712,6 +747,7 @@ full_transaction: true
``` ```
**Response** **Response**
```yaml ```yaml
number: 2018 number: 2018
hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes) hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
@ -756,12 +792,15 @@ transaction_hashes:
**Request** **Request**
Client: Client:
```yaml ```yaml
ledger: 'test' ledger: 'test'
number: 2018 number: 2018
full_transaction: null full_transaction: null
``` ```
On the wire: On the wire:
```yaml ```yaml
ledger: 'test' ledger: 'test'
number: 2018 number: 2018
@ -769,6 +808,7 @@ full_transaction: false (defualt value)
``` ```
**Response** **Response**
```yaml ```yaml
number: 2018 number: 2018
hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes) hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
@ -811,6 +851,7 @@ Block
##### 1 ##### 1
**Request** **Request**
```yaml ```yaml
ledger: 'test' ledger: 'test'
hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes) hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
@ -818,6 +859,7 @@ full_transaction: false
``` ```
**Response** **Response**
```yaml ```yaml
number: 2018 number: 2018
hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes) hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
@ -859,12 +901,14 @@ Transaction
##### 1 ##### 1
**Request** **Request**
```yaml ```yaml
ledger: 'test' ledger: 'test'
hash: 0x0404040404040404040404040404040404040404 (in bytes) hash: 0x0404040404040404040404040404040404040404 (in bytes)
``` ```
**Response** **Response**
```yaml ```yaml
block_number: 2018 block_number: 2018
block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes) block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
@ -905,6 +949,7 @@ Transaction
##### 1 ##### 1
**Request** **Request**
```yaml ```yaml
ledger: 'test' ledger: 'test'
block_number: 2018 block_number: 2018
@ -912,6 +957,7 @@ index: 0
``` ```
**Response** **Response**
```yaml ```yaml
block_number: 2018 block_number: 2018
block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes) block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
@ -952,6 +998,7 @@ Transaction
##### 1 ##### 1
**Request** **Request**
```yaml ```yaml
ledger: 'test' ledger: 'test'
block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes) block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
@ -959,6 +1006,7 @@ index: 0
``` ```
**Response** **Response**
```yaml ```yaml
block_number: 2018 block_number: 2018
block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes) block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)