From 81641f3305bb888b061605950a4d50fe3fb80bc8 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 10:28:29 +0000 Subject: [PATCH 01/25] struct less solution to viaIR --- contracts/libraries/HyperdriveMath.sol | 44 +++++---- contracts/libraries/YieldSpaceMath.sol | 123 +++++++++---------------- foundry.toml | 2 +- test/YieldSpaceMath.t.sol | 6 +- 4 files changed, 70 insertions(+), 105 deletions(-) diff --git a/contracts/libraries/HyperdriveMath.sol b/contracts/libraries/HyperdriveMath.sol index ba509c0cb..298b93bea 100644 --- a/contracts/libraries/HyperdriveMath.sol +++ b/contracts/libraries/HyperdriveMath.sol @@ -133,15 +133,18 @@ library HyperdriveMath { // timeRemaining*amountIn shares to purchase newly minted bonds on a // YieldSpace curve configured to timeRemaining = 1. uint256 curveIn = _amountIn.mulDown(_timeRemaining); + + // Credit the share reserves by the flat trade. + _shareReserves = _shareReserves.add(flat); + // Debit the bond reserves by the flat trade. + _bondReserves = _bondReserves.sub(flat.mulDown(_sharePrice)); + uint256 curveOut = YieldSpaceMath.calculateOutGivenIn( - // Credit the share reserves by the flat trade. - _shareReserves.add(flat), - // Debit the bond reserves by the flat trade. - _bondReserves.sub(flat.mulDown(_sharePrice)), + _shareReserves, + _bondReserves, _bondReserveAdjustment, curveIn, - FixedPointMath.ONE_18, - _timeStretch, + FixedPointMath.ONE_18.sub(_timeStretch), _sharePrice, _initialSharePrice, _isBondOut @@ -162,15 +165,18 @@ library HyperdriveMath { uint256 curveIn = _amountIn.mulDown(_timeRemaining).divDown( _sharePrice ); + + // Debit the share reserves by the flat trade. + _shareReserves = _shareReserves.sub(flat); + // Credit the bond reserves by the flat trade. + _bondReserves = _bondReserves.add(flat.mulDown(_sharePrice)); + uint256 curveOut = YieldSpaceMath.calculateOutGivenIn( - // Debit the share reserves by the flat trade. - _shareReserves.sub(flat), - // Credit the bond reserves by the flat trade. - _bondReserves.add(flat.mulDown(_sharePrice)), + _shareReserves, + _bondReserves, _bondReserveAdjustment, curveIn, - FixedPointMath.ONE_18, - _timeStretch, + FixedPointMath.ONE_18.sub(_timeStretch), _sharePrice, _initialSharePrice, _isBondOut @@ -230,15 +236,17 @@ library HyperdriveMath { uint256 curveOut = _amountOut.mulDown(_timeRemaining).divDown( _sharePrice ); + + // Credit the share reserves by the flat trade. + _shareReserves = _shareReserves.add(flat); + // Debit the bond reserves by the flat trade. + _bondReserves = _bondReserves.sub(flat.mulDown(_sharePrice)); uint256 curveIn = YieldSpaceMath.calculateInGivenOut( - // Credit the share reserves by the flat trade. - _shareReserves.add(flat), - // Debit the bond reserves by the flat trade. - _bondReserves.sub(flat.mulDown(_sharePrice)), + _shareReserves, + _bondReserves, _bondReserveAdjustment, curveOut, - FixedPointMath.ONE_18, - _timeStretch, + FixedPointMath.ONE_18.sub(_timeStretch), _sharePrice, _initialSharePrice, false diff --git a/contracts/libraries/YieldSpaceMath.sol b/contracts/libraries/YieldSpaceMath.sol index 27053f428..3678cdac1 100644 --- a/contracts/libraries/YieldSpaceMath.sol +++ b/contracts/libraries/YieldSpaceMath.sol @@ -19,8 +19,7 @@ library YieldSpaceMath { /// @param bondReserves bond reserves amount, unit is the face value in underlying /// @param bondReserveAdjustment An optional adjustment to the reserve which MUST have units of underlying. /// @param amountIn amount to be traded, if bonds in the unit is underlying, if shares in the unit is shares - /// @param t time till maturity in seconds - /// @param s time stretch coefficient. e.g. 25 years in seconds + /// @param oneMinusT 1 - st /// @param c price of shares in terms of their base /// @param mu Normalization factor -- starts as c at initialization /// @param isBondOut determines if the output is bond or shares @@ -30,56 +29,31 @@ library YieldSpaceMath { uint256 bondReserves, uint256 bondReserveAdjustment, uint256 amountIn, - uint256 t, - uint256 s, + uint256 oneMinusT, uint256 c, uint256 mu, bool isBondOut - ) internal pure returns (uint256 result) { - uint256 outReserves; - uint256 rhs; - // Notes: 1 >= 1-st >= 0 - uint256 oneMinusT = FixedPointMath.ONE_18.sub(s.mulDown(t)); - // c/mu + ) internal pure returns (uint256) { uint256 cDivMu = c.divDown(mu); - // Adjust the bond reserve, optionally shifts the curve around the inflection point - uint256 modifiedBondReserves = bondReserves.add(bondReserveAdjustment); - // c/mu * (mu*shareReserves)^(1-t) + bondReserves^(1-t) - uint256 k = cDivMu - .mulDown(mu.mulDown(shareReserves).pow(oneMinusT)) - .add(modifiedBondReserves.pow(oneMinusT)); - + bondReserves = bondReserves.add(bondReserveAdjustment); + uint256 k = _k(cDivMu, mu, shareReserves, oneMinusT, bondReserves); if (isBondOut) { - // bondOut = bondReserves - ( c/mu * (mu*shareReserves)^(1-t) + bondReserves^(1-t) - c/mu * (mu*(shareReserves + shareIn))^(1-t) )^(1 / (1 - t)) - outReserves = modifiedBondReserves; - // (mu*(shareReserves + amountIn))^(1-t) - uint256 newScaledShareReserves = mu - .mulDown(shareReserves.add(amountIn)) - .pow(oneMinusT); - // c/mu * (mu*(shareReserves + amountIn))^(1-t) - newScaledShareReserves = cDivMu.mulDown(newScaledShareReserves); - // Notes: k - newScaledShareReserves >= 0 to avoid a complex number - // ( c/mu * (mu*shareReserves)^(1-t) + bondReserves^(1-t) - c/mu * (mu*(shareReserves + amountIn))^(1-t) )^(1 / (1 - t)) - rhs = k.sub(newScaledShareReserves).pow( + shareReserves = mu.mulDown(shareReserves.add(amountIn)).pow( + oneMinusT + ); + shareReserves = cDivMu.mulDown(shareReserves); + uint256 rhs = k.sub(shareReserves).pow( FixedPointMath.ONE_18.divDown(oneMinusT) ); + return bondReserves.sub(rhs); } else { - // shareOut = shareReserves - [ ( c/mu * (mu * shareReserves)^(1-t) + bondReserves^(1-t) - (bondReserves + bondIn)^(1-t) ) / c/u ]^(1 / (1 - t)) / mu - outReserves = shareReserves; - // (bondReserves + bondIn)^(1-t) - uint256 newScaledBondReserves = modifiedBondReserves - .add(amountIn) - .pow(oneMinusT); - // Notes: k - newScaledBondReserves >= 0 to avoid a complex number - // [( (mu * shareReserves)^(1-t) + bondReserves^(1-t) - (bondReserves + bondIn)^(1-t) ) / c/u ]^(1 / (1 - t)) - rhs = k.sub(newScaledBondReserves).divDown(cDivMu).pow( + bondReserves = bondReserves.add(amountIn).pow(oneMinusT); + uint256 rhs = k.sub(bondReserves).divDown(cDivMu).pow( FixedPointMath.ONE_18.divDown(oneMinusT) ); - // [( (mu * shareReserves)^(1-t) + bondReserves^(1-t) - (bondReserves + bondIn)^(1-t) ) / c/u ]^(1 / (1 - t)) / mu rhs = rhs.divDown(mu); + return shareReserves.sub(rhs); } - // Notes: outReserves - rhs >= 0, but i think avoiding a complex number in the step above ensures this never happens - result = outReserves.sub(rhs); } /// @dev Calculates the amount of an asset that will be received given a @@ -88,8 +62,7 @@ library YieldSpaceMath { /// @param bondReserves bond reserves amount, unit is the face value in underlying /// @param bondReserveAdjustment An optional adjustment to the reserve which MUST have units of underlying. /// @param amountOut amount to be received, if bonds in the unit is underlying, if shares in the unit is shares - /// @param t time till maturity in seconds - /// @param s time stretch coefficient. e.g. 25 years in seconds + /// @param oneMinusT 1 - st /// @param c price of shares in terms of their base /// @param mu Normalization factor -- starts as c at initialization /// @param isBondIn determines if the input is bond or shares @@ -99,57 +72,43 @@ library YieldSpaceMath { uint256 bondReserves, uint256 bondReserveAdjustment, uint256 amountOut, - uint256 t, - uint256 s, + uint256 oneMinusT, uint256 c, uint256 mu, bool isBondIn - ) internal pure returns (uint256 result) { - uint256 inReserves; - uint256 rhs; - // Notes: 1 >= 1-st >= 0 - uint256 oneMinusT = FixedPointMath.ONE_18.sub(s.mulDown(t)); - // c/mu + ) internal pure returns (uint256) { uint256 cDivMu = c.divDown(mu); - // Adjust the bond reserve, optionally shifts the curve around the inflection point - uint256 modifiedBondReserves = bondReserves.add(bondReserveAdjustment); - // c/mu * (mu*shareReserves)^(1-t) + bondReserves^(1-t) - uint256 k = cDivMu - .mulDown(mu.mulDown(shareReserves).pow(oneMinusT)) - .add(modifiedBondReserves.pow(oneMinusT)); - + bondReserves = bondReserves.add(bondReserveAdjustment); + uint256 k = _k(cDivMu, mu, shareReserves, oneMinusT, bondReserves); if (isBondIn) { - // bondIn = ( c/mu * (mu*shareReserves)^(1-t) + bondReserves^(1-t) - c/mu * (mu*(shareReserves - shareOut))^(1-t) )^(1 / (1 - t)) - bond_reserves - inReserves = modifiedBondReserves; - // (mu*(shareReserves - amountOut))^(1-t) - uint256 newScaledShareReserves = mu - .mulDown(shareReserves.sub(amountOut)) - .pow(oneMinusT); - // c/mu * (mu*(shareReserves - amountOut))^(1-t) - newScaledShareReserves = cDivMu.mulDown(newScaledShareReserves); - // Notes: k - newScaledShareReserves >= 0 to avoid a complex number - // ( c/mu * (mu*shareReserves)^(1-t) + bondReserves^(1-t) - c/mu * (mu*(shareReserves - amountOut))^(1-t) )^(1 / (1 - t)) - rhs = k.sub(newScaledShareReserves).pow( + shareReserves = mu.mulDown(shareReserves.sub(amountOut)).pow( + oneMinusT + ); + shareReserves = cDivMu.mulDown(shareReserves); + uint256 rhs = k.sub(shareReserves).pow( FixedPointMath.ONE_18.divDown(oneMinusT) ); + return rhs.sub(bondReserves); } else { - // shareOut = [ ( c/mu * (mu * shareReserves)^(1-t) + bondReserves^(1-t) - (bondReserves - bondOut)^(1-t) ) / c/u ]^(1 / (1 - t)) / mu - share_reserves - inReserves = shareReserves; - // (bondReserves - amountOut)^(1-t) - uint256 newScaledBondReserves = modifiedBondReserves - .sub(amountOut) - .pow(oneMinusT); - // Notes: k - newScaledBondReserves >= 0 to avoid a complex number - // [( (mu * shareReserves)^(1-t) + bondReserves^(1-t) - (bondReserves - amountOut)^(1-t) ) / c/u ]^(1 / (1 - t)) - rhs = k.sub(newScaledBondReserves).divDown(cDivMu).pow( + bondReserves = bondReserves.sub(amountOut).pow(oneMinusT); + uint256 rhs = k.sub(bondReserves).divDown(cDivMu).pow( FixedPointMath.ONE_18.divDown(oneMinusT) ); - // [( (mu * shareReserves)^(1-t) + bondReserves^(1-t) - (bondReserves - amountOut)^(1-t) ) / c/u ]^(1 / (1 - t)) / mu rhs = rhs.divDown(mu); + return rhs.sub(shareReserves); } - // TODO: Double check this. - // - // Notes: rhs - inReserves >= 0, but i think avoiding a complex number in the step above ensures this never happens - result = rhs.sub(inReserves); + } + + function _k( + uint256 cDivMu, + uint256 mu, + uint256 shareReserves, + uint256 oneMinusT, + uint256 modifiedBondReserves + ) private pure returns (uint256) { + return + cDivMu.mulDown(mu.mulDown(shareReserves).pow(oneMinusT)).add( + modifiedBondReserves.pow(oneMinusT) + ); } } diff --git a/foundry.toml b/foundry.toml index df0b7e6b4..16fcc9adc 100644 --- a/foundry.toml +++ b/foundry.toml @@ -16,7 +16,7 @@ optimizer = true # The number of optimizer runs optimizer_runs = 7500 # Whether or not to use the Yul intermediate representation compilation pipeline -via_ir = true +via_ir = false remappings = ['forge-std=lib/forge-std/src', '@openzeppelin/=node_modules/@openzeppelin'] # gas limit - max u64 diff --git a/test/YieldSpaceMath.t.sol b/test/YieldSpaceMath.t.sol index d271a9a9c..e4be630d1 100644 --- a/test/YieldSpaceMath.t.sol +++ b/test/YieldSpaceMath.t.sol @@ -12,8 +12,7 @@ contract YieldSpaceMathTest is Test { 62.38101813e18, // bondReserves 119.1741606776616e18, // bondReserveAdjustment 5.03176076e18, // amountOut - 0.08065076081220067e18, // t - 1e18, // s + 1e18 - 0.08065076081220067e18, // t 1e18, // c 1e18, // mu true // isBondIn @@ -29,8 +28,7 @@ contract YieldSpaceMathTest is Test { 56.92761678068477e18, // bondReserves 119.1741606776616e18, // bondReserveAdjustment 5.500250311701939e18, // amountOut - 0.08065076081220067e18, // t - 1e18, // s + 1e18 - 0.08065076081220067e18, // t 1e18, // c 1e18, // mu false // isBondIn From 5c4d66aea7ad316b71420fcdc23b2b21bc1abd9d Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 10:43:52 +0000 Subject: [PATCH 02/25] add workflow for coverage --- .github/workflows/coverage.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 000000000..147560897 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,18 @@ +on: [push] + +name: coverage + +jobs: + check: + name: Foundry project + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + + - name: Run coverage + run: forge coverage >> $GITHUB_STEP_SUMMARY From bcda42858c516042fd78636a149b531b1d00e3b3 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 10:45:23 +0000 Subject: [PATCH 03/25] add node in workflow --- .github/workflows/coverage.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 147560897..42c401baf 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -11,6 +11,18 @@ jobs: with: submodules: recursive + - name: install node + uses: actions/setup-node@v3 + with: + node-version: 14.x + + - name: install packages + uses: borales/actions-yarn@v4 + with: + cmd: install # will run `yarn install` command + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # if needed + - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 From 01847014d4cb8dff5ce452bb2874cfff2f1caa51 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 10:53:42 +0000 Subject: [PATCH 04/25] update --- .github/workflows/coverage.yml | 18 ++++++++++++++---- .github/workflows/lint.yml | 4 +--- .github/workflows/test.yml | 4 +--- .gitignore | 2 ++ 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 42c401baf..24142f1c6 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,10 +1,8 @@ on: [push] -name: coverage - jobs: check: - name: Foundry project + name: coverage runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -27,4 +25,16 @@ jobs: uses: foundry-rs/foundry-toolchain@v1 - name: Run coverage - run: forge coverage >> $GITHUB_STEP_SUMMARY + run: forge coverage --report lcov + + - name: Setup LCOV + uses: hrishikesh-kadam/setup-lcov@v1 + + - name: Report code coverage + uses: zgosalvez/github-actions-report-lcov@v3 + with: + coverage-files: lcov.info + artifact-name: code-coverage-report + github-token: ${{ secrets.GITHUB_TOKEN }} + + # run: lcov --remove lcov.info -o lcov.info 'test/*' 'script/*' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 60a67ac8e..32a8ddbba 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,10 +1,8 @@ on: [push] -name: lint - jobs: build: - name: solidity + name: lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 258a72fb0..60d0d4d08 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,10 +1,8 @@ on: [push] -name: test - jobs: check: - name: solidity + name: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.gitignore b/.gitignore index 4bb3c375a..7ce3c7dc4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ node_modules/ yarn-error.log .direnv + +lcov.info From 359aca1a871c7d3f40ce286fa7c7fcedcc93a278 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 10:55:02 +0000 Subject: [PATCH 05/25] update --- .github/workflows/coverage.yml | 4 ++-- .github/workflows/lint.yml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 24142f1c6..0daaa72dc 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,5 +1,7 @@ on: [push] +name: hyperdrive + jobs: check: name: coverage @@ -36,5 +38,3 @@ jobs: coverage-files: lcov.info artifact-name: code-coverage-report github-token: ${{ secrets.GITHUB_TOKEN }} - - # run: lcov --remove lcov.info -o lcov.info 'test/*' 'script/*' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 32a8ddbba..805c7f4d9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,5 +1,7 @@ on: [push] +name: hyperdrive + jobs: build: name: lint From 80dc4cd076db59aac2a51b543ccfc591fa889578 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 10:55:08 +0000 Subject: [PATCH 06/25] update --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 60d0d4d08..3dfccffcf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,7 @@ on: [push] +name: hyperdrive + jobs: check: name: test From 9121e005eb1f94d5ce107829329337800b3bd12e Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 11:17:04 +0000 Subject: [PATCH 07/25] use codecov --- .github/workflows/coverage.yml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 0daaa72dc..67422dc80 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -29,12 +29,19 @@ jobs: - name: Run coverage run: forge coverage --report lcov - - name: Setup LCOV - uses: hrishikesh-kadam/setup-lcov@v1 - - - name: Report code coverage - uses: zgosalvez/github-actions-report-lcov@v3 - with: - coverage-files: lcov.info - artifact-name: code-coverage-report - github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Upload to codecov + uses: codecov/codecov-action@v3 + with: token: ${{ secrets.CODECOV_TOKEN }} + files: ./lcov.info + fail_ci_if_error: true + + + # - name: Setup LCOV + # uses: hrishikesh-kadam/setup-lcov@v1 + + # - name: Report code coverage + # uses: zgosalvez/github-actions-report-lcov@v3 + # with: + # coverage-files: lcov.info + # artifact-name: code-coverage-report + # github-token: ${{ secrets.GITHUB_TOKEN }} From 4ca424b97b279807f49c58a753e6ddcab7b69e8c Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 11:17:47 +0000 Subject: [PATCH 08/25] remove comments --- .github/workflows/coverage.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 67422dc80..5f4148dca 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -35,13 +35,3 @@ jobs: files: ./lcov.info fail_ci_if_error: true - - # - name: Setup LCOV - # uses: hrishikesh-kadam/setup-lcov@v1 - - # - name: Report code coverage - # uses: zgosalvez/github-actions-report-lcov@v3 - # with: - # coverage-files: lcov.info - # artifact-name: code-coverage-report - # github-token: ${{ secrets.GITHUB_TOKEN }} From 2aea68f45b3f4f7a3cea81bb8745e04f4f8e83ba Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 11:20:31 +0000 Subject: [PATCH 09/25] update --- .github/workflows/coverage.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 5f4148dca..7f97731c2 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -31,7 +31,8 @@ jobs: - name: Upload to codecov uses: codecov/codecov-action@v3 - with: token: ${{ secrets.CODECOV_TOKEN }} - files: ./lcov.info - fail_ci_if_error: true - + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./lcov.info + fail_ci_if_error: true + verbose: true From 255e1eaea48fc02a1c248d435525a3b2fb4ab004 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 11:24:17 +0000 Subject: [PATCH 10/25] added comment? --- .github/workflows/coverage.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 7f97731c2..411efa828 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -36,3 +36,9 @@ jobs: files: ./lcov.info fail_ci_if_error: true verbose: true + comment: # this is a top-level key + layout: "reach, diff, flags, files" + behavior: default + require_changes: false # if true: only post the comment if coverage changes + require_base: no # [yes :: must have a base report to post] + require_head: yes From 63ceba3b97bd4fc6288f794ed4e11474696e6e26 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 11:26:37 +0000 Subject: [PATCH 11/25] update --- codecov.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..896ea35c1 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,6 @@ +comment: + layout: "reach, diff, flags, files" + behavior: default + require_changes: false + require_base: no + require_head: yes From 3873340e8f9719727345e670d2ef167ee1053df9 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 11:26:59 +0000 Subject: [PATCH 12/25] remove comment --- .github/workflows/coverage.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 411efa828..7f97731c2 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -36,9 +36,3 @@ jobs: files: ./lcov.info fail_ci_if_error: true verbose: true - comment: # this is a top-level key - layout: "reach, diff, flags, files" - behavior: default - require_changes: false # if true: only post the comment if coverage changes - require_base: no # [yes :: must have a base report to post] - require_head: yes From a2b292ca314550fc7d8272e64c4c9bcbe50e6370 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 11:33:26 +0000 Subject: [PATCH 13/25] filter test and script files --- .github/workflows/coverage.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 7f97731c2..99f6b3885 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -27,7 +27,9 @@ jobs: uses: foundry-rs/foundry-toolchain@v1 - name: Run coverage - run: forge coverage --report lcov + run: | + forge coverage --report lcov + lcov --remove lcov.info 'test/*' 'script/*' > lcov.info - name: Upload to codecov uses: codecov/codecov-action@v3 From 502bc65c0e06b26460b3c14b95103093ef3efa6b Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 11:35:44 +0000 Subject: [PATCH 14/25] add to README --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index e2d0bd5d9..26ecf2c97 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![codecov](https://codecov.io/gh/element-fi/hyperdrive/branch/main/graph/badge.svg?token=I35ZGDABCS)](https://codecov.io/gh/element-fi/hyperdrive) + # Hyperdrive Hyperdrive is an automated market maker that enables fixed-rate markets to be @@ -34,3 +36,9 @@ If you want to automatically format the code, run `yarn prettier`. The language used in this codebase is for coding convenience only, and is not intended to, and does not, have any particular legal or regulatory significance. + +# Coverage + + + + From 37bdf0ae45164706a45d5537bccdb3d182e833e2 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 11:38:37 +0000 Subject: [PATCH 15/25] comment --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 26ecf2c97..13b1ecd58 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ If you want to automatically format the code, run `yarn prettier`. The language used in this codebase is for coding convenience only, and is not intended to, and does not, have any particular legal or regulatory significance. -# Coverage +## Coverage From f7434769cc11eb232ca396f1dc1492a4e4362706 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 11:42:34 +0000 Subject: [PATCH 16/25] update --- codecov.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/codecov.yml b/codecov.yml index 896ea35c1..c8f7db32b 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,3 +1,6 @@ +ignore: + - "test" + - "script" comment: layout: "reach, diff, flags, files" behavior: default From ea5ee16609f59fd7e8a11c3836de270da13542da Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 11:42:56 +0000 Subject: [PATCH 17/25] fix --- .github/workflows/coverage.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 99f6b3885..7f97731c2 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -27,9 +27,7 @@ jobs: uses: foundry-rs/foundry-toolchain@v1 - name: Run coverage - run: | - forge coverage --report lcov - lcov --remove lcov.info 'test/*' 'script/*' > lcov.info + run: forge coverage --report lcov - name: Upload to codecov uses: codecov/codecov-action@v3 From 09eeece46f7ad99ae2a47528a5f1ba7f18fcb3ce Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 15:58:08 +0000 Subject: [PATCH 18/25] update --- .github/workflows/coverage.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 7f97731c2..f917937a9 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -27,7 +27,10 @@ jobs: uses: foundry-rs/foundry-toolchain@v1 - name: Run coverage - run: forge coverage --report lcov + run: | + forge coverage --report lcov + sudo apt-get install lcov + lcov --remove lcov.info -o lcov.info 'test/*' 'script/*' - name: Upload to codecov uses: codecov/codecov-action@v3 From e5add5d66dc302a1c59055108792d4e9f4659096 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 16:08:59 +0000 Subject: [PATCH 19/25] linting --- codecov.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codecov.yml b/codecov.yml index c8f7db32b..0e6c77b56 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,6 +1,6 @@ ignore: - - "test" - - "script" + - "test" + - "script" comment: layout: "reach, diff, flags, files" behavior: default From 30dd3af7d129835f12f9c49f6b2c4a6b2f586569 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 16:33:47 +0000 Subject: [PATCH 20/25] update --- codecov.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codecov.yml b/codecov.yml index 0e6c77b56..eec775e9d 100644 --- a/codecov.yml +++ b/codecov.yml @@ -7,3 +7,5 @@ comment: require_changes: false require_base: no require_head: yes +codecov: + bot: "Padraic-O-Mhuiris" From fefe46b84dd092ee6c91325a3fcaa0506498c589 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 16:39:19 +0000 Subject: [PATCH 21/25] use coveralls instead of codecov --- .github/workflows/coverage.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index f917937a9..1340c5cb1 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,4 +1,4 @@ -on: [push] +on: ["push", "pull_request"] name: hyperdrive @@ -32,10 +32,8 @@ jobs: sudo apt-get install lcov lcov --remove lcov.info -o lcov.info 'test/*' 'script/*' - - name: Upload to codecov - uses: codecov/codecov-action@v3 + - name: Coveralls + uses: coverallsapp/github-action@master with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./lcov.info - fail_ci_if_error: true - verbose: true + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: "./lcov.info" From b9017ad855b8459912f3ec6ec041d56106e18adb Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 16:41:01 +0000 Subject: [PATCH 22/25] update --- .github/workflows/coverage.yml | 2 +- codecov.yml | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 codecov.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 1340c5cb1..45a452f7e 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,4 +1,4 @@ -on: ["push", "pull_request"] +on: [push] name: hyperdrive diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index eec775e9d..000000000 --- a/codecov.yml +++ /dev/null @@ -1,11 +0,0 @@ -ignore: - - "test" - - "script" -comment: - layout: "reach, diff, flags, files" - behavior: default - require_changes: false - require_base: no - require_head: yes -codecov: - bot: "Padraic-O-Mhuiris" From 5139d9b80ec4e0763fa481182adeb038f769f0a5 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 16:46:20 +0000 Subject: [PATCH 23/25] test --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index 13b1ecd58..3e5419a8f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![codecov](https://codecov.io/gh/element-fi/hyperdrive/branch/main/graph/badge.svg?token=I35ZGDABCS)](https://codecov.io/gh/element-fi/hyperdrive) +[![Coverage Status](https://coveralls.io/repos/github/element-fi/hyperdrive/badge.svg?branch=via-ir-2&t=US78Aq)](https://coveralls.io/github/element-fi/hyperdrive?branch=via-ir-2) # Hyperdrive @@ -36,9 +36,3 @@ If you want to automatically format the code, run `yarn prettier`. The language used in this codebase is for coding convenience only, and is not intended to, and does not, have any particular legal or regulatory significance. - -## Coverage - - - - From c6390556e9518167e022ab68e7b60a098df2c704 Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 16:47:59 +0000 Subject: [PATCH 24/25] 2hjc --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3e5419a8f..2a88bf24b 100644 --- a/README.md +++ b/README.md @@ -36,3 +36,5 @@ If you want to automatically format the code, run `yarn prettier`. The language used in this codebase is for coding convenience only, and is not intended to, and does not, have any particular legal or regulatory significance. + +22cc2c From 2d4ab10013225a3fc69eac333bdb8ce1dea1c8fb Mon Sep 17 00:00:00 2001 From: padraic Date: Fri, 10 Feb 2023 16:50:02 +0000 Subject: [PATCH 25/25] xqwx --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a88bf24b..ac0218b8e 100644 --- a/README.md +++ b/README.md @@ -37,4 +37,4 @@ If you want to automatically format the code, run `yarn prettier`. The language used in this codebase is for coding convenience only, and is not intended to, and does not, have any particular legal or regulatory significance. -22cc2c +22cc2cx2qxw