Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Add functions to generate the bytecode for methodId and msg.data #134

Closed
aflesher opened this issue Jun 11, 2018 · 2 comments
Closed

Add functions to generate the bytecode for methodId and msg.data #134

aflesher opened this issue Jun 11, 2018 · 2 comments

Comments

@aflesher
Copy link

OpenZeppelin Solidity recently added some new features to the SignatureBouncer contract . These features allow a bouncer account to whitelist any address to an external method or an external method + parameters via an off-chain signature. These off-chain signatures require that the methodId bytecode and the msg.data bytecode are included in the signatures data to sign. The features I'm suggesting would be two new functions that would generate the bytecode needed for the signature.

 /**
  * Generates the bytecode for a methodId
  * @method generateMethodId
  * @param {String} methodName The name of the method
  * @param {String(s)} ...paramTypes Zero or more parameter types  
  * @return {String} The methodId bytecode
  */

You can see an example here

/**
  * Generates the bytecode for msg.data
  * @method generateMsgData
  * @param {String} methodName The name of the method
  * @param {Object(s)} ...paramTypesAndValues Zero or more params in the format:
  * * `key` - the data type of the param
  * * `value` - the value of the param (use null for for see signatures) 
  * @return {String} The msgData bytecode
  */

Constructing msg.data is much more complex than the methodId. You can see this explanation for more details.

I can do the work and submit a pr for these features if it's gets the ok.

@frangio
Copy link

frangio commented Jun 11, 2018

Hey @aflesher, I just left a comment in the OpenZeppelin PR, but does getData from web3.js solve what you're looking for?

@aflesher
Copy link
Author

@frangio I'm just following the conversation on the other pr. I wasn't aware that web3 had a getData function 😨 . Let's just close this issue unless you disagree.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants