Compare commits

..

2 Commits

4 changed files with 58 additions and 4 deletions

@ -1,9 +1,11 @@
bytes32 rootTornadoENSNode = 0xe6ae31d630cc7a8279c0f1c7cbe6e7064814c47d1785fa2703d9ae511ee2be0c; bytes32 rootTornadoENSNode = 0xe6ae31d630cc7a8279c0f1c7cbe6e7064814c47d1785fa2703d9ae511ee2be0c;
bytes32 tornadoContractENSNode = 0xe7e1d618367ebadd8e172150a43cfc839fd19022c2be81a6e8d45e06aa1011cd; bytes32 tornadoContractENSNode = 0xe7e1d618367ebadd8e172150a43cfc839fd19022c2be81a6e8d45e06aa1011cd;
bytes32 stakingRewardsENSNode = 0x3da4b79cd8c20d2fafb1c7cb37a62be8668f543393f6636d421fba0be735e68f; bytes32 stakingRewardsENSNode = 0x3da4b79cd8c20d2fafb1c7cb37a62be8668f543393f6636d421fba0be735e68f;
bytes32 governanceImplENSNode = 0x092359a5505072470ce8b86eebed5b4b6f001fe6bd08dbcf723c97073a360cfc;
bytes32 novaENSNode = 0xc3964c598b56aeaee4c253283fb1ebb12510b95db00960589cdc62807a2537a0; bytes32 novaENSNode = 0xc3964c598b56aeaee4c253283fb1ebb12510b95db00960589cdc62807a2537a0;
bytes32 docsENSNode = 0xd7b8aac14a9b2507ab99b5fde3060197fddb9735afa9bf38b1f7e34923cb935e; bytes32 docsENSNode = 0xd7b8aac14a9b2507ab99b5fde3060197fddb9735afa9bf38b1f7e34923cb935e;
bytes32 relayersUIENSNode = 0x4e37047f2c961db41dfb7d38cf79ca745faf134a8392cfb834d3a93330b9108d; bytes32 relayersUIENSNode = 0x4e37047f2c961db41dfb7d38cf79ca745faf134a8392cfb834d3a93330b9108d;
bytes32 tornadoContractENSLabelhash = 0x7f6dd79f0020bee2024a097aaa5d32ab7ca31126fa375538de047e7475fa8572; bytes32 tornadoContractENSLabelhash = 0x7f6dd79f0020bee2024a097aaa5d32ab7ca31126fa375538de047e7475fa8572;
bytes32 stakingRewardsENSLabelhash = 0x15826fcf9999635849b273bcd226f436dc42a8fabf43049b60971ab51d8d6b8f; bytes32 stakingRewardsENSLabelhash = 0x15826fcf9999635849b273bcd226f436dc42a8fabf43049b60971ab51d8d6b8f;
bytes32 governanceImplENSLabelhash = 0x6583a22765d3d6a6ca97b21440f79fecaf21bb8bcaa4fb694483e63d821ba50d;

@ -8,6 +8,7 @@ import { DeclCalculator } from "./utils";
const rootTornadoDomain = "tornadocash.eth"; const rootTornadoDomain = "tornadocash.eth";
const stakingDomain = "staking-rewards.contract.tornadocash.eth"; const stakingDomain = "staking-rewards.contract.tornadocash.eth";
const governanceImplDomain = "governance-impl.contract.tornadocash.eth";
const novaUIDomain = "nova.tornadocash.eth"; const novaUIDomain = "nova.tornadocash.eth";
const docsDomain = "docs.tornadocash.eth"; const docsDomain = "docs.tornadocash.eth";
const relayersUIDomain = "relayers-network.tornadocash.eth"; const relayersUIDomain = "relayers-network.tornadocash.eth";
@ -16,6 +17,7 @@ const tornadoContractDomain = "contract.tornadocash.eth";
const rootTornadoENSNode = hash(rootTornadoDomain); const rootTornadoENSNode = hash(rootTornadoDomain);
const tornadoContractENSNode = hash(tornadoContractDomain); const tornadoContractENSNode = hash(tornadoContractDomain);
const stakingRewardsENSNode = hash(stakingDomain); const stakingRewardsENSNode = hash(stakingDomain);
const governanceImplENSNode = hash(governanceImplDomain);
const novaENSNode = hash(novaUIDomain); const novaENSNode = hash(novaUIDomain);
const docsENSNode = hash(docsDomain); const docsENSNode = hash(docsDomain);
const relayersUIENSNode = hash(relayersUIDomain); const relayersUIENSNode = hash(relayersUIDomain);
@ -23,17 +25,20 @@ const relayersUIENSNode = hash(relayersUIDomain);
const getLabelhashFromDomain = (ensDomain: string) => "0x" + keccak_256(ensDomain.split(".")[0]); const getLabelhashFromDomain = (ensDomain: string) => "0x" + keccak_256(ensDomain.split(".")[0]);
const tornadoContractENSLabelhash = getLabelhashFromDomain(tornadoContractDomain); const tornadoContractENSLabelhash = getLabelhashFromDomain(tornadoContractDomain);
const stakingRewardsENSLabelhash = getLabelhashFromDomain(stakingDomain); const stakingRewardsENSLabelhash = getLabelhashFromDomain(stakingDomain);
const governanceImplENSLabelhash = getLabelhashFromDomain(governanceImplDomain);
const { calculateDecl } = new DeclCalculator("bytes32"); const { calculateDecl } = new DeclCalculator("bytes32");
const solidityCode = const solidityCode =
calculateDecl({ rootTornadoENSNode }) + calculateDecl({ rootTornadoENSNode }) +
calculateDecl({ tornadoContractENSNode }) + calculateDecl({ tornadoContractENSNode }) +
calculateDecl({ stakingRewardsENSNode }) + calculateDecl({ stakingRewardsENSNode }) +
calculateDecl({ governanceImplENSNode }) +
calculateDecl({ novaENSNode }) + calculateDecl({ novaENSNode }) +
calculateDecl({ docsENSNode }) + calculateDecl({ docsENSNode }) +
calculateDecl({ relayersUIENSNode }) + calculateDecl({ relayersUIENSNode }) +
"\n" + "\n" +
calculateDecl({ tornadoContractENSLabelhash }) + calculateDecl({ tornadoContractENSLabelhash }) +
calculateDecl({ stakingRewardsENSLabelhash }); calculateDecl({ stakingRewardsENSLabelhash }) +
calculateDecl({ governanceImplENSLabelhash });
fs.writeFileSync(path.join("data", "ensNodesDeclarations.txt"), solidityCode); fs.writeFileSync(path.join("data", "ensNodesDeclarations.txt"), solidityCode);

@ -12,6 +12,7 @@ contract UpdateENSDataProposal is TornadoAddresses {
function executeProposal() public { function executeProposal() public {
address ensResolverAddress = 0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41; address ensResolverAddress = 0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41;
address ensRegistryAddress = 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e; address ensRegistryAddress = 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e;
address governanceImplementationAddress = 0xBa178126C28F50Ee60322a82f5EbCd6b3711e101;
IENSRegistry ensRegistry = IENSRegistry(ensRegistryAddress); IENSRegistry ensRegistry = IENSRegistry(ensRegistryAddress);
IENSResolver ensResolver = IENSResolver(ensResolverAddress); IENSResolver ensResolver = IENSResolver(ensResolverAddress);
@ -20,19 +21,25 @@ contract UpdateENSDataProposal is TornadoAddresses {
bytes32 rootTornadoENSNode = 0xe6ae31d630cc7a8279c0f1c7cbe6e7064814c47d1785fa2703d9ae511ee2be0c; bytes32 rootTornadoENSNode = 0xe6ae31d630cc7a8279c0f1c7cbe6e7064814c47d1785fa2703d9ae511ee2be0c;
bytes32 tornadoContractENSNode = 0xe7e1d618367ebadd8e172150a43cfc839fd19022c2be81a6e8d45e06aa1011cd; bytes32 tornadoContractENSNode = 0xe7e1d618367ebadd8e172150a43cfc839fd19022c2be81a6e8d45e06aa1011cd;
bytes32 stakingRewardsENSNode = 0x3da4b79cd8c20d2fafb1c7cb37a62be8668f543393f6636d421fba0be735e68f; bytes32 stakingRewardsENSNode = 0x3da4b79cd8c20d2fafb1c7cb37a62be8668f543393f6636d421fba0be735e68f;
bytes32 governanceImplENSNode = 0x092359a5505072470ce8b86eebed5b4b6f001fe6bd08dbcf723c97073a360cfc;
bytes32 novaENSNode = 0xc3964c598b56aeaee4c253283fb1ebb12510b95db00960589cdc62807a2537a0; bytes32 novaENSNode = 0xc3964c598b56aeaee4c253283fb1ebb12510b95db00960589cdc62807a2537a0;
bytes32 docsENSNode = 0xd7b8aac14a9b2507ab99b5fde3060197fddb9735afa9bf38b1f7e34923cb935e; bytes32 docsENSNode = 0xd7b8aac14a9b2507ab99b5fde3060197fddb9735afa9bf38b1f7e34923cb935e;
bytes32 relayersUIENSNode = 0x4e37047f2c961db41dfb7d38cf79ca745faf134a8392cfb834d3a93330b9108d; bytes32 relayersUIENSNode = 0x4e37047f2c961db41dfb7d38cf79ca745faf134a8392cfb834d3a93330b9108d;
bytes32 tornadoContractENSLabelhash = 0x7f6dd79f0020bee2024a097aaa5d32ab7ca31126fa375538de047e7475fa8572; bytes32 tornadoContractENSLabelhash = 0x7f6dd79f0020bee2024a097aaa5d32ab7ca31126fa375538de047e7475fa8572;
bytes32 stakingRewardsENSLabelhash = 0x15826fcf9999635849b273bcd226f436dc42a8fabf43049b60971ab51d8d6b8f; bytes32 stakingRewardsENSLabelhash = 0x15826fcf9999635849b273bcd226f436dc42a8fabf43049b60971ab51d8d6b8f;
bytes32 governanceImplENSLabelhash = 0x6583a22765d3d6a6ca97b21440f79fecaf21bb8bcaa4fb694483e63d821ba50d;
// At first change owner of subdomain contract.tornadocash.eth and then staking-rewards.contract.tornadocash.eth to Governance // At first change owner of subdomain contract.tornadocash.eth and then staking-rewards.contract.tornadocash.eth
// and governance-impl.contract.tornadocash.eth to Governance
ensRegistry.setSubnodeOwner(rootTornadoENSNode, tornadoContractENSLabelhash, governanceAddress); ensRegistry.setSubnodeOwner(rootTornadoENSNode, tornadoContractENSLabelhash, governanceAddress);
ensRegistry.setSubnodeOwner(tornadoContractENSNode, stakingRewardsENSLabelhash, governanceAddress); ensRegistry.setSubnodeOwner(tornadoContractENSNode, stakingRewardsENSLabelhash, governanceAddress);
ensRegistry.setSubnodeOwner(tornadoContractENSNode, governanceImplENSLabelhash, governanceAddress);
// Update staking address, that has been changed in proposal 22: https://tornado.ws/governance/22 // Update staking address, that has been changed in proposal 22: https://tornado.ws/governance/22
ensResolver.setAddr(stakingRewardsENSNode, stakingAddress); ensResolver.setAddr(stakingRewardsENSNode, stakingAddress);
// Update Governance implementation (logic) address on ENS, that has been changed in proposal 22: https://tornado.ws/governance/22
ensResolver.setAddr(governanceImplENSNode, governanceImplementationAddress);
// From data/ensDomainsIPFSContenthashes.txt, calculated via scripts/calculateIPFSContenthashes.ts // From data/ensDomainsIPFSContenthashes.txt, calculated via scripts/calculateIPFSContenthashes.ts
bytes memory classicUiIPFSContenthash = hex"e301017012203c89ba6bfdeb8d7209463006e620ee6dcb34675cf3202f20919e3a5f9919070d"; bytes memory classicUiIPFSContenthash = hex"e301017012203c89ba6bfdeb8d7209463006e620ee6dcb34675cf3202f20919e3a5f9919070d";

@ -6,15 +6,32 @@ import { UpdateENSDataProposal } from "@root/UpdateENSDataProposal.sol";
import { console2 } from "@forge-std/console2.sol"; import { console2 } from "@forge-std/console2.sol";
import { IENSResolver } from "@interfaces/IENSResolver.sol"; import { IENSResolver } from "@interfaces/IENSResolver.sol";
import { IENSRegistry } from "@interfaces/IENSRegistry.sol";
import { ENSNamehash } from "./ENSNamehash.sol";
contract TestExampleProposal is ProposalUtils { contract TestExampleProposal is ProposalUtils {
IENSResolver ensResolver = IENSResolver(0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41); using ENSNamehash for bytes;
IENSResolver internal ensResolver = IENSResolver(0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41);
IENSRegistry ensRegistry = IENSRegistry(ENSAddress);
string internal tornadoContractENSDomain = "contract.tornadocash.eth";
string internal governanceImplementationENSDomain = "governance-impl.contract.tornadocash.eth";
string internal stakingRewardsENSDomain = "staking-rewards.contract.tornadocash.eth";
bytes32 internal tornadoContractsENSNode = calculateDomainNode(tornadoContractENSDomain);
bytes32 internal stakingRewardsENSNode = calculateDomainNode(stakingRewardsENSDomain);
bytes32 internal governanceImplENSNode = calculateDomainNode(governanceImplementationENSDomain);
modifier executeCurrentProposalBefore() { modifier executeCurrentProposalBefore() {
createAndExecuteProposal(); createAndExecuteProposal();
_; _;
} }
function calculateDomainNode(string memory domain) internal pure returns (bytes32) {
return ENSNamehash.namehash(bytes(domain));
}
function createAndExecuteProposal() public { function createAndExecuteProposal() public {
address proposalAddress = address(new UpdateENSDataProposal()); address proposalAddress = address(new UpdateENSDataProposal());
@ -22,10 +39,33 @@ contract TestExampleProposal is ProposalUtils {
} }
function testStakingAddressChanged() public executeCurrentProposalBefore { function testStakingAddressChanged() public executeCurrentProposalBefore {
bytes32 stakingRewardsENSNode = 0x3da4b79cd8c20d2fafb1c7cb37a62be8668f543393f6636d421fba0be735e68f;
address stakingAddressAfterProposal = ensResolver.addr(stakingRewardsENSNode); address stakingAddressAfterProposal = ensResolver.addr(stakingRewardsENSNode);
console2.log("Address on staking ENS Tornado subdomain (staking-rewards.contract.tornadocash.eth): %s", stakingAddressAfterProposal); console2.log("Address on staking ENS Tornado subdomain (staking-rewards.contract.tornadocash.eth): %s", stakingAddressAfterProposal);
require(stakingAddressAfterProposal == stakingAddress); require(stakingAddressAfterProposal == stakingAddress);
} }
function testGovernanceImplAddressChanged() public executeCurrentProposalBefore {
address expectedGovernanceImplAddress = 0xBa178126C28F50Ee60322a82f5EbCd6b3711e101;
address governanceImplAddressAfterProposal = ensResolver.addr(governanceImplENSNode);
console2.log(
"Address on governance implementation ENS Tornado subdomain (governance-impl.contract.tornadocash.eth): %s",
governanceImplAddressAfterProposal
);
require(expectedGovernanceImplAddress == governanceImplAddressAfterProposal);
}
function testENSSubdomainOwnerChanged() public executeCurrentProposalBefore {
address tornadoContractsENSDomainOwner = ensRegistry.owner(tornadoContractsENSNode);
address governanceImplENSNodeOwner = ensRegistry.owner(governanceImplENSNode);
address stakingRewardsENSNodeOwner = ensRegistry.owner(stakingRewardsENSNode);
console2.log("Tornado contracts ENS domain owner after proposal execution: %s", tornadoContractsENSDomainOwner);
console2.log("Staking rewards ENS domain owner after proposal execution: %s", stakingRewardsENSNodeOwner);
console2.log("Governance implementation ENS domain owner after proposal execution: %s", governanceImplENSNodeOwner);
require(stakingRewardsENSNodeOwner == governanceAddress, "Staking rewards ENS domain owner is not governance");
require(tornadoContractsENSDomainOwner == governanceAddress, "Tornado contracts ENS domain owner is not governance");
require(governanceImplENSNodeOwner == governanceAddress, "Governance implementation ENS domain owner is not governance");
}
} }