mirror of
https://github.com/planetmint/planetmint.git
synced 2025-07-07 21:22:28 +00:00
Solved bugs
This commit is contained in:
parent
9cf0e81813
commit
89bbabf818
@ -58,7 +58,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "26656:26656"
|
- "26656:26656"
|
||||||
- "26657:26657"
|
- "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
|
restart: always
|
||||||
bdb:
|
bdb:
|
||||||
image: busybox
|
image: busybox
|
||||||
|
@ -8,7 +8,8 @@ with Tendermint.
|
|||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
import enum
|
||||||
|
from tendermint.abci import types_pb2
|
||||||
from abci.application import BaseApplication
|
from abci.application import BaseApplication
|
||||||
from abci.application import OkCode
|
from abci.application import OkCode
|
||||||
from tendermint.abci.types_pb2 import (
|
from tendermint.abci.types_pb2 import (
|
||||||
@ -49,6 +50,10 @@ from planetmint.events import EventTypes, Event
|
|||||||
CodeTypeError = 1
|
CodeTypeError = 1
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
class TmVersion(enum.Enum):
|
||||||
|
"""Supported Tendermint versions enum"""
|
||||||
|
v0_34_11 = 'v0.34.11'
|
||||||
|
|
||||||
|
|
||||||
class App(BaseApplication):
|
class App(BaseApplication):
|
||||||
"""Bridge between Planetmint and Tendermint.
|
"""Bridge between Planetmint and Tendermint.
|
||||||
@ -59,6 +64,8 @@ class App(BaseApplication):
|
|||||||
|
|
||||||
def __init__(self, planetmint=None, events_queue=None,):
|
def __init__(self, planetmint=None, events_queue=None,):
|
||||||
#super().__init__(abci)
|
#super().__init__(abci)
|
||||||
|
logger.debug('Checking values of types')
|
||||||
|
logger.debug(dir(types_pb2))
|
||||||
self.events_queue = events_queue
|
self.events_queue = events_queue
|
||||||
self.planetmint = planetmint or Planetmint()
|
self.planetmint = planetmint or Planetmint()
|
||||||
self.block_txn_ids = []
|
self.block_txn_ids = []
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
import base64
|
import base64
|
||||||
import binascii
|
import binascii
|
||||||
import codecs
|
import codecs
|
||||||
|
import enum
|
||||||
|
|
||||||
import planetmint
|
import planetmint
|
||||||
from tendermint.abci import types_pb2 as types_v0_34_11
|
from tendermint.abci import types_pb2 as types_v0_34_11
|
||||||
from planetmint.common.exceptions import InvalidPublicKey, BigchainDBError
|
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):
|
def encode_validator(v):
|
||||||
ed25519_public_key = v['public_key']['value']
|
ed25519_public_key = v['public_key']['value']
|
||||||
|
@ -236,8 +236,8 @@ def merlin():
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def a():
|
def a():
|
||||||
from abci import types_v0_31_5
|
from tendermint.abci import types_pb2 as types_v0_34_11
|
||||||
return types_v0_31_5
|
return types_v0_34_11
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@ -442,11 +442,11 @@ def event_loop():
|
|||||||
@pytest.fixture(scope='session')
|
@pytest.fixture(scope='session')
|
||||||
def abci_server():
|
def abci_server():
|
||||||
from abci.server import ABCIServer
|
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.core import App
|
||||||
from planetmint.utils import Process
|
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)
|
abci_proxy = Process(name='ABCI', target=app.run)
|
||||||
yield abci_proxy.start()
|
yield abci_proxy.start()
|
||||||
abci_proxy.terminate()
|
abci_proxy.terminate()
|
||||||
|
@ -6,7 +6,7 @@ from planetmint.lib import Block
|
|||||||
from planetmint.elections.election import Election
|
from planetmint.elections.election import Election
|
||||||
from planetmint.migrations.chain_migration_election import ChainMigrationElection
|
from planetmint.migrations.chain_migration_election import ChainMigrationElection
|
||||||
from planetmint.upsert_validator.validator_election import ValidatorElection
|
from planetmint.upsert_validator.validator_election import ValidatorElection
|
||||||
|
from planetmint.core import TmVersion
|
||||||
|
|
||||||
@pytest.mark.bdb
|
@pytest.mark.bdb
|
||||||
def test_process_block_concludes_all_elections(b):
|
def test_process_block_concludes_all_elections(b):
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
import codecs
|
import codecs
|
||||||
|
|
||||||
from abci import types_v0_31_5 as types
|
from tendermint.abci import types_pb2 as types
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -7,12 +7,12 @@ import json
|
|||||||
import pytest
|
import pytest
|
||||||
import random
|
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 import App
|
||||||
from planetmint.backend.localmongodb import query
|
from planetmint.backend.localmongodb import query
|
||||||
from planetmint.common.crypto import generate_key_pair
|
from planetmint.common.crypto import generate_key_pair
|
||||||
from planetmint.core import (CodeTypeOk,
|
from planetmint.core import (OkCode,
|
||||||
CodeTypeError,
|
CodeTypeError,
|
||||||
rollback)
|
rollback)
|
||||||
from planetmint.elections.election import Election
|
from planetmint.elections.election import Election
|
||||||
@ -213,7 +213,7 @@ def test_check_tx__signed_create_is_ok(a, b):
|
|||||||
|
|
||||||
app = App(a, b)
|
app = App(a, b)
|
||||||
result = app.check_tx(encode_tx_to_bytes(tx))
|
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):
|
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)
|
app.begin_block(begin_block)
|
||||||
|
|
||||||
result = app.deliver_tx(encode_tx_to_bytes(tx))
|
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.end_block(types.RequestEndBlock(height=99))
|
||||||
app.commit()
|
app.commit()
|
||||||
@ -289,7 +289,7 @@ def test_deliver_tx__double_spend_fails(a, b, init_chain_request):
|
|||||||
app.begin_block(begin_block)
|
app.begin_block(begin_block)
|
||||||
|
|
||||||
result = app.deliver_tx(encode_tx_to_bytes(tx))
|
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.end_block(types.RequestEndBlock(height=99))
|
||||||
app.commit()
|
app.commit()
|
||||||
@ -324,7 +324,7 @@ def test_deliver_transfer_tx__double_spend_fails(a, b, init_chain_request):
|
|||||||
.sign([alice.private_key])
|
.sign([alice.private_key])
|
||||||
|
|
||||||
result = app.deliver_tx(encode_tx_to_bytes(tx))
|
result = app.deliver_tx(encode_tx_to_bytes(tx))
|
||||||
assert result.code == CodeTypeOk
|
assert result.code == OkCode
|
||||||
|
|
||||||
tx_transfer = Transaction.transfer(tx.to_inputs(),
|
tx_transfer = Transaction.transfer(tx.to_inputs(),
|
||||||
[([bob.public_key], 1)],
|
[([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])
|
.sign([alice.private_key])
|
||||||
|
|
||||||
result = app.deliver_tx(encode_tx_to_bytes(tx_transfer))
|
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(),
|
double_spend = Transaction.transfer(tx.to_inputs(),
|
||||||
[([carly.public_key], 1)],
|
[([carly.public_key], 1)],
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
|
|
||||||
from abci import types_v0_31_5 as types
|
from tendermint.abci import types_pb2 as types
|
||||||
import json
|
import json
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
from abci.server import ProtocolHandler
|
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.common.transaction_mode_types import BROADCAST_TX_COMMIT, BROADCAST_TX_SYNC
|
||||||
from planetmint.version import __tm_supported_versions__
|
from planetmint.version import __tm_supported_versions__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user