Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

parity.js native Error with : api.util.decodeMethodInput(methodAbi,callData.paramdata); #5492

Closed
wighawag opened this issue Apr 23, 2017 · 3 comments
Assignees
Labels
F2-bug 🐞 The client fails to follow expected behavior.

Comments

@wighawag
Copy link

Here is the error I get :

C:\Users\wighawag\experiments\ethreader\node_modules\@parity\parity.js\library.js:2
},{name:"shake",padding:u,bits:h,createMethod:_}],b={},m=0;m<g.length;++m)for(var w=g[m],x=w.bits,k=0;k<x.length;++k)b[w.name+"_"+x[k]]=w.createMethod(x[k],w.padding);e.prototype.update=function(t){var e="string"!=typeof t;e&&t.constructor==n.ArrayBuffer&&(t=new Uint8Array(t));for(var r,i,o=t.length,u=this.blocks,c=this.byteCount,s=this.blockCount,f=0,l=this.s;f<o;){if(this.reset)for(this.reset=!1,u[0]=this.block,r=1;r<s+1;++r)u[r]=0;if(e)for(r=this.start;f<o&&r<c;++f)u[r>>2]|=t[f]<<a[3&r++];else for(r=this.start;f<o&&r<c;++f)i=t.charCodeAt(f),i<128?u[r>>2]|=i<<a[3&r++]:i<2048?(u[r>>2]|=(192|i>>6)<<a[3&r++],u[r>>2]|=(128|63&i)<<a[3&r++]):i<55296||i>=57344?(u[r>>2]|=(224|i>>12)<<a[3&r++],u[r>>2]|=(128|i>>6&63)<<a[3&r++],u[r>>2]|=(128|63&i)<<a[3&r++]):(i=65536+((1023&i)<<10|1023&t.charCodeAt(++f)),u[r>>2]|=(240|i>>18)<<a[3&r++],u[r>>2]|=(128|i>>12&63)<<a[3&r++],u[r>>2]|=(128|i>>6&63)<<a[3&r++],u[r>>2]|=(128|63&i)<<a[3&r++]);if(th

Error: Invalid continuation byte
    at Error (native)
    at l (C:\Users\wighawag\experiments\ethreader\node_modules\@parity\parity.js\library.js:2:28417)
    at h (C:\Users\wighawag\experiments\ethreader\node_modules\@parity\parity.js\library.js:2:28694)
    at Object.p [as decode] (C:\Users\wighawag\experiments\ethreader\node_modules\@parity\parity.js\library.js:2:28975)
    at Function.value (C:\Users\wighawag\experiments\ethreader\node_modules\@parity\parity.js\library.js:2:13755)
    at C:\Users\wighawag\experiments\ethreader\node_modules\@parity\parity.js\library.js:2:12416
    at Array.map (native)
    at Function.value (C:\Users\wighawag\experiments\ethreader\node_modules\@parity\parity.js\library.js:2:12392)
    at t.value (C:\Users\wighawag\experiments\ethreader\node_modules\@parity\parity.js\library.js:2:16284)
    at i (C:\Users\wighawag\experiments\ethreader\node_modules\@parity\parity.js\library.js:7:28586)

when executing

api.util.decodeMethodInput(methodAbi,callData.paramdata);

with as parameter:

methodAbi =

{
        constant : false,
        inputs : [{
                        name : _to,
                        type : address
                },{
                        name : _identity,
                        type : string
                }],
        name : mint,
        outputs : [{
                        name : success,
                        type : bool
                }],
        type : function
}

and paramData =

0x0000000000000000000000007ac12e45af3a64728de339d42eeba1545fd1a8fe0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001c4564756172646f204665726ee16e64657a2028406564756172646f2900000000

Note: tested on windows only

@5chdn 5chdn added the F2-bug 🐞 The client fails to follow expected behavior. label Apr 24, 2017
@ngotchac
Copy link
Contributor

ngotchac commented Apr 26, 2017

Can I ask you where did you get this paramData from ?
Because strings are supposed to be encoded as UTF-8, and the one you provided seems to be standard ASCII (the value being Eduardo Fernández (@eduardo)):

  • UTF-8: 0x4564756172646f204665726e c3a1 6e64657a2028406564756172646f29
  • ASCII: 0x4564756172646f204665726e e1 6e64657a2028406564756172646f29

The encoding of the á is different

@ngotchac
Copy link
Contributor

@jacogr Here's the issue : https://github.com/paritytech/parity/blob/30b3b5e2a7ebaea2a9e21f7bc11629892f2da905/js/src/abi/decoder/decoder.js#L116

We might want to try to decode as ASCII if the UTF8 decoding fails, but I'm not sure...

@wighawag
Copy link
Author

Sorry to getting back only now,

the data was from the original devcon 2 token contract (0x0a43edfe106d295e7c1e591a4b04b5598af9474c) and the paramData come from calling
_api.util.decodeCallData(transaction.input).paramdata

you can see the error in action with https://github.com/etherplay/ethreader

@ngotchac ngotchac self-assigned this May 2, 2017
ngotchac added a commit that referenced this issue May 2, 2017
jacogr pushed a commit that referenced this issue May 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F2-bug 🐞 The client fails to follow expected behavior.
Projects
None yet
Development

No branches or pull requests

3 participants