Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Ensure JSON RPC requests end with newline #1388

Merged
merged 1 commit into from Dec 13, 2019

Conversation

cburgdorf
Copy link
Contributor

@cburgdorf cburgdorf commented Dec 12, 2019

What was wrong?

This is basically #1121 which I can not reopen for some reason.

dopple does currently not work with Trinity because it assumes that every response ends with a newline character.

        response = b''
        while True:
            r = self.conn.recv(BUFSIZE)
            if not r:
                break
            if r[-1] == DELIMITER:
                response += r[:-1]
                break
            response += r

        return response

How was it fixed?

We could change dopple to not rely on newlines and match closing brackets instead (this is what web3.py does) but I don't think it's worth is because:

  1. Other clients (at least geth and aleth) end responses with new lines so maybe they are right about that?

  2. It is very easy to fix this on our part and just add that newline

  3. Bracket matching will be slower and it might not feel like a good move to others to make dopple slower just to be compatible to Trinity.

After talking to @carver about this recently, I'm convinced we should just add that newline on our end.

To-Do

  • Clean up commit history

Cute Animal Picture

put a cute animal picture link inside the parentheses

@cburgdorf cburgdorf merged commit 472fd6f into ethereum:master Dec 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants