Skip to content

Commit

Permalink
Merge CR8 into master #9881
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvol authored Sep 26, 2022
2 parents 61e6dc2 + a02cb73 commit 1d48109
Show file tree
Hide file tree
Showing 55 changed files with 3,991 additions and 419 deletions.
6 changes: 5 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ defaults: &defaults
contract-defaults: &contract-defaults
<<: *defaults
environment:
RELEASE_TAG: core-contracts.v7
RELEASE_TAG: core-contracts.v8

e2e-defaults: &e2e-defaults
<<: *defaults
Expand Down Expand Up @@ -810,6 +810,10 @@ jobs:
name: Check if the test should run
command: |
./scripts/ci_check_if_test_should_run_v2.sh @celo/protocol
# Disabling certora until the license is figured out
echo "Certora tests are disabled"
circleci step halt
exit 0
- run:
name: Certora dependencies
command: |
Expand Down
1 change: 1 addition & 0 deletions dependency-graph.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"@celo/connect",
"@celo/cryptographic-utils",
"@celo/flake-tracker",
"@celo/phone-utils",
"@celo/typescript",
"@celo/utils"
]
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"generate:shrinkwrap": "npm install --production && npm shrinkwrap",
"check:shrinkwrap": "npm install --production && npm shrinkwrap && ./scripts/check_shrinkwrap_dirty.sh",
"prepack": "yarn run build && oclif-dev manifest && oclif-dev readme && yarn run check:shrinkwrap",
"test:reset": "yarn --cwd ../protocol devchain generate-tar .tmp/devchain.tar.gz --migration_override ../dev-utils/src/migration-override.json --upto 26 --release_gold_contracts scripts/truffle/releaseGoldExampleConfigs.json",
"test:reset": "yarn --cwd ../protocol devchain generate-tar .tmp/devchain.tar.gz --migration_override ../dev-utils/src/migration-override.json --upto 28 --release_gold_contracts scripts/truffle/releaseGoldExampleConfigs.json",
"test:livechain": "yarn --cwd ../protocol devchain run-tar .tmp/devchain.tar.gz",
"test": "TZ=UTC jest --runInBand"
},
Expand Down
8 changes: 0 additions & 8 deletions packages/faucet/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions packages/faucet/tslint.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/phone-number-privacy/combiner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@
"engines": {
"node": "12"
}
}
}
2 changes: 1 addition & 1 deletion packages/phone-number-privacy/monitor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
"engines": {
"node": "12"
}
}
}
2 changes: 1 addition & 1 deletion packages/phone-number-privacy/signer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@
"engines": {
"node": ">=10"
}
}
}
115 changes: 69 additions & 46 deletions packages/protocol/contracts/common/UsingRegistryV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,134 +15,157 @@ import "../governance/interfaces/IValidators.sol";

import "../identity/interfaces/IRandom.sol";
import "../identity/interfaces/IAttestations.sol";
import "../identity/interfaces/IFederatedAttestations.sol";

import "../stability/interfaces/IExchange.sol";
import "../stability/interfaces/IReserve.sol";
import "../stability/interfaces/ISortedOracles.sol";
import "../stability/interfaces/IStableToken.sol";

contract UsingRegistryV2 {
address constant registryAddress = 0x000000000000000000000000000000000000ce10;
IRegistry public constant registry = IRegistry(registryAddress);

// solhint-disable state-visibility
bytes32 constant ACCOUNTS_REGISTRY_ID = keccak256(abi.encodePacked("Accounts"));
bytes32 constant ATTESTATIONS_REGISTRY_ID = keccak256(abi.encodePacked("Attestations"));
bytes32 constant DOWNTIME_SLASHER_REGISTRY_ID = keccak256(abi.encodePacked("DowntimeSlasher"));
bytes32 constant DOUBLE_SIGNING_SLASHER_REGISTRY_ID = keccak256(
address internal constant registryAddress = 0x000000000000000000000000000000000000ce10;
IRegistry public constant registryContract = IRegistry(registryAddress);

bytes32 internal constant ACCOUNTS_REGISTRY_ID = keccak256(abi.encodePacked("Accounts"));
bytes32 internal constant ATTESTATIONS_REGISTRY_ID = keccak256(abi.encodePacked("Attestations"));
bytes32 internal constant DOWNTIME_SLASHER_REGISTRY_ID = keccak256(
abi.encodePacked("DowntimeSlasher")
);
bytes32 internal constant DOUBLE_SIGNING_SLASHER_REGISTRY_ID = keccak256(
abi.encodePacked("DoubleSigningSlasher")
);
bytes32 constant ELECTION_REGISTRY_ID = keccak256(abi.encodePacked("Election"));
bytes32 constant EXCHANGE_REGISTRY_ID = keccak256(abi.encodePacked("Exchange"));
bytes32 constant EXCHANGE_EURO_REGISTRY_ID = keccak256(abi.encodePacked("ExchangeEUR"));
bytes32 constant EXCHANGE_REAL_REGISTRY_ID = keccak256(abi.encodePacked("ExchangeBRL"));
bytes32 internal constant ELECTION_REGISTRY_ID = keccak256(abi.encodePacked("Election"));
bytes32 internal constant EXCHANGE_REGISTRY_ID = keccak256(abi.encodePacked("Exchange"));
bytes32 internal constant EXCHANGE_EURO_REGISTRY_ID = keccak256(abi.encodePacked("ExchangeEUR"));
bytes32 internal constant EXCHANGE_REAL_REGISTRY_ID = keccak256(abi.encodePacked("ExchangeBRL"));

bytes32 constant FEE_CURRENCY_WHITELIST_REGISTRY_ID = keccak256(
bytes32 internal constant FEE_CURRENCY_WHITELIST_REGISTRY_ID = keccak256(
abi.encodePacked("FeeCurrencyWhitelist")
);
bytes32 constant FREEZER_REGISTRY_ID = keccak256(abi.encodePacked("Freezer"));
bytes32 constant GOLD_TOKEN_REGISTRY_ID = keccak256(abi.encodePacked("GoldToken"));
bytes32 constant GOVERNANCE_REGISTRY_ID = keccak256(abi.encodePacked("Governance"));
bytes32 constant GOVERNANCE_SLASHER_REGISTRY_ID = keccak256(
bytes32 internal constant FEDERATED_ATTESTATIONS_REGISTRY_ID = keccak256(
abi.encodePacked("FederatedAttestations")
);
bytes32 internal constant FREEZER_REGISTRY_ID = keccak256(abi.encodePacked("Freezer"));
bytes32 internal constant GOLD_TOKEN_REGISTRY_ID = keccak256(abi.encodePacked("GoldToken"));
bytes32 internal constant GOVERNANCE_REGISTRY_ID = keccak256(abi.encodePacked("Governance"));
bytes32 internal constant GOVERNANCE_SLASHER_REGISTRY_ID = keccak256(
abi.encodePacked("GovernanceSlasher")
);
bytes32 constant LOCKED_GOLD_REGISTRY_ID = keccak256(abi.encodePacked("LockedGold"));
bytes32 constant RESERVE_REGISTRY_ID = keccak256(abi.encodePacked("Reserve"));
bytes32 constant RANDOM_REGISTRY_ID = keccak256(abi.encodePacked("Random"));
bytes32 constant SORTED_ORACLES_REGISTRY_ID = keccak256(abi.encodePacked("SortedOracles"));
bytes32 constant STABLE_TOKEN_REGISTRY_ID = keccak256(abi.encodePacked("StableToken"));
bytes32 constant STABLE_EURO_TOKEN_REGISTRY_ID = keccak256(abi.encodePacked("StableTokenEUR"));
bytes32 constant STABLE_REAL_TOKEN_REGISTRY_ID = keccak256(abi.encodePacked("StableTokenBRL"));
bytes32 constant VALIDATORS_REGISTRY_ID = keccak256(abi.encodePacked("Validators"));
// solhint-enable state-visibility
bytes32 internal constant LOCKED_GOLD_REGISTRY_ID = keccak256(abi.encodePacked("LockedGold"));
bytes32 internal constant RESERVE_REGISTRY_ID = keccak256(abi.encodePacked("Reserve"));
bytes32 internal constant RANDOM_REGISTRY_ID = keccak256(abi.encodePacked("Random"));
bytes32 internal constant SORTED_ORACLES_REGISTRY_ID = keccak256(
abi.encodePacked("SortedOracles")
);
bytes32 internal constant STABLE_TOKEN_REGISTRY_ID = keccak256(abi.encodePacked("StableToken"));
bytes32 internal constant STABLE_EURO_TOKEN_REGISTRY_ID = keccak256(
abi.encodePacked("StableTokenEUR")
);
bytes32 internal constant STABLE_REAL_TOKEN_REGISTRY_ID = keccak256(
abi.encodePacked("StableTokenBRL")
);
bytes32 internal constant VALIDATORS_REGISTRY_ID = keccak256(abi.encodePacked("Validators"));

modifier onlyRegisteredContract(bytes32 identifierHash) {
require(registry.getAddressForOrDie(identifierHash) == msg.sender, "only registered contract");
require(
registryContract.getAddressForOrDie(identifierHash) == msg.sender,
"only registered contract"
);
_;
}

modifier onlyRegisteredContracts(bytes32[] memory identifierHashes) {
require(registry.isOneOf(identifierHashes, msg.sender), "only registered contracts");
require(registryContract.isOneOf(identifierHashes, msg.sender), "only registered contracts");
_;
}

function getAccounts() internal view returns (IAccounts) {
return IAccounts(registry.getAddressForOrDie(ACCOUNTS_REGISTRY_ID));
return IAccounts(registryContract.getAddressForOrDie(ACCOUNTS_REGISTRY_ID));
}

function getAttestations() internal view returns (IAttestations) {
return IAttestations(registry.getAddressForOrDie(ATTESTATIONS_REGISTRY_ID));
return IAttestations(registryContract.getAddressForOrDie(ATTESTATIONS_REGISTRY_ID));
}

function getElection() internal view returns (IElection) {
return IElection(registry.getAddressForOrDie(ELECTION_REGISTRY_ID));
return IElection(registryContract.getAddressForOrDie(ELECTION_REGISTRY_ID));
}

function getExchange() internal view returns (IExchange) {
return IExchange(registry.getAddressForOrDie(EXCHANGE_REGISTRY_ID));
return IExchange(registryContract.getAddressForOrDie(EXCHANGE_REGISTRY_ID));
}

function getExchangeDollar() internal view returns (IExchange) {
return getExchange();
}

function getExchangeEuro() internal view returns (IExchange) {
return IExchange(registry.getAddressForOrDie(EXCHANGE_EURO_REGISTRY_ID));
return IExchange(registryContract.getAddressForOrDie(EXCHANGE_EURO_REGISTRY_ID));
}

function getExchangeREAL() internal view returns (IExchange) {
return IExchange(registry.getAddressForOrDie(EXCHANGE_REAL_REGISTRY_ID));
return IExchange(registryContract.getAddressForOrDie(EXCHANGE_REAL_REGISTRY_ID));
}

function getFeeCurrencyWhitelistRegistry() internal view returns (IFeeCurrencyWhitelist) {
return IFeeCurrencyWhitelist(registry.getAddressForOrDie(FEE_CURRENCY_WHITELIST_REGISTRY_ID));
return
IFeeCurrencyWhitelist(
registryContract.getAddressForOrDie(FEE_CURRENCY_WHITELIST_REGISTRY_ID)
);
}

function getFederatedAttestations() internal view returns (IFederatedAttestations) {
return
IFederatedAttestations(
registryContract.getAddressForOrDie(FEDERATED_ATTESTATIONS_REGISTRY_ID)
);
}

function getFreezer() internal view returns (IFreezer) {
return IFreezer(registry.getAddressForOrDie(FREEZER_REGISTRY_ID));
return IFreezer(registryContract.getAddressForOrDie(FREEZER_REGISTRY_ID));
}

function getGoldToken() internal view returns (IERC20) {
return IERC20(registry.getAddressForOrDie(GOLD_TOKEN_REGISTRY_ID));
return IERC20(registryContract.getAddressForOrDie(GOLD_TOKEN_REGISTRY_ID));
}

function getGovernance() internal view returns (IGovernance) {
return IGovernance(registry.getAddressForOrDie(GOVERNANCE_REGISTRY_ID));
return IGovernance(registryContract.getAddressForOrDie(GOVERNANCE_REGISTRY_ID));
}

function getLockedGold() internal view returns (ILockedGold) {
return ILockedGold(registry.getAddressForOrDie(LOCKED_GOLD_REGISTRY_ID));
return ILockedGold(registryContract.getAddressForOrDie(LOCKED_GOLD_REGISTRY_ID));
}

function getRandom() internal view returns (IRandom) {
return IRandom(registry.getAddressForOrDie(RANDOM_REGISTRY_ID));
return IRandom(registryContract.getAddressForOrDie(RANDOM_REGISTRY_ID));
}

function getReserve() internal view returns (IReserve) {
return IReserve(registry.getAddressForOrDie(RESERVE_REGISTRY_ID));
return IReserve(registryContract.getAddressForOrDie(RESERVE_REGISTRY_ID));
}

function getSortedOracles() internal view returns (ISortedOracles) {
return ISortedOracles(registry.getAddressForOrDie(SORTED_ORACLES_REGISTRY_ID));
return ISortedOracles(registryContract.getAddressForOrDie(SORTED_ORACLES_REGISTRY_ID));
}

function getStableToken() internal view returns (IStableToken) {
return IStableToken(registry.getAddressForOrDie(STABLE_TOKEN_REGISTRY_ID));
return IStableToken(registryContract.getAddressForOrDie(STABLE_TOKEN_REGISTRY_ID));
}

function getStableDollarToken() internal view returns (IStableToken) {
return getStableToken();
}

function getStableEuroToken() internal view returns (IStableToken) {
return IStableToken(registry.getAddressForOrDie(STABLE_EURO_TOKEN_REGISTRY_ID));
return IStableToken(registryContract.getAddressForOrDie(STABLE_EURO_TOKEN_REGISTRY_ID));
}

function getStableRealToken() internal view returns (IStableToken) {
return IStableToken(registry.getAddressForOrDie(STABLE_REAL_TOKEN_REGISTRY_ID));
return IStableToken(registryContract.getAddressForOrDie(STABLE_REAL_TOKEN_REGISTRY_ID));
}

function getValidators() internal view returns (IValidators) {
return IValidators(registry.getAddressForOrDie(VALIDATORS_REGISTRY_ID));
return IValidators(registryContract.getAddressForOrDie(VALIDATORS_REGISTRY_ID));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pragma solidity ^0.5.13;

import "./UsingRegistryV2.sol";

contract UsingRegistryV2BackwardsCompatible is UsingRegistryV2 {
// Placeholder for registry storage var in UsingRegistry and cannot be renamed
// without breaking release tooling.
// Use `registryContract` (in UsingRegistryV2) for the actual registry address.
IRegistry public registry;
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ interface IAccounts {

function setPaymentDelegation(address, uint256) external;
function getPaymentDelegation(address) external view returns (address, uint256);
function isSigner(address, address, bytes32) external view returns (bool);
}
Loading

0 comments on commit 1d48109

Please sign in to comment.