omgnetwork / plasma-mvp

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

[Bug] Block objects not JSON serializable #165

Closed bh2smith closed 6 years ago

bh2smith commented 6 years ago

Issue Type

[x] bug report
[ ] feature request

Current Behavior

On call to

omg submitblock 0x3bb369fecdc16b93b99514d8ed9c2e87c5824cf4a6a98d2e8e91b7dd0c063304

Client Returns;

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Server returns;

TypeError: Object of type 'Block' is not JSON serializable

Expected Behavior

Submit block transaction would be executed.

Steps to Reproduce

  1. Follow readme to have software running as intended
  2. execute command for submit block (as in sample)

Suggested Fix

Perhaps we should provided explicit serialization of Block objects..?

Motivation for Change

Current implementation doesn't run as expected.

bh2smith commented 6 years ago

Note that one might be tempted to try including inheriting from JSONEncoder as follow

from json import JSONEncoder

class Block(rlp.Serializable, JSONEncoder):
    ETC...

but this doesn't seem to cut the mustard... Back to the drawing board

smartcontracts commented 6 years ago

Added a fix for this. Needed to RLP encode the response before sending it to the client. Can you confirm fix is working?