Skip to content

Commit

Permalink
Hardcode constants: add missing App Manager Role from Kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
ßingen committed Apr 19, 2018
1 parent 2789982 commit af01132
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion contracts/kernel/Kernel.sol
Expand Up @@ -9,7 +9,9 @@ import "../factory/AppProxyFactory.sol";


contract Kernel is IKernel, KernelStorage, Initializable, AppProxyFactory, ACLSyntaxSugar {
bytes32 constant public APP_MANAGER_ROLE = keccak256("APP_MANAGER_ROLE");
// Hardocde constant to save gas
//bytes32 constant public APP_MANAGER_ROLE = keccak256("APP_MANAGER_ROLE");
bytes32 constant public APP_MANAGER_ROLE = 0xb6d92708f3d4817afc106147d969e229ced5c46e65e0a5002a0d391287762bd0;

/**
* @dev Initialize can only be called once. It saves the block number in which it was initialized.
Expand Down
3 changes: 3 additions & 0 deletions test/keccakConstants.js
Expand Up @@ -25,6 +25,9 @@ contract('Constants', accounts => {

assert.equal(await kernelConstants.ACL_APP_ID(), await keccakConstants.ACL_APP_ID(), "acl app id doesn't match")
assert.equal(await kernelConstants.ACL_APP(), await keccakConstants.ACL_APP(), "acl app doesn't match")

const kernel = await getContract('Kernel').new()
assert.equal(await kernel.APP_MANAGER_ROLE(), await keccakConstants.APP_MANAGER_ROLE(), "app manager role doesn't match")
})

it('checks ENS constants', async () => {
Expand Down
2 changes: 2 additions & 0 deletions test/mocks/KeccakConstants.sol
Expand Up @@ -16,6 +16,8 @@ contract KeccakConstants {
bytes32 constant public ACL_APP_ID = apmNamehash("acl");
bytes32 constant public ACL_APP = keccak256(APP_ADDR_NAMESPACE, ACL_APP_ID);

bytes32 constant public APP_MANAGER_ROLE = keccak256("APP_MANAGER_ROLE");

// ENS
bytes32 constant public ENS_ROOT = bytes32(0);
bytes32 constant public ETH_TLD_LABEL = keccak256("eth");
Expand Down

0 comments on commit af01132

Please sign in to comment.