Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Make Wallet first-class citizens #3990

Merged
merged 28 commits into from
Dec 30, 2016
Merged

Make Wallet first-class citizens #3990

merged 28 commits into from
Dec 30, 2016

Conversation

ngotchac
Copy link
Contributor

@ngotchac ngotchac commented Dec 28, 2016

This PR fixes some issues (balances not updating, not being able to send tokens from a Wallet), and should close #3784

This adds a new lookup action to the Contract class, which checks for a transaction whether the from field corresponds to a Wallet or not. If it does, then try to post the transaction/estimate gas with the correct options, ie. from being one of the owner of the wallet that is also one of the user account, etc.
Note that this can be recursive : if a Wallet is owned by another Wallet owner by one of my account, it will correctly set the account as the transaction sender, to the middle Wallet, that will call the execute method on the initial Wallet, which will execute the correct transaction.

The gas estimation is sometimes (more or less 2/3) wrong. So to test one might want to multiply the gas by 2. Maybe this should be taken into account in the PR (while the gas estimation gets fixed) ?

As the modification lies in the Contract class, this also work within dApps ! The only thing not available for Wallets is contract deployment (that would require a modification of the Wallet contract itself)...

Might fix #3849

@ngotchac ngotchac added A0-pleasereview 🤓 Pull request needs code review. M7-ui labels Dec 28, 2016
@gavofyork
Copy link
Contributor

cool - we should probably add a create function to our standard wallet contracts. how easily will this play with DeadMansSwitch?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 86.601% when pulling c307fcc on ng-wallet-improv into 3067a8d on master.

@ngotchac
Copy link
Contributor Author

@gavofyork So the DeadManSwitch contract is working fine when backup/owner are Wallets Contracts (I just tested every methods), from the Contracts view. However, the DeadManSwitch contract cannot be used as a Wallet for now. I think we might want to open the Wallet options to other contracts than the standard one. However it would take some work to get there, as we need to make the events and methods that we use more general.

@@ -90,7 +90,7 @@ export default handleActions({
signerSuccessRejectRequest (state, action) {
const { id } = action.payload;
const rejected = Object.assign(
state.pending.find(p => p.id === id),
state.pending.find(p => p.id === id) || { id },
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as the previous fix (now for reject), I missed this case the first time around. (Let's hope it is indeed dead now)

hasContracts: Object.keys(contracts).length !== 0,
wallets,
hasWallets: Object.keys(wallets).length !== 0
hasContracts: Object.keys(contracts).length !== 0
Copy link
Contributor

Choose a reason for hiding this comment

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

While we are here, could we just fix the ordering as well?

* a Wallet. The result is cached in order not
* to make unnecessary calls on non wallet accounts
*/
_isWallet (address) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not 100% sure this is the correct place for this functionality. Can we walk through today and discuss?

@@ -60,6 +60,7 @@ class TransactionPendingFormConfirm extends Component {
<Form>
{ keyInput }
<Input
autoFocus
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does it focus when there are multiple requests? Still on the first?

wallet: PropTypes.object.isRequired,
isTest: PropTypes.bool.isRequired
walletAccount: nullableProptype(PropTypes.object.isRequired)
Copy link
Contributor

Choose a reason for hiding this comment

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

Possibly nullableProptype(PropTypes.object).isRequired (the full property is required, but could be either null or object)


resolve: {
alias: {
'~': path.resolve(__dirname, '../src')
Copy link
Contributor

Choose a reason for hiding this comment

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

+1

? (hint || '')
: this.context.intl.formatMessage(
hint.props,
hint.props.values || []
Copy link
Contributor

Choose a reason for hiding this comment

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

hint.props.values || {}

@ngotchac ngotchac added A0-pleasereview 🤓 Pull request needs code review. and removed A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. labels Dec 29, 2016
It's totally valid for input's length not to be a multiple of 32 bytes. EG. for Wallet Contracts
@GitCop
Copy link

GitCop commented Dec 29, 2016

There were the following issues with your Pull Request

  • Commit: 234919d
  • Your commit message body contains a line that is longer than 72 characters

Guidelines are available at https://github.com/ethcore/parity


This message was auto-generated by https://gitcop.com

@gavofyork
Copy link
Contributor

gavofyork commented Dec 29, 2016

@ngotchac Yeah - we'll need an extensible architecture so that code hashes (i.e. types of wallet contracts) can be registered with specialised means of signing. This way dapps can use various addresses with eth_postTransaction and the signing UI will still work correctly - either passing it on to a derivative address (like for DeadMansSwitch) or multiple such addresses (the multisig wallet) or something else.

@jacogr jacogr added A7-looksgoodcantmerge 🙄 Pull request is reviewed well, but cannot be merged due to conflicts. and removed A0-pleasereview 🤓 Pull request needs code review. labels Dec 29, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 86.566% when pulling 234919d on ng-wallet-improv into 3067a8d on master.

@ngotchac ngotchac added A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. and removed A7-looksgoodcantmerge 🙄 Pull request is reviewed well, but cannot be merged due to conflicts. labels Dec 29, 2016
@ngotchac ngotchac added A0-pleasereview 🤓 Pull request needs code review. and removed A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. labels Dec 29, 2016
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling f087475 on ng-wallet-improv into ** on master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling f087475 on ng-wallet-improv into ** on master**.

@jacogr jacogr added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Dec 30, 2016
@gavofyork gavofyork merged commit fd41a10 into master Dec 30, 2016
@gavofyork gavofyork deleted the ng-wallet-improv branch December 30, 2016 11:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JS error Transfer error ETH from one account to another from Parity UI Make Wallet first-class citizens
5 participants