From cf8b42d813be9b502e696e95b27a48d00653bde5 Mon Sep 17 00:00:00 2001 From: zramsay Date: Tue, 25 Sep 2018 17:15:08 -0400 Subject: [PATCH] rpc/core: ints are strings in responses, closes #1896 --- rpc/core/abci.go | 6 ++--- rpc/core/blocks.go | 60 +++++++++++++++++++++---------------------- rpc/core/consensus.go | 60 +++++++++++++++++++++---------------------- rpc/core/doc.go | 2 +- rpc/core/mempool.go | 14 +++++----- rpc/core/net.go | 4 +-- rpc/core/tx.go | 20 +++++++-------- 7 files changed, 83 insertions(+), 83 deletions(-) diff --git a/rpc/core/abci.go b/rpc/core/abci.go index 3f399be80..9c7af92cd 100644 --- a/rpc/core/abci.go +++ b/rpc/core/abci.go @@ -28,12 +28,12 @@ import ( // "result": { // "response": { // "log": "exists", -// "height": 0, +// "height": "0", // "proof": "010114FED0DAD959F36091AD761C922ABA3CBF1D8349990101020103011406AA2262E2F448242DF2C2607C3CDC705313EE3B0001149D16177BC71E445476174622EA559715C293740C", // "value": "61626364", // "key": "61626364", -// "index": -1, -// "code": 0 +// "index": "-1", +// "code": "0" // } // }, // "id": "", diff --git a/rpc/core/blocks.go b/rpc/core/blocks.go index bb69db63f..a9252f553 100644 --- a/rpc/core/blocks.go +++ b/rpc/core/blocks.go @@ -32,13 +32,13 @@ import ( // "header": { // "app_hash": "", // "chain_id": "test-chain-6UTNIN", -// "height": 10, +// "height": "10", // "time": "2017-05-29T15:05:53.877Z", -// "num_txs": 0, +// "num_txs": "0", // "last_block_id": { // "parts": { // "hash": "3C78F00658E06744A88F24FF97A0A5011139F34A", -// "total": 1 +// "total": "1" // }, // "hash": "F70588DAB36BDA5A953D548A16F7D48C6C2DFD78" // }, @@ -49,13 +49,13 @@ import ( // "block_id": { // "parts": { // "hash": "277A4DBEF91483A18B85F2F5677ABF9694DFA40F", -// "total": 1 +// "total": "1" // }, // "hash": "96B1D2F2D201BA4BC383EB8224139DB1294944E5" // } // } // ], -// "last_height": 5493 +// "last_height": "5493" // }, // "id": "", // "jsonrpc": "2.0" @@ -143,21 +143,21 @@ func filterMinMax(height, min, max, limit int64) (int64, int64, error) { // "block_id": { // "parts": { // "hash": "3C78F00658E06744A88F24FF97A0A5011139F34A", -// "total": 1 +// "total": "1" // }, // "hash": "F70588DAB36BDA5A953D548A16F7D48C6C2DFD78" // }, -// "type": 2, -// "round": 0, -// "height": 9, -// "validator_index": 0, +// "type": "2", +// "round": "0", +// "height": "9", +// "validator_index": "0", // "validator_address": "E89A51D60F68385E09E716D353373B11F8FACD62" // } // ], // "blockID": { // "parts": { // "hash": "3C78F00658E06744A88F24FF97A0A5011139F34A", -// "total": 1 +// "total": "1" // }, // "hash": "F70588DAB36BDA5A953D548A16F7D48C6C2DFD78" // } @@ -168,13 +168,13 @@ func filterMinMax(height, min, max, limit int64) (int64, int64, error) { // "header": { // "app_hash": "", // "chain_id": "test-chain-6UTNIN", -// "height": 10, +// "height": "10", // "time": "2017-05-29T15:05:53.877Z", -// "num_txs": 0, +// "num_txs": "0", // "last_block_id": { // "parts": { // "hash": "3C78F00658E06744A88F24FF97A0A5011139F34A", -// "total": 1 +// "total": "1" // }, // "hash": "F70588DAB36BDA5A953D548A16F7D48C6C2DFD78" // }, @@ -187,13 +187,13 @@ func filterMinMax(height, min, max, limit int64) (int64, int64, error) { // "header": { // "app_hash": "", // "chain_id": "test-chain-6UTNIN", -// "height": 10, +// "height": "10", // "time": "2017-05-29T15:05:53.877Z", -// "num_txs": 0, +// "num_txs": "0", // "last_block_id": { // "parts": { // "hash": "3C78F00658E06744A88F24FF97A0A5011139F34A", -// "total": 1 +// "total": "1" // }, // "hash": "F70588DAB36BDA5A953D548A16F7D48C6C2DFD78" // }, @@ -204,7 +204,7 @@ func filterMinMax(height, min, max, limit int64) (int64, int64, error) { // "block_id": { // "parts": { // "hash": "277A4DBEF91483A18B85F2F5677ABF9694DFA40F", -// "total": 1 +// "total": "1" // }, // "hash": "96B1D2F2D201BA4BC383EB8224139DB1294944E5" // } @@ -255,21 +255,21 @@ func Block(heightPtr *int64) (*ctypes.ResultBlock, error) { // "block_id": { // "parts": { // "hash": "9E37CBF266BC044A779E09D81C456E653B89E006", -// "total": 1 +// "total": "1" // }, // "hash": "CC6E861E31CA4334E9888381B4A9137D1458AB6A" // }, -// "type": 2, -// "round": 0, -// "height": 11, -// "validator_index": 0, +// "type": "2", +// "round": "0", +// "height": "11", +// "validator_index": "0", // "validator_address": "E89A51D60F68385E09E716D353373B11F8FACD62" // } // ], // "blockID": { // "parts": { // "hash": "9E37CBF266BC044A779E09D81C456E653B89E006", -// "total": 1 +// "total": "1" // }, // "hash": "CC6E861E31CA4334E9888381B4A9137D1458AB6A" // } @@ -277,13 +277,13 @@ func Block(heightPtr *int64) (*ctypes.ResultBlock, error) { // "header": { // "app_hash": "", // "chain_id": "test-chain-6UTNIN", -// "height": 11, +// "height": "11", // "time": "2017-05-29T15:05:54.893Z", -// "num_txs": 0, +// "num_txs": "0", // "last_block_id": { // "parts": { // "hash": "277A4DBEF91483A18B85F2F5677ABF9694DFA40F", -// "total": 1 +// "total": "1" // }, // "hash": "96B1D2F2D201BA4BC383EB8224139DB1294944E5" // }, @@ -337,14 +337,14 @@ func Commit(heightPtr *int64) (*ctypes.ResultCommit, error) { // // ```json // { -// "height": 10, +// "height": "10", // "results": [ // { -// "code": 0, +// "code": "0", // "data": "CAFE00F00D" // }, // { -// "code": 102, +// "code": "102", // "data": "" // } // ] diff --git a/rpc/core/consensus.go b/rpc/core/consensus.go index a4a2c667c..1d5f92753 100644 --- a/rpc/core/consensus.go +++ b/rpc/core/consensus.go @@ -28,8 +28,8 @@ import ( // "result": { // "validators": [ // { -// "accum": 0, -// "voting_power": 10, +// "accum": "0", +// "voting_power": "10", // "pub_key": { // "data": "68DFDA7E50F82946E7E8546BED37944A422CD1B831E70DF66BA3B8430593944D", // "type": "ed25519" @@ -37,7 +37,7 @@ import ( // "address": "E89A51D60F68385E09E716D353373B11F8FACD62" // } // ], -// "block_height": 5241 +// "block_height": "5241" // }, // "id": "", // "jsonrpc": "2.0" @@ -79,9 +79,9 @@ func Validators(heightPtr *int64) (*ctypes.ResultValidators, error) { // "id": "", // "result": { // "round_state": { -// "height": 7185, -// "round": 0, -// "step": 1, +// "height": "7185", +// "round": "0", +// "step": "1", // "start_time": "2018-05-12T13:57:28.440293621-07:00", // "commit_time": "2018-05-12T13:57:27.440293621-07:00", // "validators": { @@ -92,8 +92,8 @@ func Validators(heightPtr *int64) (*ctypes.ResultValidators, error) { // "type": "tendermint/PubKeyEd25519", // "value": "SBctdhRBcXtBgdI/8a/alTsUhGXqGs9k5ylV1u5iKHg=" // }, -// "voting_power": 10, -// "accum": 0 +// "voting_power": "10", +// "accum": "0" // } // ], // "proposer": { @@ -102,27 +102,27 @@ func Validators(heightPtr *int64) (*ctypes.ResultValidators, error) { // "type": "tendermint/PubKeyEd25519", // "value": "SBctdhRBcXtBgdI/8a/alTsUhGXqGs9k5ylV1u5iKHg=" // }, -// "voting_power": 10, -// "accum": 0 +// "voting_power": "10", +// "accum": "0" // } // }, // "proposal": null, // "proposal_block": null, // "proposal_block_parts": null, -// "locked_round": 0, +// "locked_round": "0", // "locked_block": null, // "locked_block_parts": null, -// "valid_round": 0, +// "valid_round": "0", // "valid_block": null, // "valid_block_parts": null, // "votes": [ // { -// "round": 0, +// "round": "0", // "prevotes": "_", // "precommits": "_" // } // ], -// "commit_round": -1, +// "commit_round": "-1", // "last_commit": { // "votes": [ // "Vote{0:B5B3D40BE539 7184/00/2(Precommit) 14F946FA7EF0 /702B1B1A602A.../ @ 2018-05-12T20:57:27.342Z}" @@ -138,8 +138,8 @@ func Validators(heightPtr *int64) (*ctypes.ResultValidators, error) { // "type": "tendermint/PubKeyEd25519", // "value": "SBctdhRBcXtBgdI/8a/alTsUhGXqGs9k5ylV1u5iKHg=" // }, -// "voting_power": 10, -// "accum": 0 +// "voting_power": "10", +// "accum": "0" // } // ], // "proposer": { @@ -148,8 +148,8 @@ func Validators(heightPtr *int64) (*ctypes.ResultValidators, error) { // "type": "tendermint/PubKeyEd25519", // "value": "SBctdhRBcXtBgdI/8a/alTsUhGXqGs9k5ylV1u5iKHg=" // }, -// "voting_power": 10, -// "accum": 0 +// "voting_power": "10", +// "accum": "0" // } // } // }, @@ -158,30 +158,30 @@ func Validators(heightPtr *int64) (*ctypes.ResultValidators, error) { // "node_address": "30ad1854af22506383c3f0e57fb3c7f90984c5e8@172.16.63.221:26656", // "peer_state": { // "round_state": { -// "height": 7185, -// "round": 0, -// "step": 1, +// "height": "7185", +// "round": "0", +// "step": "1", // "start_time": "2018-05-12T13:57:27.438039872-07:00", // "proposal": false, // "proposal_block_parts_header": { -// "total": 0, +// "total": "0", // "hash": "" // }, // "proposal_block_parts": null, -// "proposal_pol_round": -1, +// "proposal_pol_round": "-1", // "proposal_pol": "_", // "prevotes": "_", // "precommits": "_", -// "last_commit_round": 0, +// "last_commit_round": "0", // "last_commit": "x", -// "catchup_commit_round": -1, +// "catchup_commit_round": "-1", // "catchup_commit": "_" // }, // "stats": { -// "last_vote_height": 7184, -// "votes": 255, -// "last_block_part_height": 7184, -// "block_parts": 255 +// "last_vote_height": "7184", +// "votes": "255", +// "last_block_part_height": "7184", +// "block_parts": "255" // } // } // } @@ -241,7 +241,7 @@ func DumpConsensusState() (*ctypes.ResultDumpConsensusState, error) { // "valid_block_hash": "", // "height_vote_set": [ // { -// "round": 0, +// "round": "0", // "prevotes": [ // "nil-Vote" // ], diff --git a/rpc/core/doc.go b/rpc/core/doc.go index 603b6679e..5378dde24 100644 --- a/rpc/core/doc.go +++ b/rpc/core/doc.go @@ -33,7 +33,7 @@ curl 'localhost:26657/broadcast_tx_sync?tx="abc"' "hash": "2B8EC32BA2579B3B8606E42C06DE2F7AFA2556EF", "log": "", "data": "", - "code": 0 + "code": "0" }, "id": "", "jsonrpc": "2.0" diff --git a/rpc/core/mempool.go b/rpc/core/mempool.go index 728d77f63..c015363af 100644 --- a/rpc/core/mempool.go +++ b/rpc/core/mempool.go @@ -36,7 +36,7 @@ import ( // "hash": "E39AAB7A537ABAA237831742DCE1117F187C3C52", // "log": "", // "data": "", -// "code": 0 +// "code": "0" // }, // "id": "", // "jsonrpc": "2.0" @@ -74,7 +74,7 @@ func BroadcastTxAsync(tx types.Tx) (*ctypes.ResultBroadcastTx, error) { // "jsonrpc": "2.0", // "id": "", // "result": { -// "code": 0, +// "code": "0", // "data": "", // "log": "", // "hash": "0D33F2F03A5234F38706E43004489E061AC40A2E" @@ -126,17 +126,17 @@ func BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error) { // { // "error": "", // "result": { -// "height": 26682, +// "height": "26682", // "hash": "75CA0F856A4DA078FC4911580360E70CEFB2EBEE", // "deliver_tx": { // "log": "", // "data": "", -// "code": 0 +// "code": "0" // }, // "check_tx": { // "log": "", // "data": "", -// "code": 0 +// "code": "0" // } // }, // "id": "", @@ -227,7 +227,7 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) { // "error": "", // "result": { // "txs": [], -// "n_txs": 0 +// "n_txs": "0" // }, // "id": "", // "jsonrpc": "2.0" @@ -265,7 +265,7 @@ func UnconfirmedTxs(limit int) (*ctypes.ResultUnconfirmedTxs, error) { // "error": "", // "result": { // "txs": null, -// "n_txs": 0 +// "n_txs": "0" // }, // "id": "", // "jsonrpc": "2.0" diff --git a/rpc/core/net.go b/rpc/core/net.go index acb18a34f..9816d2f63 100644 --- a/rpc/core/net.go +++ b/rpc/core/net.go @@ -23,7 +23,7 @@ import ( // { // "error": "", // "result": { -// "n_peers": 0, +// "n_peers": "0", // "peers": [], // "listeners": [ // "Listener(@10.0.2.15:26656)" @@ -102,7 +102,7 @@ func UnsafeDialPeers(peers []string, persistent bool) (*ctypes.ResultDialPeers, // "validators": [ // { // "name": "", -// "power": 10, +// "power": "10", // "pub_key": { // "data": "68DFDA7E50F82946E7E8546BED37944A422CD1B831E70DF66BA3B8430593944D", // "type": "ed25519" diff --git a/rpc/core/tx.go b/rpc/core/tx.go index f53d82f14..ba6320016 100644 --- a/rpc/core/tx.go +++ b/rpc/core/tx.go @@ -36,17 +36,17 @@ import ( // }, // "Data": "YWJjZA==", // "RootHash": "2B8EC32BA2579B3B8606E42C06DE2F7AFA2556EF", -// "Total": 1, -// "Index": 0 +// "Total": "1", +// "Index": "0" // }, // "tx": "YWJjZA==", // "tx_result": { // "log": "", // "data": "", -// "code": 0 +// "code": "0" // }, -// "index": 0, -// "height": 52, +// "index": "0", +// "height": "52", // "hash": "2B8EC32BA2579B3B8606E42C06DE2F7AFA2556EF" // }, // "id": "", @@ -140,17 +140,17 @@ func Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) { // }, // "Data": "mvZHHa7HhZ4aRT0xMDA=", // "RootHash": "F6541223AA46E428CB1070E9840D2C3DF3B6D776", -// "Total": 32, -// "Index": 31 +// "Total": "32", +// "Index": "31" // }, // "tx": "mvZHHa7HhZ4aRT0xMDA=", // "tx_result": {}, -// "index": 31, -// "height": 12, +// "index": "31", +// "height": "12", // "hash": "2B8EC32BA2579B3B8606E42C06DE2F7AFA2556EF" // } // ], -// "total_count": 1 +// "total_count": "1" // } // } // ```