mirror of
https://github.com/planetmint/planetmint.git
synced 2025-03-30 15:08:31 +00:00
solved get_latest_abci_chain attribute error
This commit is contained in:
parent
d79f92c8c9
commit
337b08047d
@ -50,10 +50,6 @@ from planetmint.events import EventTypes, Event
|
||||
CodeTypeError = 1
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class TmVersion(enum.Enum):
|
||||
"""Supported Tendermint versions enum"""
|
||||
v0_34_11 = 'v0.34.11'
|
||||
|
||||
|
||||
class App(BaseApplication):
|
||||
"""Bridge between Planetmint and Tendermint.
|
||||
@ -171,7 +167,7 @@ class App(BaseApplication):
|
||||
transaction = decode_transaction(raw_transaction)
|
||||
if self.planetmint_node.is_valid_transaction(transaction):
|
||||
logger.debug('check_tx: VALID')
|
||||
return ResponseCheckTx(code=CodeTypeOk)
|
||||
return ResponseCheckTx(code=OkCode)
|
||||
else:
|
||||
logger.debug('check_tx: INVALID')
|
||||
return ResponseCheckTx(code=CodeTypeError)
|
||||
@ -213,7 +209,7 @@ class App(BaseApplication):
|
||||
logger.debug('storing tx')
|
||||
self.block_txn_ids.append(transaction.id)
|
||||
self.block_transactions.append(transaction)
|
||||
return ResponseDeliverTx(code=CodeTypeOk)
|
||||
return ResponseDeliverTx(code=OkCode)
|
||||
|
||||
def end_block(self, request_end_block):
|
||||
"""Calculate block hash using transaction ids and previous block
|
||||
|
@ -6,7 +6,8 @@
|
||||
import multiprocessing as mp
|
||||
from collections import defaultdict
|
||||
|
||||
from planetmint import App, Planetmint
|
||||
from planetmint import App
|
||||
from planetmint.lib import Planetmint
|
||||
from planetmint.tendermint_utils import decode_transaction
|
||||
from abci.application import OkCode
|
||||
from tendermint.abci.types_pb2 import (
|
||||
|
@ -6,7 +6,6 @@
|
||||
import logging
|
||||
import setproctitle
|
||||
|
||||
#from abci import TmVersion, ABCI
|
||||
|
||||
import planetmint
|
||||
from planetmint.lib import Planetmint
|
||||
|
@ -4,29 +4,15 @@ import codecs
|
||||
import enum
|
||||
|
||||
import planetmint
|
||||
from tendermint.abci import types_pb2 as types_v0_34_11
|
||||
from tendermint.abci import types_pb2
|
||||
from tendermint.crypto import keys_pb2
|
||||
from planetmint.common.exceptions import InvalidPublicKey, BigchainDBError
|
||||
|
||||
class TmVersion(enum.Enum):
|
||||
"""Supported Tendermint versions enum"""
|
||||
v0_34_11 = 'v0.34.11'
|
||||
|
||||
def encode_validator(v):
|
||||
ed25519_public_key = v['public_key']['value']
|
||||
# NOTE: tendermint expects public to be encoded in go-amino format
|
||||
try:
|
||||
version = TmVersion(planetmint.config["tendermint"]["version"])
|
||||
except ValueError:
|
||||
raise BigchainDBError('Invalid tendermint version, '
|
||||
'check Planetmint configuration file')
|
||||
pub_key = keys_pb2.PublicKey(ed25519=bytes.fromhex(ed25519_public_key))
|
||||
|
||||
validator_update_t, pubkey_t = {
|
||||
TmVersion.v0_34_11: (types_v0_34_11.ValidatorUpdate, keys_pb2.PublicKey)
|
||||
}[version]
|
||||
pub_key = pubkey_t(ed25519=bytes.fromhex(ed25519_public_key))
|
||||
|
||||
return validator_update_t(pub_key=pub_key, power=v['power'])
|
||||
return types_pb2.ValidatorUpdate(pub_key=pub_key, power=v['power'])
|
||||
|
||||
|
||||
def decode_validator(v):
|
||||
|
@ -16,7 +16,7 @@ from flask_cors import CORS
|
||||
import gunicorn.app.base
|
||||
|
||||
from planetmint import utils
|
||||
from planetmint import Planetmint
|
||||
from planetmint.lib import Planetmint
|
||||
from planetmint.web.routes import add_routes
|
||||
from planetmint.web.strip_content_type_middleware import StripContentTypeMiddleware
|
||||
|
||||
|
@ -6,7 +6,6 @@ from planetmint.lib import Block
|
||||
from planetmint.elections.election import Election
|
||||
from planetmint.migrations.chain_migration_election import ChainMigrationElection
|
||||
from planetmint.upsert_validator.validator_election import ValidatorElection
|
||||
from planetmint.core import TmVersion
|
||||
|
||||
@pytest.mark.bdb
|
||||
def test_process_block_concludes_all_elections(b):
|
||||
|
@ -53,7 +53,7 @@ def generate_init_chain_request(chain_id, vals=None):
|
||||
|
||||
def test_init_chain_successfully_registers_chain(a, b):
|
||||
request = generate_init_chain_request('chain-XYZ')
|
||||
res = App(a, b).init_chain(request)
|
||||
res = App(b, a).init_chain(request)
|
||||
assert res == types.ResponseInitChain()
|
||||
chain = query.get_latest_abci_chain(b.connection)
|
||||
assert chain == {'height': 0, 'chain_id': 'chain-XYZ', 'is_synced': True}
|
||||
@ -67,7 +67,7 @@ def test_init_chain_successfully_registers_chain(a, b):
|
||||
def test_init_chain_ignores_invalid_init_chain_requests(a, b):
|
||||
validators = [generate_validator()]
|
||||
request = generate_init_chain_request('chain-XYZ', validators)
|
||||
res = App(a, b).init_chain(request)
|
||||
res = App(b, a).init_chain(request)
|
||||
assert res == types.ResponseInitChain()
|
||||
|
||||
validator_set = query.get_validator_set(b.connection)
|
||||
@ -81,7 +81,7 @@ def test_init_chain_ignores_invalid_init_chain_requests(a, b):
|
||||
]
|
||||
for r in invalid_requests:
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).init_chain(r)
|
||||
App(b, a).init_chain(r)
|
||||
# assert nothing changed - neither validator set, nor chain ID
|
||||
new_validator_set = query.get_validator_set(b.connection)
|
||||
assert new_validator_set == validator_set
|
||||
@ -97,7 +97,7 @@ def test_init_chain_ignores_invalid_init_chain_requests(a, b):
|
||||
def test_init_chain_recognizes_new_chain_after_migration(a, b):
|
||||
validators = [generate_validator()]
|
||||
request = generate_init_chain_request('chain-XYZ', validators)
|
||||
res = App(a, b).init_chain(request)
|
||||
res = App(b, a).init_chain(request)
|
||||
assert res == types.ResponseInitChain()
|
||||
|
||||
validator_set = query.get_validator_set(b.connection)['validators']
|
||||
@ -116,7 +116,7 @@ def test_init_chain_recognizes_new_chain_after_migration(a, b):
|
||||
]
|
||||
for r in invalid_requests:
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).init_chain(r)
|
||||
App(b, a).init_chain(r)
|
||||
assert query.get_latest_abci_chain(b.connection) == {
|
||||
'chain_id': 'chain-XYZ-migrated-at-height-1',
|
||||
'is_synced': False,
|
||||
@ -129,7 +129,7 @@ def test_init_chain_recognizes_new_chain_after_migration(a, b):
|
||||
# completes the migration
|
||||
request = generate_init_chain_request('chain-XYZ-migrated-at-height-1',
|
||||
validators)
|
||||
res = App(a, b).init_chain(request)
|
||||
res = App(b, a).init_chain(request)
|
||||
assert res == types.ResponseInitChain()
|
||||
assert query.get_latest_abci_chain(b.connection) == {
|
||||
'chain_id': 'chain-XYZ-migrated-at-height-1',
|
||||
@ -150,7 +150,7 @@ def test_init_chain_recognizes_new_chain_after_migration(a, b):
|
||||
]
|
||||
for r in invalid_requests:
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).init_chain(r)
|
||||
App(b, a).init_chain(r)
|
||||
assert query.get_latest_abci_chain(b.connection) == {
|
||||
'chain_id': 'chain-XYZ-migrated-at-height-1',
|
||||
'is_synced': True,
|
||||
@ -167,7 +167,7 @@ def test_init_chain_recognizes_new_chain_after_migration(a, b):
|
||||
|
||||
def test_info(a, b):
|
||||
r = types.RequestInfo(version=__tm_supported_versions__[0])
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
|
||||
res = app.info(r)
|
||||
assert res.last_block_height == 0
|
||||
@ -180,7 +180,7 @@ def test_info(a, b):
|
||||
|
||||
# simulate a migration and assert the height is shifted
|
||||
b.store_abci_chain(2, 'chain-XYZ')
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
b.store_block(Block(app_hash='2', height=2, transactions=[])._asdict())
|
||||
res = app.info(r)
|
||||
assert res.last_block_height == 0
|
||||
@ -193,7 +193,7 @@ def test_info(a, b):
|
||||
|
||||
# it's always the latest migration that is taken into account
|
||||
b.store_abci_chain(4, 'chain-XYZ-new')
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
b.store_block(Block(app_hash='4', height=4, transactions=[])._asdict())
|
||||
res = app.info(r)
|
||||
assert res.last_block_height == 0
|
||||
@ -212,7 +212,7 @@ def test_check_tx__signed_create_is_ok(a, b):
|
||||
[([bob.public_key], 1)])\
|
||||
.sign([alice.private_key])
|
||||
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
result = app.check_tx(encode_tx_to_bytes(tx))
|
||||
assert result.code == OkCode
|
||||
|
||||
@ -228,7 +228,7 @@ def test_check_tx__unsigned_create_is_error(a, b):
|
||||
tx = Transaction.create([alice.public_key],
|
||||
[([bob.public_key], 1)])
|
||||
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
result = app.check_tx(encode_tx_to_bytes(tx))
|
||||
assert result.code == CodeTypeError
|
||||
|
||||
@ -283,7 +283,7 @@ def test_deliver_tx__double_spend_fails(a, b, init_chain_request):
|
||||
[([bob.public_key], 1)])\
|
||||
.sign([alice.private_key])
|
||||
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
app.init_chain(init_chain_request)
|
||||
|
||||
begin_block = types.RequestBeginBlock()
|
||||
@ -305,7 +305,7 @@ def test_deliver_transfer_tx__double_spend_fails(a, b, init_chain_request):
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.common.crypto import generate_key_pair
|
||||
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
app.init_chain(init_chain_request)
|
||||
|
||||
begin_block = types.RequestBeginBlock()
|
||||
@ -345,7 +345,7 @@ def test_deliver_transfer_tx__double_spend_fails(a, b, init_chain_request):
|
||||
|
||||
|
||||
def test_end_block_return_validator_updates(a, b, init_chain_request):
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
app.init_chain(init_chain_request)
|
||||
|
||||
begin_block = types.RequestBeginBlock()
|
||||
@ -389,7 +389,7 @@ def test_store_pre_commit_state_in_end_block(a, b, alice, init_chain_request):
|
||||
asset={'msg': 'live long and prosper'})\
|
||||
.sign([alice.private_key])
|
||||
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
app.init_chain(init_chain_request)
|
||||
|
||||
begin_block = types.RequestBeginBlock()
|
||||
@ -410,7 +410,7 @@ def test_store_pre_commit_state_in_end_block(a, b, alice, init_chain_request):
|
||||
|
||||
# simulate a chain migration and assert the height is shifted
|
||||
b.store_abci_chain(100, 'new-chain')
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
app.begin_block(begin_block)
|
||||
app.deliver_tx(encode_tx_to_bytes(tx))
|
||||
app.end_block(types.RequestEndBlock(height=1))
|
||||
@ -507,39 +507,39 @@ def test_info_aborts_if_chain_is_not_synced(a, b):
|
||||
b.store_abci_chain(0, 'chain-XYZ', False)
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).info(types.RequestInfo())
|
||||
App(b, a).info(types.RequestInfo())
|
||||
|
||||
|
||||
def test_check_tx_aborts_if_chain_is_not_synced(a, b):
|
||||
b.store_abci_chain(0, 'chain-XYZ', False)
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).check_tx('some bytes')
|
||||
App(b, a).check_tx('some bytes')
|
||||
|
||||
|
||||
def test_begin_aborts_if_chain_is_not_synced(a, b):
|
||||
b.store_abci_chain(0, 'chain-XYZ', False)
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).info(types.RequestBeginBlock())
|
||||
App(b, a).info(types.RequestBeginBlock())
|
||||
|
||||
|
||||
def test_deliver_tx_aborts_if_chain_is_not_synced(a, b):
|
||||
b.store_abci_chain(0, 'chain-XYZ', False)
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).deliver_tx('some bytes')
|
||||
App(b, a).deliver_tx('some bytes')
|
||||
|
||||
|
||||
def test_end_block_aborts_if_chain_is_not_synced(a, b):
|
||||
b.store_abci_chain(0, 'chain-XYZ', False)
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).info(types.RequestEndBlock())
|
||||
App(b, a).info(types.RequestEndBlock())
|
||||
|
||||
|
||||
def test_commit_aborts_if_chain_is_not_synced(a, b):
|
||||
b.store_abci_chain(0, 'chain-XYZ', False)
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).commit()
|
||||
App(b, a).commit()
|
||||
|
@ -25,7 +25,7 @@ def test_app(a, b, init_chain_request):
|
||||
from planetmint.common.crypto import generate_key_pair
|
||||
from planetmint.models import Transaction
|
||||
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
p = ProtocolHandler(app)
|
||||
|
||||
data = p.process('info',
|
||||
@ -150,7 +150,7 @@ def test_post_transaction_responses(tendermint_ws_url, b):
|
||||
def test_exit_when_tm_ver_not_supported(a, b):
|
||||
from planetmint import App
|
||||
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
p = ProtocolHandler(app)
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
|
@ -53,7 +53,7 @@ def generate_init_chain_request(chain_id, vals=None):
|
||||
|
||||
def test_init_chain_successfully_registers_chain(a, b):
|
||||
request = generate_init_chain_request('chain-XYZ')
|
||||
res = App(a, b).init_chain(request)
|
||||
res = App(b, a).init_chain(request)
|
||||
assert res == types.ResponseInitChain()
|
||||
chain = query.get_latest_abci_chain(b.connection)
|
||||
assert chain == {'height': 0, 'chain_id': 'chain-XYZ', 'is_synced': True}
|
||||
@ -67,7 +67,7 @@ def test_init_chain_successfully_registers_chain(a, b):
|
||||
def test_init_chain_ignores_invalid_init_chain_requests(a, b):
|
||||
validators = [generate_validator()]
|
||||
request = generate_init_chain_request('chain-XYZ', validators)
|
||||
res = App(a, b).init_chain(request)
|
||||
res = App(b, a).init_chain(request)
|
||||
assert res == types.ResponseInitChain()
|
||||
|
||||
validator_set = query.get_validator_set(b.connection)
|
||||
@ -81,7 +81,7 @@ def test_init_chain_ignores_invalid_init_chain_requests(a, b):
|
||||
]
|
||||
for r in invalid_requests:
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).init_chain(r)
|
||||
App(b, a).init_chain(r)
|
||||
# assert nothing changed - neither validator set, nor chain ID
|
||||
new_validator_set = query.get_validator_set(b.connection)
|
||||
assert new_validator_set == validator_set
|
||||
@ -97,7 +97,7 @@ def test_init_chain_ignores_invalid_init_chain_requests(a, b):
|
||||
def test_init_chain_recognizes_new_chain_after_migration(a, b):
|
||||
validators = [generate_validator()]
|
||||
request = generate_init_chain_request('chain-XYZ', validators)
|
||||
res = App(a, b).init_chain(request)
|
||||
res = App(b, a).init_chain(request)
|
||||
assert res == types.ResponseInitChain()
|
||||
|
||||
validator_set = query.get_validator_set(b.connection)['validators']
|
||||
@ -116,7 +116,7 @@ def test_init_chain_recognizes_new_chain_after_migration(a, b):
|
||||
]
|
||||
for r in invalid_requests:
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).init_chain(r)
|
||||
App(b, a).init_chain(r)
|
||||
assert query.get_latest_abci_chain(b.connection) == {
|
||||
'chain_id': 'chain-XYZ-migrated-at-height-1',
|
||||
'is_synced': False,
|
||||
@ -129,7 +129,7 @@ def test_init_chain_recognizes_new_chain_after_migration(a, b):
|
||||
# completes the migration
|
||||
request = generate_init_chain_request('chain-XYZ-migrated-at-height-1',
|
||||
validators)
|
||||
res = App(a, b).init_chain(request)
|
||||
res = App(b, a).init_chain(request)
|
||||
assert res == types.ResponseInitChain()
|
||||
assert query.get_latest_abci_chain(b.connection) == {
|
||||
'chain_id': 'chain-XYZ-migrated-at-height-1',
|
||||
@ -150,7 +150,7 @@ def test_init_chain_recognizes_new_chain_after_migration(a, b):
|
||||
]
|
||||
for r in invalid_requests:
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).init_chain(r)
|
||||
App(b, a).init_chain(r)
|
||||
assert query.get_latest_abci_chain(b.connection) == {
|
||||
'chain_id': 'chain-XYZ-migrated-at-height-1',
|
||||
'is_synced': True,
|
||||
@ -167,7 +167,7 @@ def test_init_chain_recognizes_new_chain_after_migration(a, b):
|
||||
|
||||
def test_info(a, b):
|
||||
r = types.RequestInfo(version=__tm_supported_versions__[0])
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
|
||||
res = app.info(r)
|
||||
assert res.last_block_height == 0
|
||||
@ -180,7 +180,7 @@ def test_info(a, b):
|
||||
|
||||
# simulate a migration and assert the height is shifted
|
||||
b.store_abci_chain(2, 'chain-XYZ')
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
b.store_block(Block(app_hash='2', height=2, transactions=[])._asdict())
|
||||
res = app.info(r)
|
||||
assert res.last_block_height == 0
|
||||
@ -193,7 +193,7 @@ def test_info(a, b):
|
||||
|
||||
# it's always the latest migration that is taken into account
|
||||
b.store_abci_chain(4, 'chain-XYZ-new')
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
b.store_block(Block(app_hash='4', height=4, transactions=[])._asdict())
|
||||
res = app.info(r)
|
||||
assert res.last_block_height == 0
|
||||
@ -212,9 +212,9 @@ def test_check_tx__signed_create_is_ok(a, b):
|
||||
[([bob.public_key], 1)])\
|
||||
.sign([alice.private_key])
|
||||
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
result = app.check_tx(encode_tx_to_bytes(tx))
|
||||
assert result.code == CodeTypeOk
|
||||
assert result.code == OkCode
|
||||
|
||||
|
||||
def test_check_tx__unsigned_create_is_error(a, b):
|
||||
@ -228,7 +228,7 @@ def test_check_tx__unsigned_create_is_error(a, b):
|
||||
tx = Transaction.create([alice.public_key],
|
||||
[([bob.public_key], 1)])
|
||||
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
result = app.check_tx(encode_tx_to_bytes(tx))
|
||||
assert result.code == CodeTypeError
|
||||
|
||||
@ -255,7 +255,7 @@ def test_deliver_tx__valid_create_updates_db_and_emits_event(a, b, init_chain_re
|
||||
app.begin_block(begin_block)
|
||||
|
||||
result = app.deliver_tx(encode_tx_to_bytes(tx))
|
||||
assert result.code == CodeTypeOk
|
||||
assert result.code == OkCode
|
||||
|
||||
app.end_block(types.RequestEndBlock(height=99))
|
||||
app.commit()
|
||||
@ -283,14 +283,14 @@ def test_deliver_tx__double_spend_fails(a, b, init_chain_request):
|
||||
[([bob.public_key], 1)])\
|
||||
.sign([alice.private_key])
|
||||
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
app.init_chain(init_chain_request)
|
||||
|
||||
begin_block = types.RequestBeginBlock()
|
||||
app.begin_block(begin_block)
|
||||
|
||||
result = app.deliver_tx(encode_tx_to_bytes(tx))
|
||||
assert result.code == CodeTypeOk
|
||||
assert result.code == OkCode
|
||||
|
||||
app.end_block(types.RequestEndBlock(height=99))
|
||||
app.commit()
|
||||
@ -305,7 +305,7 @@ def test_deliver_transfer_tx__double_spend_fails(a, b, init_chain_request):
|
||||
from planetmint.models import Transaction
|
||||
from planetmint.common.crypto import generate_key_pair
|
||||
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
app.init_chain(init_chain_request)
|
||||
|
||||
begin_block = types.RequestBeginBlock()
|
||||
@ -325,7 +325,7 @@ def test_deliver_transfer_tx__double_spend_fails(a, b, init_chain_request):
|
||||
.sign([alice.private_key])
|
||||
|
||||
result = app.deliver_tx(encode_tx_to_bytes(tx))
|
||||
assert result.code == CodeTypeOk
|
||||
assert result.code == OkCode
|
||||
|
||||
tx_transfer = Transaction.transfer(tx.to_inputs(),
|
||||
[([bob.public_key], 1)],
|
||||
@ -333,7 +333,7 @@ def test_deliver_transfer_tx__double_spend_fails(a, b, init_chain_request):
|
||||
.sign([alice.private_key])
|
||||
|
||||
result = app.deliver_tx(encode_tx_to_bytes(tx_transfer))
|
||||
assert result.code == CodeTypeOk
|
||||
assert result.code == OkCode
|
||||
|
||||
double_spend = Transaction.transfer(tx.to_inputs(),
|
||||
[([carly.public_key], 1)],
|
||||
@ -345,7 +345,7 @@ def test_deliver_transfer_tx__double_spend_fails(a, b, init_chain_request):
|
||||
|
||||
|
||||
def test_end_block_return_validator_updates(a, b, init_chain_request):
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
app.init_chain(init_chain_request)
|
||||
|
||||
begin_block = types.RequestBeginBlock()
|
||||
@ -389,7 +389,7 @@ def test_store_pre_commit_state_in_end_block(a, b, alice, init_chain_request):
|
||||
asset={'msg': 'live long and prosper'})\
|
||||
.sign([alice.private_key])
|
||||
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
app.init_chain(init_chain_request)
|
||||
|
||||
begin_block = types.RequestBeginBlock()
|
||||
@ -410,7 +410,7 @@ def test_store_pre_commit_state_in_end_block(a, b, alice, init_chain_request):
|
||||
|
||||
# simulate a chain migration and assert the height is shifted
|
||||
b.store_abci_chain(100, 'new-chain')
|
||||
app = App(a, b)
|
||||
app = App(b, a)
|
||||
app.begin_block(begin_block)
|
||||
app.deliver_tx(encode_tx_to_bytes(tx))
|
||||
app.end_block(types.RequestEndBlock(height=1))
|
||||
@ -507,39 +507,39 @@ def test_info_aborts_if_chain_is_not_synced(a, b):
|
||||
b.store_abci_chain(0, 'chain-XYZ', False)
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).info(types.RequestInfo())
|
||||
App(b, a).info(types.RequestInfo())
|
||||
|
||||
|
||||
def test_check_tx_aborts_if_chain_is_not_synced(a, b):
|
||||
b.store_abci_chain(0, 'chain-XYZ', False)
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).check_tx('some bytes')
|
||||
App(b, a).check_tx('some bytes')
|
||||
|
||||
|
||||
def test_begin_aborts_if_chain_is_not_synced(a, b):
|
||||
b.store_abci_chain(0, 'chain-XYZ', False)
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).info(types.RequestBeginBlock())
|
||||
App(b, a).info(types.RequestBeginBlock())
|
||||
|
||||
|
||||
def test_deliver_tx_aborts_if_chain_is_not_synced(a, b):
|
||||
b.store_abci_chain(0, 'chain-XYZ', False)
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).deliver_tx('some bytes')
|
||||
App(b, a).deliver_tx('some bytes')
|
||||
|
||||
|
||||
def test_end_block_aborts_if_chain_is_not_synced(a, b):
|
||||
b.store_abci_chain(0, 'chain-XYZ', False)
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).info(types.RequestEndBlock())
|
||||
App(b, a).info(types.RequestEndBlock())
|
||||
|
||||
|
||||
def test_commit_aborts_if_chain_is_not_synced(a, b):
|
||||
b.store_abci_chain(0, 'chain-XYZ', False)
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
App(a, b).commit()
|
||||
App(b, a).commit()
|
Loading…
x
Reference in New Issue
Block a user