Skip to content

Commit

Permalink
Make solc output folder per contract (#11126)
Browse files Browse the repository at this point in the history
* update generation output path to be folder per contract

* lint bash script

* mass update go generate wrapper path

* regen wrappers and db

* fix not-updated wrappers

* fix more wrappers
  • Loading branch information
matYang authored Nov 3, 2023
1 parent 04ba364 commit 2b8ba05
Show file tree
Hide file tree
Showing 20 changed files with 350 additions and 310 deletions.
11 changes: 7 additions & 4 deletions contracts/scripts/native_solc_compile_all_6
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,21 @@ OPTIMIZE_RUNS=1000000

SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )"
python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt
python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt

solc-select install $SOLC_VERSION
solc-select use $SOLC_VERSION
export SOLC_VERSION=$SOLC_VERSION


compileContract () {
local contract
contract=$(basename "$1" ".sol")

solc --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \
-o $ROOT/contracts/solc/v0.6 \
--abi --bin --allow-paths $ROOT/contracts/src/v0.6 \
$ROOT/contracts/src/v0.6/$1
-o "$ROOT"/contracts/solc/v0.6/"$contract" \
--abi --bin --allow-paths "$ROOT"/contracts/src/v0.6 \
"$ROOT"/contracts/src/v0.6/"$1"
}

compileContract Flags.sol
Expand Down
11 changes: 7 additions & 4 deletions contracts/scripts/native_solc_compile_all_7
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,21 @@ OPTIMIZE_RUNS=1000000

SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )"
python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt
python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt

solc-select install $SOLC_VERSION
solc-select use $SOLC_VERSION
export SOLC_VERSION=$SOLC_VERSION


compileContract () {
local contract
contract=$(basename "$1" ".sol")

solc --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \
-o $ROOT/contracts/solc/v0.7 \
--abi --bin --allow-paths $ROOT/contracts/src/v0.7 \
$ROOT/contracts/src/v0.7/$1
-o "$ROOT"/contracts/solc/v0.7/"$contract" \
--abi --bin --allow-paths "$ROOT"/contracts/src/v0.7 \
"$ROOT"/contracts/src/v0.7/"$1"
}

compileContract tests/MultiWordConsumer.sol
Expand Down
13 changes: 8 additions & 5 deletions contracts/scripts/native_solc_compile_all_automation
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,21 @@ OPTIMIZE_RUNS=1000000

SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )"
python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt
python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt

solc-select install $SOLC_VERSION
solc-select use $SOLC_VERSION
export SOLC_VERSION=$SOLC_VERSION


compileContract () {
solc @openzeppelin/=$ROOT/contracts/node_modules/@openzeppelin/ --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \
-o $ROOT/contracts/solc/v$SOLC_VERSION \
--abi --bin --allow-paths $ROOT/contracts/src/v0.8,$ROOT/contracts/node_modules\
$ROOT/contracts/src/v0.8/$1
local contract
contract=$(basename "$1" ".sol")

solc @openzeppelin/="$ROOT"/contracts/node_modules/@openzeppelin/ --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \
-o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \
--abi --bin --allow-paths "$ROOT"/contracts/src/v0.8,"$ROOT"/contracts/node_modules\
"$ROOT"/contracts/src/v0.8/"$1"
}

compileContract automation/upkeeps/CronUpkeepFactory.sol
Expand Down
11 changes: 7 additions & 4 deletions contracts/scripts/native_solc_compile_all_events_mock
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@ OPTIMIZE_RUNS=1000000

SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )"
python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt
python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt

solc-select install $SOLC_VERSION
solc-select use $SOLC_VERSION
export SOLC_VERSION=$SOLC_VERSION

compileContract () {
local contract
contract=$(basename "$1" ".sol")

solc --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \
-o $ROOT/contracts/solc/v$SOLC_VERSION \
--abi --bin --allow-paths $ROOT/contracts/src/v0.8\
$ROOT/contracts/src/v0.8/$1
-o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \
--abi --bin --allow-paths "$ROOT"/contracts/src/v0.8\
"$ROOT"/contracts/src/v0.8/"$1"
}

# This script is used to compile the contracts for the Events Mocks used in the tests.
Expand Down
11 changes: 7 additions & 4 deletions contracts/scripts/native_solc_compile_all_feeds
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,21 @@ OPTIMIZE_RUNS=1000000

SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )"
python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt
python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt

solc-select install $SOLC_VERSION
solc-select use $SOLC_VERSION
export SOLC_VERSION=$SOLC_VERSION


compileContract () {
local contract
contract=$(basename "$1" ".sol")

solc --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \
-o $ROOT/contracts/solc/v$SOLC_VERSION \
--abi --bin --allow-paths $ROOT/contracts/src/v0.8\
$ROOT/contracts/src/v0.8/$1
-o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \
--abi --bin --allow-paths "$ROOT"/contracts/src/v0.8\
"$ROOT"/contracts/src/v0.8/"$1"
}

# Aggregators
Expand Down
11 changes: 7 additions & 4 deletions contracts/scripts/native_solc_compile_all_llo-feeds
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,21 @@ OPTIMIZE_RUNS=1000000


SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt
python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt
solc-select install $SOLC_VERSION
solc-select use $SOLC_VERSION
export SOLC_VERSION=$SOLC_VERSION

ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )"

compileContract () {
local contract
contract=$(basename "$1" ".sol")

solc --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \
-o $ROOT/contracts/solc/v$SOLC_VERSION \
--abi --bin --allow-paths $ROOT/contracts/src/v0.8\
$ROOT/contracts/src/v0.8/$1
-o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \
--abi --bin --allow-paths "$ROOT"/contracts/src/v0.8\
"$ROOT"/contracts/src/v0.8/"$1"
}

compileContract llo-feeds/Verifier.sol
Expand Down
11 changes: 7 additions & 4 deletions contracts/scripts/native_solc_compile_all_logpoller
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,21 @@ OPTIMIZE_RUNS=1000000


SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt
python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt
solc-select install $SOLC_VERSION
solc-select use $SOLC_VERSION
export SOLC_VERSION=$SOLC_VERSION

ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )"

compileContract () {
local contract
contract=$(basename "$1" ".sol")

solc --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \
-o $ROOT/contracts/solc/v$SOLC_VERSION \
--abi --bin --allow-paths $ROOT/contracts/src/v0.8\
$ROOT/contracts/src/v0.8/$1
-o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \
--abi --bin --allow-paths "$ROOT"/contracts/src/v0.8\
"$ROOT"/contracts/src/v0.8/"$1"
}


Expand Down
13 changes: 8 additions & 5 deletions contracts/scripts/native_solc_compile_all_ocr2vrf
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,22 @@ echo "Compiling OCR2VRF contracts..."

SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1; cd ../../ && pwd -P )"
python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt
python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt

solc-select install $SOLC_VERSION
solc-select use $SOLC_VERSION
export SOLC_VERSION=$SOLC_VERSION


compileContract () {
solc --overwrite --optimize --optimize-runs $2 --metadata-hash none \
-o $ROOT/contracts/solc/v0.8.19 \
local contract
contract=$(basename "$1" ".sol")

solc --overwrite --optimize --optimize-runs "$2" --metadata-hash none \
-o "$ROOT"/contracts/solc/v0.8.19/"$contract" \
--abi --bin \
--allow-paths $ROOT/../$FOLDER/contracts \
$ROOT/$1
--allow-paths "$ROOT"/../$FOLDER/contracts \
"$ROOT"/"$1"
}

# OCR2VRF
Expand Down
13 changes: 8 additions & 5 deletions contracts/scripts/native_solc_compile_all_operatorforwarder
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@ OPTIMIZE_RUNS=1000000

SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )"
python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt
python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt

solc-select install $SOLC_VERSION
solc-select use $SOLC_VERSION
export SOLC_VERSION=$SOLC_VERSION

compileContract () {
solc @openzeppelin/=$ROOT/contracts/node_modules/@openzeppelin/ --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \
-o $ROOT/contracts/solc/v$SOLC_VERSION \
--abi --bin --allow-paths $ROOT/contracts/src/v0.8,$ROOT/contracts/node_modules\
$ROOT/contracts/src/v0.8/$1
local contract
contract=$(basename "$1" ".sol")

solc @openzeppelin/="$ROOT"/contracts/node_modules/@openzeppelin/ --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \
-o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \
--abi --bin --allow-paths "$ROOT"/contracts/src/v0.8,"$ROOT"/contracts/node_modules\
"$ROOT"/contracts/src/v0.8/"$1"
}

# Contracts
Expand Down
11 changes: 7 additions & 4 deletions contracts/scripts/native_solc_compile_all_shared
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,21 @@ OPTIMIZE_RUNS=1000000


SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt
python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt
solc-select install $SOLC_VERSION
solc-select use $SOLC_VERSION
export SOLC_VERSION=$SOLC_VERSION

ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )"

compileContract () {
local contract
contract=$(basename "$1" ".sol")

solc --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \
-o $ROOT/contracts/solc/v$SOLC_VERSION \
--abi --bin --allow-paths $ROOT/contracts/src/v0.8\
$ROOT/contracts/src/v0.8/$1
-o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \
--abi --bin --allow-paths "$ROOT"/contracts/src/v0.8\
"$ROOT"/contracts/src/v0.8/"$1"
}

compileContract shared/token/ERC677/BurnMintERC677.sol
Expand Down
11 changes: 7 additions & 4 deletions contracts/scripts/native_solc_compile_all_transmission
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@ OPTIMIZE_RUNS=1000000

SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )"
python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt
python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt

solc-select install $SOLC_VERSION
solc-select use $SOLC_VERSION
export SOLC_VERSION=$SOLC_VERSION

compileContract () {
local contract
contract=$(basename "$1" ".sol")

solc --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \
-o $ROOT/contracts/solc/v$SOLC_VERSION \
--abi --bin --allow-paths $ROOT/contracts/src/v0.8\
$ROOT/contracts/src/v0.8/$1
-o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \
--abi --bin --allow-paths "$ROOT"/contracts/src/v0.8\
"$ROOT"/contracts/src/v0.8/"$1"
}

# Contracts
Expand Down
25 changes: 16 additions & 9 deletions contracts/scripts/native_solc_compile_all_vrf
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,30 @@ OPTIMIZE_RUNS=1000000

SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )"
python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt
python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt

solc-select install $SOLC_VERSION
solc-select use $SOLC_VERSION
export SOLC_VERSION=$SOLC_VERSION

compileContract () {
solc @openzeppelin/=$ROOT/contracts/node_modules/@openzeppelin/ --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \
-o $ROOT/contracts/solc/v$SOLC_VERSION \
--abi --bin --allow-paths $ROOT/contracts/src/v0.8,$ROOT/contracts/node_modules\
$ROOT/contracts/src/v0.8/$1
local contract
contract=$(basename "$1" ".sol")

solc @openzeppelin/="$ROOT"/contracts/node_modules/@openzeppelin/ --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \
-o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \
--abi --bin --allow-paths "$ROOT"/contracts/src/v0.8,"$ROOT"/contracts/node_modules\
"$ROOT"/contracts/src/v0.8/"$1"
}

compileContractAltOpts () {
solc @openzeppelin/=$ROOT/contracts/node_modules/@openzeppelin/ --overwrite --optimize --optimize-runs $2 --metadata-hash none \
-o $ROOT/contracts/solc/v$SOLC_VERSION \
--abi --bin --allow-paths $ROOT/contracts/src/v0.8,$ROOT/contracts/node_modules\
$ROOT/contracts/src/v0.8/$1
local contract
contract=$(basename "$1" ".sol")

solc @openzeppelin/="$ROOT"/contracts/node_modules/@openzeppelin/ --overwrite --optimize --optimize-runs "$2" --metadata-hash none \
-o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \
--abi --bin --allow-paths "$ROOT"/contracts/src/v0.8,"$ROOT"/contracts/node_modules\
"$ROOT"/contracts/src/v0.8/"$1"
}

# VRF
Expand Down Expand Up @@ -73,6 +79,7 @@ compileContract vrf/dev/testhelpers/VRFConsumerV2PlusUpgradeableExample.sol
compileContract vrf/dev/testhelpers/VRFV2PlusMaliciousMigrator.sol
compileContract vrf/dev/libraries/VRFV2PlusClient.sol
compileContract vrf/dev/testhelpers/VRFCoordinatorV2Plus_V2Example.sol
compileContract vrf/dev/BlockhashStore.sol
compileContract vrf/dev/TrustedBlockhashStore.sol
compileContract vrf/dev/testhelpers/VRFV2PlusLoadTestWithMetrics.sol
compileContractAltOpts vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol 5
Expand Down
Loading

0 comments on commit 2b8ba05

Please sign in to comment.