Skip to content

Commit ef4dd87

Browse files
jjgonecryptodrptbldbeal-ethbarrassoSynthetix Team
authored
Kaus release v2.51 (Synthetixio#1574)
* Kaus Release v2.51 * Deploy Kaus v2.51 to OVM mainnet Co-authored-by: Jakub Mucha <jakub.mucha@icloud.com> Co-authored-by: dbeal <git@dbeal.dev> Co-authored-by: Mark Barrasso <4982406+barrasso@users.noreply.github.com> Co-authored-by: Synthetix Team <team@synthetix.io> Co-authored-by: Arthur Deygin <29574203+artdgn@users.noreply.github.com> Co-authored-by: Liam Zebedee <liamzebedee@yahoo.com.au> Co-authored-by: Jackson <jackosmacko@gmail.com>
1 parent 70186f2 commit ef4dd87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+3933
-1386
lines changed

.circleci/config.yml

+17-17
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
job-audit:
1717
working_directory: ~/repo
1818
docker:
19-
- image: synthetixio/docker-sec-tools:14.17-ubuntu
19+
- image: synthetixio/docker-sec-tools:14.18-ubuntu
2020
auth:
2121
username: $DOCKERHUB_USERNAME
2222
password: $DOCKERHUB_TOKEN
@@ -25,15 +25,15 @@ jobs:
2525
- run:
2626
name: Audit dependencies
2727
command: |
28-
npm audit --audit-level=critical || true # Temporarily allow critical audits to pass
28+
npm audit --audit-level=critical
2929
- run:
3030
name: Lint lockfile
3131
command: |
32-
lockfile-lint -p package-lock.json --type npm --allowed-hosts npm github.com --allowed-schemes "https:" "git+ssh:"
32+
lockfile-lint -p package-lock.json --type npm --allowed-hosts npm --validate-https --empty-hostname false
3333
job-compile:
3434
working_directory: ~/repo
3535
docker:
36-
- image: synthetixio/docker-node:14.17-ubuntu
36+
- image: synthetixio/docker-node:14.18-ubuntu
3737
auth:
3838
username: $DOCKERHUB_USERNAME
3939
password: $DOCKERHUB_TOKEN
@@ -47,7 +47,7 @@ jobs:
4747
job-fork-tests:
4848
working_directory: ~/repo
4949
docker:
50-
- image: synthetixio/docker-node:14.17-ubuntu
50+
- image: synthetixio/docker-node:14.18-ubuntu
5151
auth:
5252
username: $DOCKERHUB_USERNAME
5353
password: $DOCKERHUB_TOKEN
@@ -117,7 +117,7 @@ jobs:
117117
job-lint:
118118
working_directory: ~/repo
119119
docker:
120-
- image: synthetixio/docker-node:14.17-ubuntu
120+
- image: synthetixio/docker-node:14.18-ubuntu
121121
auth:
122122
username: $DOCKERHUB_USERNAME
123123
password: $DOCKERHUB_TOKEN
@@ -129,7 +129,7 @@ jobs:
129129
job-pack-browser:
130130
working_directory: ~/repo
131131
docker:
132-
- image: synthetixio/docker-node:14.17-ubuntu
132+
- image: synthetixio/docker-node:14.18-ubuntu
133133
auth:
134134
username: $DOCKERHUB_USERNAME
135135
password: $DOCKERHUB_TOKEN
@@ -143,7 +143,7 @@ jobs:
143143
job-prepare:
144144
working_directory: ~/repo
145145
docker:
146-
- image: synthetixio/docker-node:14.17-ubuntu
146+
- image: synthetixio/docker-node:14.18-ubuntu
147147
auth:
148148
username: $DOCKERHUB_USERNAME
149149
password: $DOCKERHUB_TOKEN
@@ -173,7 +173,7 @@ jobs:
173173
job-simulate-release:
174174
working_directory: ~/repo
175175
docker:
176-
- image: synthetixio/docker-node:14.17-ubuntu
176+
- image: synthetixio/docker-node:14.18-ubuntu
177177
auth:
178178
username: $DOCKERHUB_USERNAME
179179
password: $DOCKERHUB_TOKEN
@@ -196,7 +196,7 @@ jobs:
196196
job-static-analysis:
197197
working_directory: ~/repo
198198
docker:
199-
- image: synthetixio/docker-node:14.17-ubuntu
199+
- image: synthetixio/docker-node:14.18-ubuntu
200200
auth:
201201
username: $DOCKERHUB_USERNAME
202202
password: $DOCKERHUB_TOKEN
@@ -216,7 +216,7 @@ jobs:
216216
job-test-deploy-script:
217217
working_directory: ~/repo
218218
docker:
219-
- image: synthetixio/docker-node:14.17-ubuntu
219+
- image: synthetixio/docker-node:14.18-ubuntu
220220
auth:
221221
username: $DOCKERHUB_USERNAME
222222
password: $DOCKERHUB_TOKEN
@@ -242,7 +242,7 @@ jobs:
242242
job-unit-tests-coverage-report:
243243
working_directory: ~/repo
244244
docker:
245-
- image: synthetixio/docker-sec-tools:14.17-ubuntu
245+
- image: synthetixio/docker-sec-tools:14.18-ubuntu
246246
auth:
247247
username: $DOCKERHUB_USERNAME
248248
password: $DOCKERHUB_TOKEN
@@ -258,7 +258,7 @@ jobs:
258258
job-unit-tests-coverage:
259259
working_directory: ~/repo
260260
docker:
261-
- image: synthetixio/docker-node:14.17-ubuntu
261+
- image: synthetixio/docker-node:14.18-ubuntu
262262
auth:
263263
username: $DOCKERHUB_USERNAME
264264
password: $DOCKERHUB_TOKEN
@@ -288,7 +288,7 @@ jobs:
288288
job-unit-tests-gas-report:
289289
working_directory: ~/repo
290290
docker:
291-
- image: synthetixio/docker-node:14.17-ubuntu
291+
- image: synthetixio/docker-node:14.18-ubuntu
292292
auth:
293293
username: $DOCKERHUB_USERNAME
294294
password: $DOCKERHUB_TOKEN
@@ -309,7 +309,7 @@ jobs:
309309
job-unit-tests:
310310
working_directory: ~/repo
311311
docker:
312-
- image: synthetixio/docker-node:14.17-ubuntu
312+
- image: synthetixio/docker-node:14.18-ubuntu
313313
auth:
314314
username: $DOCKERHUB_USERNAME
315315
password: $DOCKERHUB_TOKEN
@@ -341,7 +341,7 @@ jobs:
341341
job-validate-deployments:
342342
working_directory: ~/repo
343343
docker:
344-
- image: synthetixio/docker-node:14.17-ubuntu
344+
- image: synthetixio/docker-node:14.18-ubuntu
345345
auth:
346346
username: $DOCKERHUB_USERNAME
347347
password: $DOCKERHUB_TOKEN
@@ -360,7 +360,7 @@ jobs:
360360
job-validate-etherscan:
361361
working_directory: ~/repo
362362
docker:
363-
- image: synthetixio/docker-node:14.17-ubuntu
363+
- image: synthetixio/docker-node:14.18-ubuntu
364364
auth:
365365
username: $DOCKERHUB_USERNAME
366366
password: $DOCKERHUB_TOKEN

.circleci/src/jobs/job-audit.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ steps:
55
- run:
66
name: Audit dependencies
77
command: |
8-
npm audit --audit-level=critical || true # Temporarily allow critical audits to pass
8+
npm audit --audit-level=critical
99
- run:
1010
name: Lint lockfile
1111
command: |
12-
lockfile-lint -p package-lock.json --type npm --allowed-hosts npm github.com --allowed-schemes "https:" "git+ssh:"
12+
lockfile-lint -p package-lock.json --type npm --allowed-hosts npm --validate-https --empty-hostname false
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
working_directory: ~/repo
22
docker:
3-
- image: synthetixio/docker-node:14.17-ubuntu
3+
- image: synthetixio/docker-node:14.18-ubuntu
44
auth:
55
username: $DOCKERHUB_USERNAME
66
password: $DOCKERHUB_TOKEN
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
working_directory: ~/repo
22
docker:
3-
- image: synthetixio/docker-sec-tools:14.17-ubuntu
3+
- image: synthetixio/docker-sec-tools:14.18-ubuntu
44
auth:
55
username: $DOCKERHUB_USERNAME
66
password: $DOCKERHUB_TOKEN

.github/workflows/codeql.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches: [master, develop]
6+
pull_request:
7+
branches: [master, develop]
8+
paths-ignore:
9+
- node_modules
10+
- "**/*.md"
11+
- "**/*.txt"
12+
schedule:
13+
- cron: "0 6 * * 3"
14+
15+
jobs:
16+
analyze:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # pin@v2
22+
23+
- name: Initialize CodeQL
24+
uses: github/codeql-action/init@7112cdaa06f3b661965fe3e2e93c9acaadbe85f3 # pin@codeql-bundle-20210921
25+
with:
26+
queries: security-and-quality
27+
languages: javascript
28+
29+
- name: Autobuild
30+
uses: github/codeql-action/autobuild@7112cdaa06f3b661965fe3e2e93c9acaadbe85f3 # pin@codeql-bundle-20210921
31+
32+
- name: Perform CodeQL Analysis
33+
uses: github/codeql-action/analyze@7112cdaa06f3b661965fe3e2e93c9acaadbe85f3 # pin@codeql-bundle-20210921
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# based on this thread https://github.com/crytic/slither/issues/948#issuecomment-925506993
2+
name: Slither
3+
4+
on:
5+
push:
6+
pull_request:
7+
branches: [master, develop]
8+
9+
jobs:
10+
slither:
11+
name: Slither Analysis
12+
# run only on master/develop branch and pull requests
13+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.event_name == 'pull_request'
14+
runs-on: ubuntu-latest
15+
16+
container:
17+
image: ghcr.io/synthetixio/docker-sec-tools/ubuntu:14.18
18+
credentials:
19+
username: synthetixio
20+
password: ${{ secrets.GH_PACKAGES_READ_ONLY }}
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # pin@v2
25+
26+
- name: Set npm cache directory
27+
run: npm config set cache .npm-cache --global
28+
continue-on-error: true
29+
30+
- uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # pin@v2
31+
with:
32+
path: |
33+
.npm-cache
34+
node_modules
35+
key: ${{ runner.os }}-ubuntu-${{ hashFiles('**/package-lock.json') }}
36+
restore-keys: |
37+
${{ runner.os }}-ubuntu-
38+
continue-on-error: true
39+
40+
- name: Install dependencies
41+
run: npm install --prefer-offline
42+
43+
- name: Run slither
44+
run: slither . --sarif slither.sarif || true
45+
46+
- name: Upload lint results
47+
if: always()
48+
uses: github/codeql-action/upload-sarif@7112cdaa06f3b661965fe3e2e93c9acaadbe85f3 # pin@codeql-bundle-20210921
49+
with:
50+
sarif_file: slither.sarif
51+
continue-on-error: true

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,6 @@ optimism
4545

4646
# python venv
4747
.venv/
48+
49+
# sarif files
50+
slither.sarif

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
save-exact=true
2+
ignore-scripts=true

codecov.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
codecov:
22
require_ci_to_pass: false
3+
bot: null

contracts/BaseDebtCache.sol

+20-5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ import "./interfaces/IERC20.sol";
1818
import "./interfaces/ICollateralManager.sol";
1919
import "./interfaces/IEtherWrapper.sol";
2020

21+
//
22+
// The debt cache (SIP-91) caches the global debt and the debt of each synth in the system.
23+
// Debt is denominated by the synth supply multiplied by its current exchange rate.
24+
//
25+
// The cache can be invalidated when an exchange rate changes, and thereafter must be
26+
// updated by performing a debt snapshot, which recomputes the global debt sum using
27+
// current synth supplies and exchange rates. This is performed usually by a snapshot keeper.
28+
//
29+
// Some synths are backed by non-SNX collateral, such as sETH being backed by ETH
30+
// held in the EtherWrapper (SIP-112). This debt is called "excluded debt" and is
31+
// excluded from the global debt in `_cachedDebt`.
32+
//
2133
// https://docs.synthetix.io/contracts/source/contracts/debtcache
2234
contract BaseDebtCache is Owned, MixinSystemSettings, IDebtCache {
2335
using SafeMath for uint;
@@ -113,6 +125,7 @@ contract BaseDebtCache is Owned, MixinSystemSettings, IDebtCache {
113125
return _cacheStale(_cacheTimestamp);
114126
}
115127

128+
// Returns the USD-denominated supply of each synth in `currencyKeys`, according to `rates`.
116129
function _issuedSynthValues(bytes32[] memory currencyKeys, uint[] memory rates)
117130
internal
118131
view
@@ -147,6 +160,7 @@ contract BaseDebtCache is Owned, MixinSystemSettings, IDebtCache {
147160
return (values, excludedDebt, isInvalid || isAnyNonSnxDebtRateInvalid);
148161
}
149162

163+
// Returns the USD-denominated supply of each synth in `currencyKeys`, using current exchange rates.
150164
function currentSynthDebts(bytes32[] calldata currencyKeys)
151165
external
152166
view
@@ -172,11 +186,6 @@ contract BaseDebtCache is Owned, MixinSystemSettings, IDebtCache {
172186
return _cachedSynthDebts(currencyKeys);
173187
}
174188

175-
// Returns the total sUSD debt backed by non-SNX collateral.
176-
function totalNonSnxBackedDebt() external view returns (uint excludedDebt, bool isInvalid) {
177-
return _totalNonSnxBackedDebt();
178-
}
179-
180189
function _totalNonSnxBackedDebt() internal view returns (uint excludedDebt, bool isInvalid) {
181190
// Calculate excluded debt.
182191
// 1. MultiCollateral long debt + short debt.
@@ -192,6 +201,11 @@ contract BaseDebtCache is Owned, MixinSystemSettings, IDebtCache {
192201
return (excludedDebt, isInvalid);
193202
}
194203

204+
// Returns the total sUSD debt backed by non-SNX collateral.
205+
function totalNonSnxBackedDebt() external view returns (uint excludedDebt, bool isInvalid) {
206+
return _totalNonSnxBackedDebt();
207+
}
208+
195209
function _currentDebt() internal view returns (uint debt, bool anyRateIsInvalid) {
196210
bytes32[] memory currencyKeys = issuer().availableCurrencyKeys();
197211
(uint[] memory rates, bool isInvalid) = exchangeRates().ratesAndInvalidForCurrencies(currencyKeys);
@@ -210,6 +224,7 @@ contract BaseDebtCache is Owned, MixinSystemSettings, IDebtCache {
210224
return (total, isInvalid || isAnyNonSnxDebtRateInvalid);
211225
}
212226

227+
// Returns the current debt of the system, excluding non-SNX backed debt (eg. EtherWrapper).
213228
function currentDebt() external view returns (uint debt, bool anyRateIsInvalid) {
214229
return _currentDebt();
215230
}

0 commit comments

Comments
 (0)