mirror of
https://github.com/planetmint/planetmint.git
synced 2025-03-30 15:08:31 +00:00
Solved bugs
This commit is contained in:
parent
9cf0e81813
commit
89bbabf818
@ -58,7 +58,7 @@ services:
|
||||
ports:
|
||||
- "26656:26656"
|
||||
- "26657:26657"
|
||||
command: sh -c "tendermint init && tendermint node --consensus.create_empty_blocks=false --proxy_app=tcp://planetmint:26658"
|
||||
command: sh -c "tendermint init && tendermint node --consensus.create_empty_blocks=false --rpc.laddr=tcp://0.0.0.0:26657 --proxy_app=tcp://planetmint:26658"
|
||||
restart: always
|
||||
bdb:
|
||||
image: busybox
|
||||
|
@ -8,7 +8,8 @@ with Tendermint.
|
||||
"""
|
||||
import logging
|
||||
import sys
|
||||
|
||||
import enum
|
||||
from tendermint.abci import types_pb2
|
||||
from abci.application import BaseApplication
|
||||
from abci.application import OkCode
|
||||
from tendermint.abci.types_pb2 import (
|
||||
@ -49,6 +50,10 @@ 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.
|
||||
@ -59,6 +64,8 @@ class App(BaseApplication):
|
||||
|
||||
def __init__(self, planetmint=None, events_queue=None,):
|
||||
#super().__init__(abci)
|
||||
logger.debug('Checking values of types')
|
||||
logger.debug(dir(types_pb2))
|
||||
self.events_queue = events_queue
|
||||
self.planetmint = planetmint or Planetmint()
|
||||
self.block_txn_ids = []
|
||||
|
@ -1,11 +1,15 @@
|
||||
import base64
|
||||
import binascii
|
||||
import codecs
|
||||
import enum
|
||||
|
||||
import planetmint
|
||||
from tendermint.abci import types_pb2 as types_v0_34_11
|
||||
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']
|
||||
|
@ -236,8 +236,8 @@ def merlin():
|
||||
|
||||
@pytest.fixture
|
||||
def a():
|
||||
from abci import types_v0_31_5
|
||||
return types_v0_31_5
|
||||
from tendermint.abci import types_pb2 as types_v0_34_11
|
||||
return types_v0_34_11
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@ -442,11 +442,11 @@ def event_loop():
|
||||
@pytest.fixture(scope='session')
|
||||
def abci_server():
|
||||
from abci.server import ABCIServer
|
||||
from abci import types_v0_31_5
|
||||
from tendermint.abci import types_pb2 as types_v0_34_11
|
||||
from planetmint.core import App
|
||||
from planetmint.utils import Process
|
||||
|
||||
app = ABCIServer(app=App(types_v0_31_5))
|
||||
app = ABCIServer(app=App(types_v0_34_11))
|
||||
abci_proxy = Process(name='ABCI', target=app.run)
|
||||
yield abci_proxy.start()
|
||||
abci_proxy.terminate()
|
||||
|
@ -6,7 +6,7 @@ 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):
|
||||
|
@ -6,7 +6,7 @@
|
||||
import pytest
|
||||
import codecs
|
||||
|
||||
from abci import types_v0_31_5 as types
|
||||
from tendermint.abci import types_pb2 as types
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -7,12 +7,12 @@ import json
|
||||
import pytest
|
||||
import random
|
||||
|
||||
from abci import types_v0_31_5 as types
|
||||
from tendermint.abci import types_pb2 as types
|
||||
|
||||
from planetmint import App
|
||||
from planetmint.backend.localmongodb import query
|
||||
from planetmint.common.crypto import generate_key_pair
|
||||
from planetmint.core import (CodeTypeOk,
|
||||
from planetmint.core import (OkCode,
|
||||
CodeTypeError,
|
||||
rollback)
|
||||
from planetmint.elections.election import Election
|
||||
@ -213,7 +213,7 @@ def test_check_tx__signed_create_is_ok(a, b):
|
||||
|
||||
app = App(a, b)
|
||||
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):
|
||||
@ -254,7 +254,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()
|
||||
@ -289,7 +289,7 @@ def test_deliver_tx__double_spend_fails(a, b, init_chain_request):
|
||||
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()
|
||||
@ -324,7 +324,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)],
|
||||
@ -332,7 +332,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)],
|
||||
|
@ -5,13 +5,13 @@
|
||||
|
||||
import codecs
|
||||
|
||||
from abci import types_v0_31_5 as types
|
||||
from tendermint.abci import types_pb2 as types
|
||||
import json
|
||||
import pytest
|
||||
|
||||
|
||||
from abci.server import ProtocolHandler
|
||||
from abci.encoding import read_messages
|
||||
from abci.utils import read_messages
|
||||
|
||||
from planetmint.common.transaction_mode_types import BROADCAST_TX_COMMIT, BROADCAST_TX_SYNC
|
||||
from planetmint.version import __tm_supported_versions__
|
||||
|
Loading…
x
Reference in New Issue
Block a user