Skip to content

Instantly share code, notes, and snippets.

@mhchia
Last active August 4, 2017 03:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhchia/d39d7e0dbbd50c95cf65b98d5c6d597f to your computer and use it in GitHub Desktop.
Save mhchia/d39d7e0dbbd50c95cf65b98d5c6d597f to your computer and use it in GitHub Desktop.
I fail to use `RLPList` in viper in this case
from ethereum.tools import tester as t
from ethereum import utils
import rlp
code = """
def test(a1: bytes <= 1000) -> num:
tempa = RLPList(a1, [num])
return tempa[0]
"""
c = t.Chain()
x = c.contract(code, language='viper')
a = rlp.encode([10])
print(x.test(a))
@vbuterin
Copy link

vbuterin commented Aug 4, 2017

The issue is because you didn't publish the RLP decoder contract to the chain. You want to publish the tx:

0xf90237808506fc23ac00830330888080b902246102128061000e60003961022056600060007f010000000000000000000000000000000000000000000000000000000000000060003504600060c082121515585760f882121561004d5760bf820336141558576001905061006e565b600181013560f783036020035260005160f6830301361415585760f6820390505b5b368112156101c2577f010000000000000000000000000000000000000000000000000000000000000081350483602086026040015260018501945060808112156100d55760018461044001526001828561046001376001820191506021840193506101bc565b60b881121561014357608081038461044001526080810360018301856104600137608181141561012e5760807f010000000000000000000000000000000000000000000000000000000000000060018401350412151558575b607f81038201915060608103840193506101bb565b60c08112156101b857600182013560b782036020035260005160388112157f010000000000000000000000000000000000000000000000000000000000000060018501350402155857808561044001528060b6838501038661046001378060b6830301830192506020810185019450506101ba565bfe5b5b5b5061006f565b601f841315155857602060208502016020810391505b6000821215156101fc578082604001510182826104400301526020820391506101d8565b808401610420528381018161044003f350505050505b6000f31b2d4f

Obviously first send a bit of ETH to the sender to pay for gas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment