-
Notifications
You must be signed in to change notification settings - Fork 10
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
Conversation
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.
Few inline comments.
Global comment :-
Provide documentation for the methods.Also,provide documentation for input parameters of the method.
lib/helper/User.js
Outdated
sessionKeys, | ||
sessionKeysSpendingLimits, | ||
sessionKeysExpirationHeights | ||
); | ||
|
||
const txReceipt = await new TxSender(txObject, oThis.auxiliaryWeb3, txOptions).execute(); | ||
const txSender1 = new TxSender(txObject, oThis.auxiliaryWeb3, txOptions); |
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.
txSender1 => txSender
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.
tools/initDevEnv.js
Outdated
@@ -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` + |
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.
Why --fakepow
is needed ?
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.
if we actually use --mine
then we should not actually mine on Travis nodes
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.
--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.
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.
LGTM
test/integration/DelayedRecovery.js
Outdated
let currentBlockNumber = await auxiliaryWeb3.eth.getBlockNumber(); | ||
|
||
while (currentBlockNumber < blockNumber) { | ||
await sleep(2000); |
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 probably needs to be fixed later... ok for now to avoid creating a blocker.
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.
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.
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.
LGTM; missing documentation and other improvements can be done after alpha.1
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.
LGTM
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.
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 = { |
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.
OrganizationHelper integration needs to update with mosaic.js integration.
It's a note for me for the other PR #76
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 #76 is not completed yet, correct? if so, can we add that as a comment on this 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.
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)); |
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.
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.
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.
- for now ok, but we should avoid having a logic function like
hashRecoveryModuleRecovery
l144 in the test files; - 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
- 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); |
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.
Can we know delayedRecoveryProxy address through event e.g. through UserWalletCreated ?
else we need to expose getModules() method in GnosisSafe interaction layer.
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.
- there is value in exposing
getModules
for sure; let's open a ticket for that - 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
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.
Ticket created: #111
eip20Token, | ||
tokenRules, | ||
userWalletFactoryAddress, | ||
userWalletFactory, | ||
proxyFactory, |
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.
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.
Fixes #43