From bcba8909c63b7a3f4ddcbfe3fb102c03ad837676 Mon Sep 17 00:00:00 2001 From: Big Boss Date: Mon, 7 Oct 2024 13:09:17 -0700 Subject: [PATCH] just use github runners, add clear base fee option (#750) --- .github/workflows/ci.yml | 31 ++++++++++++++++--- .../script/UpdateTokenPaymasterConfig.s.sol | 17 +++++++++- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ce9519f8..9113aef82 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,12 +42,21 @@ jobs: YARN_ENABLE_HARDENED_MODE: 0 steps: + - name: Install Tilt + id: tilt + shell: bash + run: curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash + - name: Add hosts to /etc/hosts + run: | + sudo su + if grep -q "host.docker.internal" /etc/hosts; then + echo "Hosts file already contains host.docker.internal" + else + echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts + fi - uses: actions/checkout@v4 with: submodules: recursive - # No idea how homebrew bundle broke with tilt depending on python so installing manually - - name: Install Tilt - uses: ./.github/actions/install-tilt - name: Set up Homebrew id: set-up-homebrew uses: Homebrew/actions/setup-homebrew@master @@ -99,12 +108,24 @@ jobs: permissions: pull-requests: write + timeout-minutes: 40 + steps: + - name: Install Tilt + id: tilt + shell: bash + run: curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash + - name: Add hosts to /etc/hosts + run: | + sudo su + if grep -q "host.docker.internal" /etc/hosts; then + echo "Hosts file already contains host.docker.internal" + else + echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts + fi - uses: actions/checkout@v4 with: submodules: recursive - - name: Install Tilt - uses: ./.github/actions/install-tilt - name: Set up Homebrew id: set-up-homebrew uses: Homebrew/actions/setup-homebrew@master diff --git a/packages/contracts/script/UpdateTokenPaymasterConfig.s.sol b/packages/contracts/script/UpdateTokenPaymasterConfig.s.sol index ff6888128..e26c81c24 100644 --- a/packages/contracts/script/UpdateTokenPaymasterConfig.s.sol +++ b/packages/contracts/script/UpdateTokenPaymasterConfig.s.sol @@ -7,6 +7,7 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "../src/TokenPaymaster.sol"; +// solhint-disable no-console contract UpdateTokenPaymasterConfigScript is Script, Helper { uint256 private constant PRICE_DENOM = 1e26; uint40 private constant BASE_FEE_DEFAULT = 5e4; // ยข5 @@ -28,13 +29,27 @@ contract UpdateTokenPaymasterConfigScript is Script, Helper { uint40 _baseFee, address _rewardsPool ) = paymaster.tokenPaymasterConfig(); + + console2.log("current priceMarkup", _priceMarkup); + console2.log("current minEntryPointBalance", _minEntryPointBalance); + console2.log("current refundPostopCost", _refundPostopCost); + console2.log("current priceMaxAge", _priceMaxAge); + console2.log("current baseFee", _baseFee); + console2.log("current rewardsPool", _rewardsPool); + uint256 priceMarkup = vm.envOr("PRICE_MARKUP", _priceMarkup); uint128 minEntryPointBalance = uint128(vm.envOr("MIN_ENTRY_POINT_BALANCE", _minEntryPointBalance)); uint48 refundPostopCost = uint48(vm.envOr("REFUND_POSTOP_COST", _refundPostopCost)); uint48 priceMaxAge = uint48(vm.envOr("PRICE_MAX_AGE", _priceMaxAge)); uint40 baseFee = uint40(vm.envOr("BASE_FEE", _baseFee)); + bool baseFeeClear = vm.envOr("BASE_FEE_CLEAR", false); address rewardsPool = vm.envOr("REWARDS_POOL", _rewardsPool); + if (baseFeeClear) { + console2.log("Clearing baseFee", baseFeeClear); + baseFee = 0; + } + require( priceMaxAge != _priceMaxAge || refundPostopCost != _refundPostopCost || minEntryPointBalance != _minEntryPointBalance || priceMarkup != _priceMarkup || baseFee != _baseFee @@ -45,7 +60,7 @@ contract UpdateTokenPaymasterConfigScript is Script, Helper { require(refundPostopCost > 0, "REFUND_POSTOP_COST env variable not set"); require(minEntryPointBalance > 0, "MIN_ENTRY_POINT_BALANCE env variable not set"); require(priceMarkup > 0, "PRICE_MARKUP env variable not set"); - require(baseFee > 0, "BASE_FEE env variable not set"); + require(baseFee > 0 || (baseFee == 0 && baseFeeClear), "BASE_FEE env variable not set"); vm.startBroadcast(); TokenPaymasterConfig memory tpc = TokenPaymasterConfig({