Skip to content

First Draft of proxy operations on contract#9

Draft
deluca-mike wants to merge 7 commits into
masterfrom
feature/proxyContractLogic
Draft

First Draft of proxy operations on contract#9
deluca-mike wants to merge 7 commits into
masterfrom
feature/proxyContractLogic

Conversation

@deluca-mike

Copy link
Copy Markdown
Collaborator

Still need to implement Events

@gtabmx gtabmx force-pushed the feature/proxyContractLogic branch 2 times, most recently from 714b78d to b2298cd Compare October 24, 2019 16:53
Comment thread contracts/decentPassManager.sol Outdated
Comment thread contracts/decentPassManager.sol Outdated
Comment thread contracts/decentPassManager.sol Outdated
Comment thread contracts/decentPassManager.sol Outdated
Comment thread contracts/decentPassManager.sol Outdated
function getAddressFromSig(bytes32 arg, address relayer, uint256 maxGasPrice, uint256 premium, uint256 nonce, uint8 v, bytes32 r, bytes32 s) internal returns(address) {
bytes data = abi.encodePacked(arg, relayer, maxGasPrice, premium, nonce);
bytes32 hash = sha3(data);
return ecrecover(hash, v, r, s);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
return ecrecover(hash, v, r, s);
address accountAddress = ecrecover(hash, v, r, s);
asert(accountAddress != address(0));
return accountAddress;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ecrecover returnsaddress(0) on error

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@sammy1991106 I wonder if that matters. If someone provides or relays an incorrect signature (which they could have checked via this pure function for free) then it will end up affecting address(0), which is relevant. The only person who gets hurt is the relayer that did not check the sig, or provided a bad sig.

Comment thread contracts/decentPassManager.sol Outdated
account.balance += msg.value;
account.unlockBlock = block.number + 7200;

emit DepositMade(msg.sender, msg.value, account.unlockBlock);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
emit DepositMade(msg.sender, msg.value, account.unlockBlock);
uint256 unlockBlock = block.number + 7200;
...
emit DepositMade(msg.sender, msg.value, unlockBlock);

to avoid the redundent SLOAD

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@sammy1991106 would the compiler not have made this optimization?

Comment thread contracts/decentPassManager.sol Outdated
@gtabmx gtabmx force-pushed the feature/proxyContractLogic branch 2 times, most recently from 0c36717 to eda4744 Compare October 31, 2019 04:30
- still needs to be tested
@gtabmx gtabmx force-pushed the feature/proxyContractLogic branch from eda4744 to d0171bf Compare October 31, 2019 07:30
@gtabmx gtabmx force-pushed the feature/proxyContractLogic branch from d234971 to 971f114 Compare October 31, 2019 08:18
@gtabmx gtabmx force-pushed the feature/proxyContractLogic branch from a8a41f4 to 1d26f8f Compare November 9, 2019 23:12
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.

2 participants