This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem (Fix #1069): blocks with multiple txs may fail light client a…
…pp hash check Solution: - Change BTreeMap to IndexMap
- Loading branch information
Showing
10 changed files
with
157 additions
and
30 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"mock_mode": false, | ||
"root_path": "./data", | ||
"chain_id": "test-chain-y3m1e6-AB", | ||
"genesis_time": "2019-11-20T08:56:48.618137Z", | ||
"expansion_cap": 1000000000000000000, | ||
"nodes": [ | ||
{ | ||
"name": "node0", | ||
"hostname": "127.0.0.1", | ||
"mnemonic": "analyst salon domain idea mango loyal depart utility vicious afraid double visit frog place bench", | ||
"validator_seed": "14d5136b842b5bdbe6df065f78ef8b92f3f67597a77f6fd16f13b7513331c3a0", | ||
"node_seed": "0360e3074ebe3ef45660514e3723670cb5a20c231778abaf4b21ebd4a8cdfac1", | ||
"bonded_coin": 250000000000000000, | ||
"unbonded_coin": 250000000000000000, | ||
"base_port": 26650 | ||
}, | ||
{ | ||
"name": "node1", | ||
"hostname": "127.0.0.1", | ||
"mnemonic": "afford citizen lyrics field stumble globe brisk muffin speak scare gift million isolate nuclear wait", | ||
"validator_seed": "5191100898b7eba044ff67cf7bf496ee49c1fd553755e7966d6dcd9f29d1e686", | ||
"node_seed": "6a7833dc02885693c7f9704a5434facb7eb7a288bbaa0edb2145ab3e7a819ff3", | ||
"bonded_coin": 250000000000000000, | ||
"unbonded_coin": 250000000000000000, | ||
"base_port": 26660 | ||
} | ||
], | ||
"chain_config_patch": [ | ||
{ | ||
"op": "replace", | ||
"path": "/initial_fee_policy/base_fee", | ||
"value": "0" | ||
}, | ||
{ | ||
"op": "replace", | ||
"path": "/initial_fee_policy/per_byte_fee", | ||
"value": "0" | ||
} | ||
], | ||
"tendermint_config_patch": [ | ||
{ | ||
"op": "replace", | ||
"path": "/consensus/create_empty_blocks", | ||
"value": false | ||
}, | ||
{ | ||
"op": "add", | ||
"path": "/consensus/create_empty_blocks_interval", | ||
"value": "0s" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import os | ||
import time | ||
from chainrpc import RPC | ||
from common import ( | ||
UnixStreamXMLRPCClient, wait_for_validators, stop_node, | ||
wait_for_tx, latest_block_height, wait_for_blocks | ||
) | ||
|
||
''' | ||
Env: | ||
- Two nodes, each with half power | ||
Procedure: | ||
- stop node1 | ||
- send tx to node0 | ||
- start node1 | ||
- repeat above | ||
- test wallet sync | ||
''' | ||
|
||
|
||
BASE_PORT = int(os.environ.get('BASE_PORT', 25560)) | ||
supervisor = UnixStreamXMLRPCClient('data/supervisor.sock') | ||
rpc = RPC(BASE_PORT) | ||
|
||
print('Wait for 2 validators online') | ||
wait_for_validators(rpc, 2) | ||
|
||
os.environ['ENCKEY'] = rpc.wallet.enckey() | ||
|
||
print('Prepare node0 transfer addresses') | ||
unbonded = rpc.address.list()[1] | ||
transfer1 = rpc.address.list(type='transfer')[0] | ||
|
||
time.sleep(3) # wait for at least one block, FIXME remove after #828 fixed | ||
txid = rpc.staking.withdraw_all_unbonded(unbonded, transfer1) | ||
wait_for_tx(rpc, txid) | ||
rpc.wallet.sync() | ||
|
||
addresses = [rpc.address.create(type='transfer') for i in range(10)] | ||
amount = 100000000 | ||
for addr in addresses: | ||
txid = rpc.wallet.send(addr, amount) | ||
wait_for_tx(rpc, txid) | ||
rpc.wallet.sync() | ||
|
||
print('Stop node1') | ||
stop_node(supervisor, 'node1') | ||
last_block_height = latest_block_height(rpc) | ||
|
||
print('Send multiple tx') | ||
pending_txs = [rpc.wallet.send(transfer1, amount) for _ in addresses] | ||
time.sleep(2) # wait for the tx processing | ||
|
||
print('Start node1') | ||
supervisor.supervisor.startProcessGroup('node1') | ||
|
||
print('Wait for one block') | ||
wait_for_blocks(rpc, 1, height=last_block_height) | ||
block = rpc.chain.block(last_block_height+1) | ||
print(block['block_meta']['header']['num_txs'], block) | ||
assert block['block_meta']['header']['num_txs'] == '10' | ||
|
||
print('Check sync ok') | ||
rpc.wallet.sync() | ||
assert rpc.wallet.balance() == { | ||
'total': '250000000000000000', | ||
'pending': '0', | ||
'available': '250000000000000000', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,5 +82,6 @@ runtest "jail" | |
runtest "join" | ||
runtest "byzantine" | ||
runtest "proportional" | ||
runtest "multitx" | ||
|
||
./cleanup.sh |