Skip to content

Commit

Permalink
Revert "Merge pull request #358 from hyperledger/increase-mx-size-lim…
Browse files Browse the repository at this point in the history
…it" (#372)

This reverts commit 1ba2d75.
  • Loading branch information
Andrei Goncharov authored Sep 6, 2017
1 parent 8642be5 commit c37e835
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 28 deletions.
9 changes: 1 addition & 8 deletions plenum/test/cli/test_long_msg_err.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@
import pytest
from stp_core.common.log import Logger

@pytest.fixture(scope="function")
def patch_msg_len(tconf):
old_value = tconf.MSG_LEN_LIMIT
tconf.MSG_LEN_LIMIT = 128 * 1024
yield tconf.MSG_LEN_LIMIT
print(old_value)
tconf.MSG_LEN_LIMIT = old_value

def test_error_if_long_message(
patch_msg_len, cli, tconf, createAllNodes, validNodeNames, set_info_log_level):
cli, tconf, createAllNodes, validNodeNames, set_info_log_level):
operation = '{{"Hello": "{}"}}'.format("T" * tconf.MSG_LEN_LIMIT)
createClientAndConnect(cli, validNodeNames, "Alice")

Expand Down
4 changes: 1 addition & 3 deletions stp_core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,4 @@


# All messages exceeding the limit will be rejected without processing
# TODO: need to think about a lower value; currently low value leads to
# problems with batching on transport level
MSG_LEN_LIMIT = 128 * 1024 * 1024
MSG_LEN_LIMIT = 128 * 1024
27 changes: 10 additions & 17 deletions stp_zmq/test/test_zstack.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import pytest
from stp_core.common.util import adict

from stp_core.crypto.util import randomSeed
from stp_core.loop.eventually import eventually
from stp_core.network.port_dispenser import genHa
from stp_core.test.helper import Printer, prepStacks, chkPrinted
from stp_zmq.test.helper import genKeys, create_and_prep_stacks, \
check_stacks_communicating, get_file_permission_mask, get_zstack_key_paths
from stp_zmq.zstack import ZStack
from stp_core.common.util import adict


def testRestricted2ZStackCommunication(tdir, looper, tconf):
Expand Down Expand Up @@ -81,7 +82,7 @@ def test_zstack_non_utf8(tdir, looper, tconf):
alpha.transmit(b'{"k2": "v2\x9c"}', uid, serialized=True)
with pytest.raises(AssertionError):
looper.run(eventually(chkPrinted, betaP, {"k2": "v2\x9c"}))
# TODO: A better test where the output of the parsing method is checked
# TODO: A better test where the output of the parsing method is checked
# requires spyable methods

# Again send a utf-8 message and see its received (checks if stack is
Expand Down Expand Up @@ -158,21 +159,13 @@ def create_stack(name, handler=None):

assert len(received_messages) != 0
assert len(expected_messages) == len(received_messages), \
"{} != {}, LAST IS {}".format(len(expected_messages),
len(received_messages),
received_messages[-1])


@pytest.fixture(scope="function")
def patch_msg_len(tconf):
old_value = tconf.MSG_LEN_LIMIT
tconf.MSG_LEN_LIMIT = 128 * 1024
yield tconf.MSG_LEN_LIMIT
print(old_value)
tconf.MSG_LEN_LIMIT = old_value
"{} != {}, LAST IS {}"\
.format(len(expected_messages),
len(received_messages),
received_messages[-1])


def testZStackSendRecvHugeDataUnderLimit(patch_msg_len, tdir, looper, tconf):
def testZStackSendRecvHugeDataUnderLimit(tdir, looper, tconf):
names = ['Alpha', 'Beta']
genKeys(tdir, names)

Expand Down Expand Up @@ -209,7 +202,7 @@ def recvHandlerBeta(wrpMsg):
assert betaHandler[0] is True


def testZStackSendHugeDataOverLimit(patch_msg_len, tdir, looper, tconf):
def testZStackSendHugeDataOverLimit(tdir, looper, tconf):
names = ['Alpha', 'Beta']
genKeys(tdir, names)

Expand Down Expand Up @@ -254,7 +247,7 @@ def rejectHandlerBeta(reason, frm):
assert betaHandlers[1] is False


def testZStackRecvHugeDataOverLimit(patch_msg_len, tdir, looper, tconf):
def testZStackRecvHugeDataOverLimit(tdir, looper, tconf):
names = ['Alpha', 'Beta']
genKeys(tdir, names)

Expand Down

0 comments on commit c37e835

Please sign in to comment.