Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand jsonschema requirements to <4 #1446

Merged
merged 1 commit into from
Sep 12, 2019
Merged

Conversation

Code0x58
Copy link
Contributor

@Code0x58 Code0x58 commented Sep 5, 2019

This expands the range of allowed jsonschema versions as 3.0.0+ versions have been around for over 6 months.

It looks like the only change is that the default jsonschema draft went from version 4 to 7 [changelog][diff], so this PR explicitly uses 4 to avoid the need to look into more changes.

The test failures appear to be down to flaking being addressed in #1447

Test error report
=================================== FAILURES ===================================
________________ TestParityShhModuleTest.test_shh_remove_filter ________________

self = <parity.test_parity_ws.TestParityShhModuleTest object at 0x7f85f31503d0>
web3 = <web3.main.Web3 object at 0x7f85f2ec5690>

    def test_shh_remove_filter(self, web3):
        receiver = web3.parity.shh.newKeyPair()
        receiver_pub = web3.parity.shh.getPublicKey(receiver)
    
        payload = web3.toHex(text="test message :)")
        topic = '0x13370000'
        shh_filter = web3.parity.shh.newMessageFilter({'decryptWith': None, 'topics': [topic]})
    
>       assert web3.parity.shh.post({
            'payload': payload,
            'topics': [topic],
            'to': {'public': receiver_pub},
            'priority': 500,
            'ttl': 400,
        })

payload    = '0x74657374206d657373616765203a29'
receiver   = '0x71452d27dd134d5ab03f1fd38628f827dcd5f4c350b08edcfd449b229f8b3ddd'
receiver_pub = '0x52d49e6d285c16c0ef8ab912b578894d591740484ae64b21762e4b3599621f4708a8b99b9d73cdb0c8f1ed79b614877c5fd7852170d82eb03e821360f7125611'
self       = <parity.test_parity_ws.TestParityShhModuleTest object at 0x7f85f31503d0>
shh_filter = '0x179c5a9472c1f9b23dc3defd9dd3155bb009d3e564652cafc6ffc85f3c50bfdb'
topic      = '0x13370000'
web3       = <web3.main.Web3 object at 0x7f85f2ec5690>

web3/_utils/module_testing/shh_module.py:323: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
web3/module.py:12: in caller
    w3.manager.request_blocking(method_str, params),
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <web3.manager.RequestManager object at 0x7f85f2ec5250>
method = 'shh_post'
params = ({'payload': '0x74657374206d657373616765203a29', 'priority': 500, 'to': {'public': '0x52d49e6d285c16c0ef8ab912b578894d...b21762e4b3599621f4708a8b99b9d73cdb0c8f1ed79b614877c5fd7852170d82eb03e821360f7125611'}, 'topics': ['0x13370000'], ...},)

    def request_blocking(self, method, params):
        """
        Make a synchronous request using the provider
        """
        response = self._make_request(method, params)
    
        if "error" in response:
>           raise ValueError(response["error"])
E           ValueError: {'code': -32085, 'message': 'PoW too low to compete with other messages'}

method     = 'shh_post'
params     = ({'payload': '0x74657374206d657373616765203a29', 'priority': 500, 'to': {'public': '0x52d49e6d285c16c0ef8ab912b578894d...b21762e4b3599621f4708a8b99b9d73cdb0c8f1ed79b614877c5fd7852170d82eb03e821360f7125611'}, 'topics': ['0x13370000'], ...},)
response   = {'error': {'code': -32085, 'message': 'PoW too low to compete with other messages'}, 'id': 243, 'jsonrpc': '2.0'}
self       = <web3.manager.RequestManager object at 0x7f85f2ec5250>

web3/manager.py:97: ValueError
____________________ TestParityShhModuleTest.test_shh_post _____________________

self = <parity.test_parity_ws.TestParityShhModuleTest object at 0x7f85d8418790>
web3 = <web3.main.Web3 object at 0x7f85f2ec5690>

    def test_shh_post(self, web3):
        sender = web3.parity.shh.newKeyPair()
>       assert web3.parity.shh.post({
            "topics": ["0x12345678"],
            "payload": web3.toHex(text="testing shh on web3.py"),
            "from": sender,
            "priority": 40,
            "ttl": 400,
        })

self       = <parity.test_parity_ws.TestParityShhModuleTest object at 0x7f85d8418790>
sender     = '0x4326bbe69c16d362bb6417ca5599c57a4b36072e3cfae82b2825d3d701116204'
web3       = <web3.main.Web3 object at 0x7f85f2ec5690>

web3/_utils/module_testing/shh_module.py:380: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
web3/module.py:12: in caller
    w3.manager.request_blocking(method_str, params),
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <web3.manager.RequestManager object at 0x7f85f2ec5250>
method = 'shh_post'
params = ({'from': '0x4326bbe69c16d362bb6417ca5599c57a4b36072e3cfae82b2825d3d701116204', 'payload': '0x74657374696e6720736868206f6e20776562332e7079', 'priority': 40, 'topics': ['0x12345678'], ...},)

    def request_blocking(self, method, params):
        """
        Make a synchronous request using the provider
        """
        response = self._make_request(method, params)
    
        if "error" in response:
>           raise ValueError(response["error"])
E           ValueError: {'code': -32085, 'message': 'PoW too low to compete with other messages'}

method     = 'shh_post'
params     = ({'from': '0x4326bbe69c16d362bb6417ca5599c57a4b36072e3cfae82b2825d3d701116204', 'payload': '0x74657374696e6720736868206f6e20776562332e7079', 'priority': 40, 'topics': ['0x12345678'], ...},)
response   = {'error': {'code': -32085, 'message': 'PoW too low to compete with other messages'}, 'id': 258, 'jsonrpc': '2.0'}
self       = <web3.manager.RequestManager object at 0x7f85f2ec5250>

web3/manager.py:97: ValueError
Cute animal picture

web3.py/CONTRIBUTING.md

Lines 10 to 14 in 4a98f1a

# Cute Animal Pictures
All pull requests need to have a cute animal picture. This is a very important
part of the development process.

not the kind of bat you usually see on GitHub

@Code0x58 Code0x58 force-pushed the jsonschema branch 2 times, most recently from 30558f5 to 4db5d05 Compare September 5, 2019 13:43
@Code0x58 Code0x58 closed this Sep 5, 2019
@Code0x58 Code0x58 reopened this Sep 5, 2019
@Code0x58 Code0x58 force-pushed the jsonschema branch 4 times, most recently from 398d279 to 85d0324 Compare September 5, 2019 15:27
@Code0x58 Code0x58 changed the title WIP: Allow jsonschema <3.1 WIP: Increase jsonschema limit to <4 Sep 5, 2019
@Code0x58 Code0x58 changed the title WIP: Increase jsonschema limit to <4 Expand jsonschema requirements to <4 Sep 5, 2019
setup.py Outdated Show resolved Hide resolved
@Code0x58 Code0x58 force-pushed the jsonschema branch 2 times, most recently from 120556d to b423239 Compare September 7, 2019 13:10
Copy link
Collaborator

@kclowes kclowes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Code0x58! This looks good to me!

@kclowes kclowes merged commit 677cc87 into ethereum:master Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants