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

Delayed Recovery Module Setup #107

Merged
merged 6 commits into from
Feb 20, 2019
Merged

Delayed Recovery Module Setup #107

merged 6 commits into from
Feb 20, 2019

Conversation

pgev
Copy link

@pgev pgev commented Feb 19, 2019

Fixes #43

@pgev pgev added the v0.10.0 label Feb 19, 2019
Copy link
Contributor

@gulshanvasnani gulshanvasnani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few inline comments.
Global comment :-
Provide documentation for the methods.Also,provide documentation for input parameters of the method.

lib/helper/User.js Show resolved Hide resolved
lib/helper/User.js Show resolved Hide resolved
lib/helper/User.js Show resolved Hide resolved
lib/helper/User.js Show resolved Hide resolved
lib/helper/User.js Show resolved Hide resolved
sessionKeys,
sessionKeysSpendingLimits,
sessionKeysExpirationHeights
);

const txReceipt = await new TxSender(txObject, oThis.auxiliaryWeb3, txOptions).execute();
const txSender1 = new TxSender(txObject, oThis.auxiliaryWeb3, txOptions);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

txSender1 => txSender

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

package.json Show resolved Hide resolved
@@ -134,11 +140,11 @@ InitDevEnv.prototype = {
`geth --datadir '${gethFolder}'` +
` --networkid ${setUpConfig.chain.networkId}` +
` --port ${setUpConfig.chain.geth.port}` +
` --mine --minerthreads 1 --targetgaslimit ${setUpConfig.chain.gas} --gasprice 0x3B9ACA00` +
` --rpc --rpcapi eth,net,web3,personal,txpool --rpcaddr ${setUpConfig.chain.geth.host} --rpcport ${
` --fakepow --mine --minerthreads 16 --targetgaslimit ${setUpConfig.chain.gas} --gasprice 0x3B9ACA00` +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why --fakepow is needed ?

Copy link
Contributor

@benjaminbollen benjaminbollen Feb 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we actually use --mine then we should not actually mine on Travis nodes

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--fakepow Disables proof-of-work verification

Two reasons:
- One has been also brought by Ben. We should not mine.
- Second was an attempt to cut tests running time. It cuts it by ~2. In this PR I've also set the difficulty to "0x0". Both together, cuts running time for me from 8mins to 3mins. If we want to have different setups, we should at least have configuration options and handle them in initDevEnv.js accordingly to have a faster running time during a development.

Copy link
Contributor

@benjaminbollen benjaminbollen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

let currentBlockNumber = await auxiliaryWeb3.eth.getBlockNumber();

while (currentBlockNumber < blockNumber) {
await sleep(2000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this probably needs to be fixed later... ok for now to avoid creating a blocker.

Copy link
Author

@pgev pgev Feb 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I've reduced time to 200 ms (was my original intention, did not notice that it's 2000). If you could share your proposal, maybe I could integrate into this PR also.

benjaminbollen
benjaminbollen previously approved these changes Feb 19, 2019
Copy link
Contributor

@benjaminbollen benjaminbollen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; missing documentation and other improvements can be done after alpha.1

Copy link
Contributor

@benjaminbollen benjaminbollen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@benjaminbollen benjaminbollen merged commit 402f865 into OpenST:develop Feb 20, 2019
Copy link
Contributor

@abhayks1 abhayks1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
There are few comments but I think that can be taken later as improvements.
However I have 1 question:

Can we know delayedRecoveryProxy address through event e.g. through UserWalletCreated or any other?
else we need to expose getModules() method in GnosisSafe interaction layer.
cc: @pgev


const organizationOwnerAddress = deployerAddress;
const orgHelper = new OrganizationHelper(auxiliaryWeb3, null);
const orgConfig = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OrganizationHelper integration needs to update with mosaic.js integration.
It's a note for me for the other PR #76

Copy link
Contributor

@benjaminbollen benjaminbollen Feb 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so #76 is not completed yet, correct? if so, can we add that as a comment on this issue?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.
I have made above changes in PR #109

function signRecovery(recoveryModuleAddress, structTypeHash, prevOwner, oldOwner, newOwner, recoveryOwnerPrivateKey) {
const recoveryHash = hashRecoveryModuleRecovery(recoveryModuleAddress, structTypeHash, prevOwner, oldOwner, newOwner);

const signature = EthUtils.ecsign(EthUtils.toBuffer(recoveryHash), EthUtils.toBuffer(recoveryOwnerPrivateKey));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signing could have been done with Mosaic.js EIP712Signer which other integration tests are consuming.
https://github.com/OpenSTFoundation/openst.js/blob/develop/test/integration/WalletOperations.js#L200
Improvement for later versions.

Copy link
Contributor

@benjaminbollen benjaminbollen Feb 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. for now ok, but we should avoid having a logic function like hashRecoveryModuleRecovery l144 in the test files;
  2. if there is not already a good EIP712 js library out there, then I am in favor of splitting the EIP712 signer out of mosaic.js
  3. working on the JLP examples will gives us better clarity on the options for handling the signers outside of mosaic.js or openst.js

gas: ConfigReader.gas
};

const modules = await gnosisSafeProxy.methods.getModules().call(txOptions);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we know delayedRecoveryProxy address through event e.g. through UserWalletCreated ?
else we need to expose getModules() method in GnosisSafe interaction layer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. there is value in exposing getModules for sure; let's open a ticket for that
  2. the transaction receipt should include EnabledModule(module) as an event under the proxy contract address of GnosisSafe when setting up https://github.com/OpenSTFoundation/safe-contracts/blob/development/contracts/base/ModuleManager.sol#L43

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ticket created: #111

eip20Token,
tokenRules,
userWalletFactoryAddress,
userWalletFactory,
proxyFactory,
Copy link
Contributor

@abhayks1 abhayks1 Feb 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized since proxyFactory address are already being passed in constructor, we don't need to pass proxyFactory argument in createCompanyWallet method.

async createCompanyWallet(
    proxyFactory,
    owner,
    sessionKeys,
    sessionKeysSpendingLimits,
    sessionKeysExpirationHeights,
    txOptions
  ) 

We can avoid the duplication by removing proxyFactory argument from createCompanyWallet method.
I think it will be a quick change and can be fast forwarded to the release if everyone agrees.

Just want to make sure createCompanyWallet interface doesn't change much.

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

Successfully merging this pull request may close these issues.

4 participants