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

Set INVALID_ADDRESS as random address #33

Merged
merged 2 commits into from Mar 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions contracts/Marmo.sol
Expand Up @@ -12,8 +12,9 @@ contract Marmo {
event Relayed(bytes32 indexed _id, address _implementation, bytes _data);
event Canceled(bytes32 indexed _id);

// Invalid signer address, outside of restricted address range (0 - 65535)
address private constant INVALID_ADDRESS = address(65536);
// Random Invalid signer address
// Intents signed with this address are invalid
address private constant INVALID_ADDRESS = address(0x9431Bab00000000000000000000000039bD955c9);

// Random slot to store signer
bytes32 private constant SIGNER_SLOT = keccak256("marmo.wallet.signer");
Expand Down
8 changes: 6 additions & 2 deletions contracts/MarmoStork.sol
Expand Up @@ -11,6 +11,10 @@ import "./commons/MinimalProxy.sol";
// All wallets are proxies pointing to a single
// source contract, to make deployment costs viable
contract MarmoStork {
// Random Invalid signer address
// Intents signed with this address are invalid
address private constant INVALID_ADDRESS = address(0x9431Bab00000000000000000000000039bD955c9);

// Bytecode to deploy marmo wallets
bytes public bytecode;

Expand All @@ -34,11 +38,11 @@ contract MarmoStork {
// Destroy the '_source' provided, if is not destroyed
Marmo marmoc = Marmo(_source);
if (marmoc.signer() == address(0)) {
marmoc.init(address(65536));
marmoc.init(INVALID_ADDRESS);
}

// Validate, the signer of _source should be "INVALID_ADDRESS" (destroyed)
require(marmoc.signer() == address(65536), "Error init Marmo source");
require(marmoc.signer() == INVALID_ADDRESS, "Error init Marmo source");

// Save the _source address, casting to address (160 bits)
marmo = address(marmoc);
Expand Down