Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ethereal Hackathon Bounty: AdEx: generate identity proxy bytecode without solc #62

Closed
Ivshti opened this issue Apr 6, 2019 · 12 comments

Comments

@Ivshti
Copy link
Member

Ivshti commented Apr 6, 2019

IdentityDeployProxy.js: look into ways of generating bytecode w/o solc

Challenge description:

We use an Identity contract that reprensets each user (similar to multisig contracts, e.g. Gnosis safe); to save gas when deploying an identity for each user, we use delegatecall-based proxies.

The proxy contract bytecode is generated by the following JS: https://github.com/AdExNetwork/adex-protocol-eth/blob/master/js/IdentityProxyDeploy.js, for each user

There are comprehensive tests in test/TestIdentity that show how that API is supposed to be used.

However, this JS library uses the full solc, which has some issues:

  • shipping full emscripten/solc binaries imposes runtime overhead and more load time
  • we ran into crashes/other issues while using solc.js in a web browser environment
  • Improve greedy exception catcher of Emscripten ethereum/solc-js#34 ; it's definitely not fixed, they just fixed it in the binary
  • it is an engineering overkill to ship the full solc for compiling a few bits of assembly
  • this will be ran server-side and on the front-end, so performance matters

So, the challenge is to rewrite that JS to generate bytecode that does the same, but without having to ship solc (potentially by using a lighter weight EVM assember)

Submission requirements:

  • Tests in test/TestIdentity pass without modification
  • the functionality of js/IdentityProxyDeploy.js is preserved
  • dependency graph is reduced and/or heavyweight solc.js is removed

Submission deadline:

  • April 30

Judging criteria:

  • Best submission
  • Correctness and elegance of the solution
  • Performance of the solution
  • contributions to other open-source packages will be appreciated

Judging date:

  • April 30

Bounty:

  • 1500 DAI
@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 1500.0 DAI (1500.0 USD @ $1.0/DAI) attached to it as part of the AdExNetwork fund.

@Ivshti Ivshti changed the title IdentityDeployProxy: look into ways of generating bytecode w/o solc Ethereal Hackathon Bounty: AdEx: generate identity proxy bytecode without solc Apr 15, 2019
@Ivshti Ivshti pinned this issue Apr 18, 2019
@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 3 weeks, 3 days from now.
Please review their action plans below:

1) smitrajput has started work.

Will try to integrate a lighter weight EVM assembler

Learn more on the Gitcoin Issue Details page.

@rmshea
Copy link

rmshea commented Apr 26, 2019

hey @smitrajput, how's it coming on this one?

@smitrajput
Copy link

@ryan-shea not that easy to be honest. I do have a solution in mind, but not sure if that would fit in well, given the trade-off between gas-optimization and runtime overhead

@cryptomental
Copy link

Hi I did not pick it up since I joined the hackathon too late and the challenge seems complex, but the problem itself is quite interesting. If I understood correctly you are trying to generate parametrized bytecode based on several inputs and would like to avoid fetching and triggering Solidity compiler due to crashes and runtime overhead for loading solc. I have had two, perhaps stupid (or not) ideas, first would be to use an external, let's call it a microservice, that would run with solc installed and accept the input parameters, return the bytecode. Still has an overhead but you would avoid loading solc and executing it client-side. Second idea (a bit hacky though) would be to compile identity proxy bytecode based on a few configurations, dissasemble the output, and try to implement injector that would simply inject needed opcodes and data into a identity proxy bytecode template. I am not sure if that is the way to go though -)

@fergarrui
Copy link

Hi,

I wanted to start working at this. First, I want to run the tests to see that what I'm changing, works.

I did:

npm install
npx truffle compile
npx truffle test

I get all tests passing, except:

  16 passing (20s)
  3 failing

  1) Contract: Identity
       relay a tx:

      error message is incorrect
      + expected - actual

      -VM Exception while processing transaction: out of gas
      +VM Exception while processing transaction: revert ONLY_IDENTITY_CAN_CALL
      
      at expectEVMError (test/index.js:11:10)
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:188:7)

  2) Contract: Identity
       execute by sender:

      error message is incorrect
      + expected - actual

      -VM Exception while processing transaction: revert
      +VM Exception while processing transaction: revert PRIVILEGE_NOT_DOWNGRADED
      
      at expectEVMError (test/index.js:11:10)
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:188:7)

  3) Contract: Identity
       channelOpen and channelWithdrawExpired, via routines:

      error message is incorrect
      + expected - actual

      -VM Exception while processing transaction: revert
      +VM Exception while processing transaction: revert NOT_EXPIRED
      
      at expectEVMError (test/index.js:11:10)
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:188:7)

Anythng else I have to do?

Thanks

@Ivshti
Copy link
Member Author

Ivshti commented May 27, 2019 via email

@fergarrui
Copy link

It reports correctly for some other Tests @Ivshti
I'll try that, thanks

@mul1sh
Copy link

mul1sh commented Jun 25, 2019

@Ivshti any chance this issue is still open? thanks

@Ivshti
Copy link
Member Author

Ivshti commented Jun 26, 2019 via email

@mul1sh
Copy link

mul1sh commented Jun 26, 2019

@Ivshti ok thanks for your feedback, appreciate it

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Cancelled


The funding of 1500.0 DAI (1500.0 USD @ $1.0/DAI) attached to this issue has been cancelled by the bounty submitter

@Ivshti Ivshti unpinned this issue Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants