CityOfZion / neo3-preview

A block explorer and preview of the NEO 3.0 ecosystem
https://neo3-preview.com/
MIT License
5 stars 5 forks source link

fix neo-vm script dissassembler #77

Closed ixje closed 4 years ago

ixje commented 4 years ago

Here's the fixed VM script disassembler. I don't remember how to test things in javascript and I couldn't find any examples in the repo, so I'll leave that up to you.

Things I did:

Results:

disassemble("DAUA6HZIFwwUZN9OvpIzTR/H5kvx0eM5QtmQXlEMFM5hb390YX4PxLgFWDryYCojjfY/E8AMCHRyYW5zZmVyDBQwP75r/oFnA5XLgzPAxIoULlM+hkFifVtS")

PUSHDATA1 00e8764817
PUSHDATA1 64df4ebe92334d1fc7e64bf1d1e33942d9905e51
PUSHDATA1 ce616f7f74617e0fc4b805583af2602a238df63f
PUSH3
PACK
PUSHDATA1 7472616e73666572
PUSHDATA1 303fbe6bfe81670395cb8333c0c48a142e533e86
SYSCALL System.Contract.Call
disassemble("DCEDYrrCWFTmuxxVUqps9dCkz5I6Lakdvigg1DlngAs+24ULQQqQatQ=")

PUSHDATA1 0362bac25854e6bb1c5552aa6cf5d0a4cf923a2da91dbe2820d43967800b3edb85
PUSHNULL
SYSCALL Neo.Crypto.ECDsaVerify

I've manually verified the output against the C# VM and it matches.

I'd personally change the disassemble function to take a plain hex-string (or even better a buffer) instead of the base64 encoded hex-string to make it more re-usable. But the current way is the closest as to how the previous function was. Take it as you please :)

ixje commented 4 years ago

@comountainclimber it fails on linting. It would be great if you can pull it through some auto formatter according to the rules you've setup. I don't know what tools to use for it.

comountainclimber commented 4 years ago

Amazing work @ixje thank you for all of your help with this