Skip to content

Commit

Permalink
A smattering of commits to get the build / deploy flow working again (#…
Browse files Browse the repository at this point in the history
…1323)

* Reconfigure cloudflare worker

* Fix code coverage api

* Fix graphviz rendering issues

* Update mermaid / puppeteer build process

* fix: disable MinerConstructorParams

* Commenting it out still generates the error

* Ignore errors due to lack of rusl-fil-proofs cov

* Remove hint with a broken link

* Revert to CommonJS

* Update jsdom version to avoid build error

* Disable minification

The build breaks when minified, but works fine without it.

This shoud be re-enabled later, nut for now I just want to get this site
building again.

* Add .nvmrc

* Remove puppeteer config

* Check generated mermaid files into src

These files are very hard to generate via CI because they require
puppeteer, but easy to generate locally. Eventually this should be
re-enabled in CI

* Modify build image to be node:20.2

* Update .fleek.json

* Update .nvmrc

* revert node image, git bin required at ci

---------

Co-authored-by: Chris Waring <106938+cwaring@users.noreply.github.com>
  • Loading branch information
ianconsolata and cwaring authored Jul 13, 2023
1 parent e5d44e1 commit cb00465
Show file tree
Hide file tree
Showing 40 changed files with 3,661 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .fleek.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"build": {
"image": "hugomrdias/puppeteer",
"image": "node:20.2",
"command": "npm install && npm run build",
"publicDir": "public"
}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ yarn.lock
package-lock.json
node_modules
resources
static/_gen
data/toc.json
api/dist
api/worker
.hugo_build.lock
assets/jsconfig.json
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.2.0
42 changes: 31 additions & 11 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,41 @@ async function handleRequest(event) {
async function cov(event) {
const url = new URL(event.request.url)
// https://github.com/filecoin-project/lotus
const repo = url.searchParams.get('repo').split('/').slice(3).join('/')
const data = await get(event, {
url: `https://codecov.io/api/gh/${repo}`,
const [owner, repo] = url.searchParams.get('repo').split('/').slice(3)
const headers = {
'User-Agent': 'ianconsolata',
Accept: 'application/json',
Authorization: `Bearer ${CODECOV_TOKEN}`,
}
const repo_resp = await get(event, {
url: `https://api.codecov.io/api/v2/github/${owner}/repos/${repo}/`,
transform: (data) => {
const out = {
cov: dlv(data, 'commit.totals.c', 0),
ci: dlv(data, 'commit.ci_passed', false),
repo: dlv(data, 'repo.name', 'N/A'),
org: dlv(data, 'owner.username', 'N/A'),
lang: dlv(data, 'repo.language', 'N/A'),
branch: dlv(data, 'branch', 'master'),
lang: dlv(data, 'language', 'N/A'),
}
return out
},
headers,
})
return data
const repo_data = await repo_resp.json()

const cov_data = await get(event, {
url: `https://api.codecov.io/api/v2/github/${owner}/repos/${repo}/branches/${repo_data.branch}/`,
transform: (data) => {
const out = {
cov: dlv(data, 'head_commit.totals.coverage', 0),
ci: dlv(data, 'head_commit.ci_passed', false),
repo: repo,
org: owner,
lang: repo_data.lang,
branch: repo_data.branch,
}
return out
},
headers,
})
return cov_data
}

async function github(event) {
Expand All @@ -56,7 +76,7 @@ async function github(event) {
const path = file.slice(7).join('/')
const ref = file[6]
const headers = {
'User-Agent': 'hugomrdias',
'User-Agent': 'ianconsolata',
Authorization: `token ${GITHUB_TOKEN}`,
}

Expand All @@ -82,7 +102,7 @@ async function github(event) {

async function releases(event) {
const headers = {
'User-Agent': 'hugomrdias',
'User-Agent': 'ianconsolata',
Authorization: `token ${GITHUB_TOKEN}`,
}
const rsp = await get(event, {
Expand Down
3 changes: 2 additions & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dlv": "^1.1.3",
"merge-options": "^3.0.3",
"nanoid": "^3.1.16",
"p-map": "^4.0.0"
"p-map": "^4.0.0",
"wrangler": "^2.17.0"
}
}
8 changes: 3 additions & 5 deletions api/wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name = "specs-api"
type = "webpack"
account_id = "fffa4b4363a7e5250af8357087263b3a"
account_id = "e85b6fdda17f8c464c343dc84d1373e8"
workers_dev = true
route = ""
zone_id = ""
webpack_config = "webpack.config.js"
main = "index.js"
compatibility_date = "2023-04-27"
6 changes: 5 additions & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ canonifyurls = false
theme = "book"
# relativeURLs = true

# allow building even if getting remote JSON fails
# needed because rust-fil-proofs has no coverage
ignoreErrors = ["error-remote-getjson"]

# Book configuration
disablePathToLower = true
enableGitInfo = true
Expand Down Expand Up @@ -41,7 +45,7 @@ enableGitInfo = true
# weight = 10

[params]
API = 'https://specs-api.protocol-labs.workers.dev'
API = 'https://specs-api.filecoin-foundation.workers.dev'
# (Optional, default true) Controls table of contents visibility on right side of pages.
# Start and end levels can be controlled with markup.tableOfContents setting.
# You can also specify this parameter per page in front matter.
Expand Down
4 changes: 0 additions & 4 deletions content/algorithms/expected_consensus/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,6 @@ The exact value for these parameters remain to be determined, but for testing pu
- `wFunction = log2b` with
- `log2b(X) = floor(log2(x)) = (binary length of X) - 1` and `log2b(0) = 0`. Note that that special case should never be used (given it would mean an empty power table).

{{< hint warning >}}
**Note that if your implementation does not allow for rounding to the fourth decimal**, miners should apply the [tie-breaker below](selecting-between-tipsets-with-equal-weight). Weight changes will be on the order of single digit numbers on expectation, so this should not have an outsized impact on chain consensus across implementations.
{{< /hint >}}

`ParentWeight` is the aggregate chain weight of a given block's parent set. It is calculated as
the `ParentWeight` of any of its parent blocks (all blocks in a given Tipset should have
the same `ParentWeight` value) plus the delta weight of each parent. To make the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ dashboardTests: 0

{{<embed src="https://github.com/filecoin-project/specs-actors/blob/master/actors/builtin/power/power_actor.go" lang="go" symbol="Exports">}}

{{<embed src="https://github.com/filecoin-project/specs-actors/blob/master/actors/builtin/power/power_actor.go" lang="go" symbol="MinerConstructorParams">}}

## The Power Table

The portion of blocks a given miner generates through leader election in EC (and so the block rewards they earn) is proportional to their `Quality-Adjusted Power Fraction` over time. That is, a miner whose quality adjusted power represents 1% of total quality adjusted power on the network should mine 1% of blocks on expectation.
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"serve": "npm start",
"watch-hugo": "npm run build-diagrams && hugo server --bind=0.0.0.0 --disableFastRender --renderToDisk",
"watch-assets": "tools/watch.js --watch",
"build": "npm run build-diagrams && hugo && npm run build-toc && hugo --gc --minify",
"build": "hugo && npm run build-toc && hugo --gc",
"build-diagrams": "tools/diagrams.js",
"build-toc": "tools/toc.js",
"clean": "premove public resources static/_gen",
Expand All @@ -27,16 +27,16 @@
"tablesort": "^5.2.1"
},
"devDependencies": {
"@mermaid-js/mermaid-cli": "^8.8.1",
"@mermaid-js/mermaid-cli": "^10.2.2",
"chokidar": "^3.4.3",
"concurrently": "^5.3.0",
"conventional-github-releaser": "^3.1.5",
"execa": "^4.0.3",
"globby": "^11.0.1",
"graphviz-cli": "^1.0.0",
"hugo-extended": "^0.76.5",
"graphviz-cli": "^2.0.0",
"hugo-extended": "^0.113.0",
"husky": ">=4",
"jsdom": "^16.4.0",
"jsdom": "^22.1.0",
"lint-staged": ">=10",
"np": "^6.5.0",
"premove": "^3.0.1",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit cb00465

Please sign in to comment.