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

L2-FeeCurrencyDirectory-test #11302

Open
wants to merge 11 commits into
base: soloseng/L2-celoUnreleasedTreasury-test
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import "./UsingRegistryV2NoMento.sol";
* @notice This contract allows for a smoother transition from L1 to L2
* by abstracting away the usingPrecompile contract, and taking care of the L1 to L2 swtiching logic.
**/
contract PrecompilesOverrideV2 is UsingPrecompiles, UsingRegistryV2NoMento {
abstract contract PrecompilesOverrideV2 is UsingPrecompiles, UsingRegistryV2NoMento {
/**
* @notice Returns the epoch number at a block.
* @param blockNumber Block number where epoch number is calculated.
Expand Down
156 changes: 0 additions & 156 deletions packages/protocol/contracts-0.8/common/UsingRegistry2.sol

This file was deleted.

2 changes: 1 addition & 1 deletion packages/protocol/lib/compatibility/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class ASTBackwardReport {
logFunction: (msg: string) => void): ASTBackwardReport => {

// Run reports
logFunction("Running storage report...")
logFunction("Running storage report...\n")
const storage = reportLayoutIncompatibilities(oldArtifacts, newArtifacts)
logFunction("Done\n")

Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/lib/web3-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ export function deploymentForProxiedContract<ContractInstance extends Truffle.Co
}


export const makeTruffleContractForMigrationWithoutSingleton = (contractName: string, network: any, contractPath: string, web3: Web3) => {

const artifact = require(`${path.join(__dirname, "..")}/build/contracts-${contractPath}/${contractName}.json`)
export const makeTruffleContractForMigrationWithoutSingleton = (contractName: string, network: any, contractPath: string, web3: Web3, buildDir?:string) => {
const buildDirPath = buildDir ? `../${buildDir}` : "../build/"
const artifact = require(`${path.join(__dirname, buildDirPath)}/contracts-${contractPath}/${contractName}.json`)
const Contract = truffleContract({
contractName: artifact.contractName,
abi: artifact.abi,
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/migrations_sol/Migration.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import "@celo-contracts/common/interfaces/IFeeCurrencyWhitelist.sol";
import "@celo-contracts/common/interfaces/IAccounts.sol";
import "@celo-contracts/common/interfaces/IEpochManagerEnabler.sol";
import "@celo-contracts/governance/interfaces/ILockedGoldInitializer.sol";
import "@celo-contracts/governance/interfaces/IValidatorsInitializer.sol";
import "@celo-contracts-8/governance/interfaces/IValidatorsInitializer.sol";
import "@celo-contracts/governance/interfaces/IElectionInitializer.sol";
import "@celo-contracts/governance/interfaces/IEpochRewardsInitializer.sol";
import "@celo-contracts/governance/interfaces/IBlockchainParametersInitializer.sol";
Expand Down
10 changes: 7 additions & 3 deletions packages/protocol/scripts/bash/contract-exclusion-regex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ set -euo pipefail

# Exclude test contracts, mock contracts, contract interfaces, Proxy contracts, inlined libraries,
# MultiSig contracts, and the ReleaseGold contract.
CONTRACT_EXCLUSION_REGEX=".*Test|Mock.*|I[A-Z].*|.*Proxy|MultiSig.*|ReleaseGold|SlasherUtil|UsingPrecompiles|CeloFeeCurrencyAdapterOwnable|FeeCurrencyAdapter|FeeCurrencyAdapterOwnable"
CONTRACT_EXCLUSION_REGEX=".*Test|Mock.*|I[A-Z].*|.*Proxy|MultiSig.*|ReleaseGold|SlasherUtil|UsingPrecompiles|CeloFeeCurrencyAdapterOwnable|FeeCurrencyAdapter|FeeCurrencyAdapterOwnable|IsL2Check|Blockable|PrecompilesOverride|CompileExchange|PrecompilesOverrideV2|UsingRegistryV2NoMento"

echo "BRANCH: $BRANCH"

# Before CR7, UsingRegistry and UsingRegistryV2 had been deployed, they need to keep getting deployed to keep the release reports without changes.
VERSION_NUMBER=$(echo "$BRANCH" | tr -dc '0-9')
VERSION_NUMBER=$(echo "$BRANCH" | grep -o 'v[0-9]\+' | tr -dc '0-9')

echo "VERSION_NUMBER: $VERSION_NUMBER"

Expand Down Expand Up @@ -35,5 +37,7 @@ fi
if [ $VERSION_NUMBER -eq 12 ]
then
# FeeHandlerSeller is not deployed, only its children
CONTRACT_EXCLUSION_REGEX="$CONTRACT_EXCLUSION_REGEX|\\bFeeHandlerSeller\\b"
CONTRACT_EXCLUSION_REGEX="$CONTRACT_EXCLUSION_REGEX|MockElection|\\bFeeHandlerSeller\\b"
fi

echo "FULL CONTRACT_EXCLUSION_REGEX: $CONTRACT_EXCLUSION_REGEX"
6 changes: 3 additions & 3 deletions packages/protocol/scripts/bash/release-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ function build_tag() {
local BRANCH="$1"
local LOG_FILE="$2"

echo "Writing logs to $LOG_FILE"

local CURRENT_HASH=`git log -n 1 --oneline | cut -c 1-9`

git fetch origin +'refs/tags/core-contracts.v*:refs/tags/core-contracts.v*' >> $LOG_FILE

echo " - Checkout contracts source code at $BRANCH"
BUILD_DIR=$(echo build/$(echo $BRANCH | sed -e 's/\//_/g'))
[ -d contracts ] && rm -r contracts

# this remove is necesary because when bringing a contracts folder from previous commit
# if a folder didn't exist in the past, git will not remove the current one
# trying to compile it and leading to potental build errors

rm -rf contracts*
git checkout $BRANCH -- contracts* 2>>$LOG_FILE >> $LOG_FILE
if [ ! -d $BUILD_DIR ]; then
Expand All @@ -34,4 +34,4 @@ function build_tag() {

[ -d contracts ] && rm -r contracts
git checkout $CURRENT_HASH -- contracts 2>>$LOG_FILE >> $LOG_FILE
}
}
3 changes: 2 additions & 1 deletion packages/protocol/scripts/truffle/make-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ module.exports = async (callback: (error?: any) => number) => {
contractName,
{ ...networks[argv.network], name: argv.network },
SOLIDITY_08_PACKAGE.name,
web3
web3,
argv.build_directory
)
// TODO WARNING: make sure there are no libraries with the same name that don't get deployed
}
Expand Down
11 changes: 4 additions & 7 deletions packages/protocol/test-sol/constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ contract TestConstants {
uint256 public constant FIXED1 = 1e24;
uint256 public constant MINUTE = 60;
uint256 public constant HOUR = 60 * MINUTE;
// uint256 public constant DAY = 24 * HOUR;
uint256 public constant MONTH = 30 * 86400;
// uint256 public constant MONTH = 30 * DAY;
uint256 constant WEEK = 7 * 86400;
// uint256 constant WEEK = 7 * DAY;
uint256 public constant YEAR = 365 * 86400;
// uint256 public constant YEAR = 365 * DAY;
uint256 public constant DAY_IN_SECONDS = 86400;
uint256 public constant MONTH = 30 * DAY_IN_SECONDS;
uint256 constant WEEK = 7 * DAY_IN_SECONDS;
uint256 public constant YEAR = 365 * DAY_IN_SECONDS;
uint256 public constant L1_BLOCK_IN_EPOCH = 17280;
uint256 public constant L2_BLOCK_IN_EPOCH = 43200;

Expand Down
1 change: 1 addition & 0 deletions packages/protocol/test-sol/devchain/e2e/utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ contract Devchain is TestWithUtils08 {
}
function setUp() public virtual override {
// Added to avoid adding a setup function in each e2e test, when its not required.
// Note: This function does not call `super.setUp()`, because we dont want to run the parent's setup.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ contract FeeCurrencyDirectoryTest is TestWithUtils08 {
}

contract FeeCurrencyDirectoryTest_L2 is FeeCurrencyDirectoryTest, WhenL2 {
function setUp() public override(FeeCurrencyDirectoryTest, WhenL2) {
function setUp() public virtual override(FeeCurrencyDirectoryTest, WhenL2) {
super.setUp();
}
}
Expand Down Expand Up @@ -84,8 +84,14 @@ contract TestSetCurrencyConfig is FeeCurrencyDirectoryTest {
}
}

contract TestSetCurrencyConfig_L2 is FeeCurrencyDirectoryTest_L2, TestSetCurrencyConfig {
function setUp() public override(FeeCurrencyDirectoryTest, FeeCurrencyDirectoryTest_L2) {
super.setUp();
}
}

contract TestRemoveCurrencies is FeeCurrencyDirectoryTest {
function setUp() public override {
function setUp() public virtual override {
super.setUp();
address token = address(4);
directory.setCurrencyConfig(token, address(oracle), 21000);
Expand Down Expand Up @@ -127,10 +133,16 @@ contract TestRemoveCurrencies is FeeCurrencyDirectoryTest {
}
}

contract TestRemoveCurrencies_L2 is FeeCurrencyDirectoryTest_L2, TestRemoveCurrencies {
function setUp() public override(TestRemoveCurrencies, FeeCurrencyDirectoryTest_L2) {
super.setUp();
}
}

contract TestGetExchangeRate is FeeCurrencyDirectoryTest {
address token;

function setUp() public override {
function setUp() public virtual override {
super.setUp();
token = address(3);
oracle.setExchangeRate(token, 200, 4); // 50:1 ratio
Expand All @@ -148,3 +160,9 @@ contract TestGetExchangeRate is FeeCurrencyDirectoryTest {
directory.getExchangeRate(address(4));
}
}

contract TestGetExchangeRate_L2 is FeeCurrencyDirectoryTest_L2, TestGetExchangeRate {
function setUp() public override(TestGetExchangeRate, FeeCurrencyDirectoryTest_L2) {
super.setUp();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pragma solidity ^0.8.15;

// import "celo-foundry-8/Test.sol";
import "@celo-contracts-8/common/ProxyFactory08.sol";
import "@celo-contracts/common/interfaces/IProxy.sol";

Expand Down
Loading