-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Show contract parameters in MethodDecoding #4024
Conversation
Changes Unknown when pulling 03e36cc on ng-decode-deployments into ** on master**. |
@@ -31,6 +31,12 @@ export default class Param { | |||
} | |||
|
|||
static toParams (params) { | |||
return params.map((param) => new Param(param.name, param.type)); | |||
return params.map((param) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we just add a relevant test that verifies both behaviours? (these should be one that just verifies the original)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -534,7 +536,7 @@ class AddressSelect extends Component { | |||
}); | |||
} | |||
|
|||
handleFocus = () => { | |||
handleFocus = (e) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the (unused) variable here? Consider at least a description name - no e
that can be anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to remove this one
const param = this.getParam(); | ||
|
||
const realValue = value | ||
? (new BigNumber(value))[readOnly ? 'toFormat' : 'toNumber']() | ||
? this.getNumberValue(value)[readOnly ? 'toFormat' : 'toNumber']() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will probably break when getNumberValue
returns from the first test, i.e. where it is null or undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well it checks if value
is truthy
before. Agreed it could be better though
const param = this.getParam(); | ||
|
||
const realValue = value | ||
? (new BigNumber(value))[readOnly ? 'toFormat' : 'toNumber']() | ||
? this.getNumberValue(value)[readOnly ? 'toFormat' : 'toNumber']() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same breakage comment here since the function may return something without toFormat/toNumber
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
// (minus the bytecode). It seems that they are repeated | ||
// twice | ||
const params = rawInput.slice(codeOffset + rawCode.length); | ||
const paramsBis = params.slice(params.length / 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not 100% sure what paramBis
refers to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the thing is that from what I saw, the transaction input is : somehting
. bytecode
. constructor_params
. constructor_params
Ie. the constructor params are concatenated twice at the end of the input. From what I could find online (which isn't much), it seems that the parameters should appear once. That's why I thought we could try the two cases, and result with which ever is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Umm... the 2 concats sounds like a bug on our side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I initially thought, will dig around a bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we leave this one open until we have resolution or merge and come back to fix the double check when the above is resolved?
(I'm leaning to the former since this is new functionality and would rather get it right first time around, especially since we have code work-arounds in here for the potential issue.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to merge this one first yes
Closes #3715
Show the contract parameters in MethodDecoding when possible, ie. when the contract has been added from/in the UI. Otherwise, as there is no Constructor signature in the transaction input, it is (AFAICT) impossible to decode the parameters.