omgnetwork / plasma-mvp

OmiseGO's research implementation of Minimal Viable Plasma
MIT License
561 stars 158 forks source link

Have Client automatically decode things #100

Closed smartcontracts closed 6 years ago

smartcontracts commented 6 years ago

Client doesn't decode anything that it receives from ChildChainService. This means that everything using Client needs to manually decode its output.

For example, get_current_block returns the hex-encoded block:

    def get_current_block(self):
        return self.child_chain.get_current_block()

Instead, it should return the Block object:

import rlp
from ethereum import utils
...
    def get_current_block(self):
        encoded_block = self.child_chain.get_current_block()
        return rlp.decode(utils.decode_hex(encoded_block), Block)