Skip to content

Commit

Permalink
Merge remote-tracking branch 'home/main' into rebrand
Browse files Browse the repository at this point in the history
  • Loading branch information
mitschabaude committed Sep 5, 2023
2 parents fec4d35 + 8cb0cf8 commit fe55c0e
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 106 deletions.
30 changes: 21 additions & 9 deletions .github/actions/live-tests-shared/action.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
name: 'Shared steps for live testing jobs'
description: 'Shared steps for live testing jobs'
inputs:
mina-branch-name:
description: 'Mina branch name in use by service container'
required: true
runs:
using: 'composite'
steps:
- name: Wait for Mina network readiness
uses: o1-labs/wait-for-mina-network-action@v1
with:
mina-graphql-port: 8080
max-attempts: 60
polling-interval-ms: 10000
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Make helper script executable
run: chmod +x tests/scripts/wait-for-docker-services.sh
shell: bash
- name: Wait for Docker container services to be ready
run: ./tests/scripts/wait-for-docker-services.sh 8080
shell: bash
- name: Build o1js and Execute Tests
node-version: '20'
- name: Build o1js and execute tests
env:
TEST_TYPE: 'Live integration tests'
USE_LOCAL_NETWORK: 'true'
continue-on-error: false
run: |
git submodule update --init --recursive
npm ci
Expand All @@ -26,3 +29,12 @@ runs:
sh run-ci-tests.sh
cat profiling.md >> $GITHUB_STEP_SUMMARY
shell: bash
- name: Upload Mina logs
uses: actions/upload-artifact@v3
continue-on-error: true
if: always()
with:
if-no-files-found: ignore
name: mina-logs-${{ inputs.mina-branch-name }}
path: /tmp/*.log
retention-days: 5
22 changes: 12 additions & 10 deletions .github/workflows/build-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ jobs:
'CommonJS test',
]
steps:
- name: Checkout Repository
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Build o1js and Execute Tests
- name: Build o1js and execute tests
env:
TEST_TYPE: ${{ matrix.test_type }}
continue-on-error: false
Expand All @@ -48,28 +48,30 @@ jobs:
timeout-minutes: 90
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Node Dependencies
- name: Install Node dependencies
run: |
git submodule update --init --recursive
npm ci
- name: Install Playwright Browsers
- name: Install Playwright browsers
run: npm run e2e:install
- name: Build o1js and Prepare the Web Server
- name: Build o1js and prepare the web server
run: |
npm run build:web
npm run e2e:prepare-server
- name: Execute E2E Tests
- name: Execute E2E tests
run: npm run test:e2e
- name: Upload E2E Test Artifacts
- name: Upload E2E test artifacts
uses: actions/upload-artifact@v3
continue-on-error: true
if: always()
with:
if-no-files-found: ignore
name: e2e-tests-report
path: tests/report/
retention-days: 30
Expand All @@ -79,7 +81,7 @@ jobs:
runs-on: ubuntu-latest
needs: [Build-And-Test-Server, Build-And-Test-Web]
steps:
- name: Checkout Repository
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
Expand All @@ -103,7 +105,7 @@ jobs:
runs-on: ubuntu-latest
needs: [Build-And-Test-Server, Build-And-Test-Web]
steps:
- name: Checkout Repository
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ jobs:
Build-Doc:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup node
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16'

- name: run typedoc
- name: Run typedoc
run: |
git submodule update --init --recursive
npm ci
npx typedoc --tsconfig tsconfig.node.json src/index.ts
- name: deploy
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
33 changes: 18 additions & 15 deletions .github/workflows/live-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ jobs:
PROOF_LEVEL: 'none'
ports:
- 3085:3085
- 5432:5432
- 8080:8080
- 8181:8181
# TODO: Disable logging for container as the workaround of long post-job-cleanup phase
# - Will be fixed by improving logging as part of the work on:
# - https://hub.docker.com/r/o1labs/mina-local-network
options: --log-driver=none
volumes:
- /tmp:/root/logs
steps:
- name: Checkout Repository
- name: Checkout repository
uses: actions/checkout@v3
- name: Use shared steps for live testing jobs
uses: ./.github/actions/live-tests-shared
with:
mina-branch-name: rampup

berkeley-branch:
timeout-minutes: 25
Expand All @@ -49,17 +50,18 @@ jobs:
PROOF_LEVEL: 'none'
ports:
- 3085:3085
- 5432:5432
- 8080:8080
- 8181:8181
# TODO: Disable logging for container as the workaround of long post-job-cleanup phase
# - Will be fixed by improving logging as part of the work on:
# - https://hub.docker.com/r/o1labs/mina-local-network
options: --log-driver=none
volumes:
- /tmp:/root/logs
steps:
- name: Checkout Repository
- name: Checkout repository
uses: actions/checkout@v3
- name: Use shared steps for live testing jobs
uses: ./.github/actions/live-tests-shared
with:
mina-branch-name: berkeley

develop-branch:
timeout-minutes: 25
Expand All @@ -73,14 +75,15 @@ jobs:
PROOF_LEVEL: 'none'
ports:
- 3085:3085
- 5432:5432
- 8080:8080
- 8181:8181
# TODO: Disable logging for container as the workaround of long post-job-cleanup phase
# - Will be fixed by improving logging as part of the work on:
# - https://hub.docker.com/r/o1labs/mina-local-network
options: --log-driver=none
volumes:
- /tmp:/root/logs
steps:
- name: Checkout Repository
- name: Checkout repository
uses: actions/checkout@v3
- name: Use shared steps for live testing jobs
uses: ./.github/actions/live-tests-shared
with:
mina-branch-name: develop
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@
"serve:web": "cp src/bindings/compiled/web_bindings/server.js src/bindings/compiled/web_bindings/index.html src/examples/simple_zkapp.js dist/web && node dist/web/server.js",
"prepublish:web": "NODE_ENV=production node src/build/buildWeb.js",
"prepublish:node": "npm run build && NODE_ENV=production node src/build/buildNode.js",
"prepublish:both": "npm run prepublish:web && npm run prepublish:node",
"prepublishOnly": "npm run prepublish:web && npm run prepublish:node",
"bootstrap": "npm run build && node src/build/extractJsooMethods.cjs && npm run build",
"dump-vks": "./run src/examples/vk_regression.ts --bundle --dump ./src/examples/regression_test.json",
"format": "prettier --write --ignore-unknown **/*",
"test": "./run-jest-tests.sh",
"clean": "rimraf ./dist && rimraf ./src/bindings/compiled/_node_bindings",
Expand Down
2 changes: 1 addition & 1 deletion src/bindings
5 changes: 5 additions & 0 deletions src/examples/benchmarks/import.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
let start = performance.now();
await import('../../snarky.js');
let time = performance.now() - start;

console.log(`import jsoo: ${time.toFixed(0)}ms`);
5 changes: 5 additions & 0 deletions src/examples/benchmarks/import.web.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
let start = performance.now();
await import('snarkyjs');
let time = performance.now() - start;

console.log(`import jsoo: ${time.toFixed(0)}ms`);
10 changes: 5 additions & 5 deletions src/examples/zkapps/hello_world/run_live.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ Mina.setActiveInstance(network);

// Fee payer setup
if (!useLocalNetwork) {
console.log(`Funding the Fee payer account.`);
console.log(`Funding the fee payer account.`);
await Mina.faucet(sender);
}
console.log(`Fetching the Fee payer account information.`);
console.log(`Fetching the fee payer account information.`);
const accountDetails = (await fetchAccount({ publicKey: sender })).account;
console.log(
`Using the Fee payer account ${sender.toBase58()} with nonce: ${
`Using the fee payer account ${sender.toBase58()} with nonce: ${
accountDetails?.nonce
} and balance: ${accountDetails?.balance}.`
);
Expand Down Expand Up @@ -59,7 +59,7 @@ Your smart contract will be deployed
as soon as the transaction is included in a block.
Txn hash: ${pendingTx.hash()}`);
}
console.log('Waiting for transaction to be mined.');
console.log('Waiting for transaction inclusion in a block.');
await pendingTx.wait({ maxAttempts: 90 });
console.log('');

Expand All @@ -77,7 +77,7 @@ Your smart contract state will be updated
as soon as the transaction is included in a block.
Txn hash: ${pendingTx.hash()}`);
}
console.log('Waiting for transaction to be mined.');
console.log('Waiting for transaction inclusion in a block.');
await pendingTx.wait({ maxAttempts: 90 });
console.log('');

Expand Down
12 changes: 12 additions & 0 deletions src/lib/mina.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,20 @@ function LocalBlockchain({
Ml.fromPublicKey(update.body.publicKey),
Ml.constFromField(update.body.tokenId)
);

let authIsProof = !!update.authorization.proof;
let kindIsProof = update.body.authorizationKind.isProved.toBoolean();
// checks and edge case where a proof is expected, but the developer forgot to invoke await tx.prove()
// this resulted in an assertion OCaml error, which didn't contain any useful information
if (kindIsProof && !authIsProof) {
throw Error(
`The actual authorization does not match the expected authorization kind. Did you forget to invoke \`await tx.prove();\`?`
);
}

if (accountJson) {
let account = Account.fromJSON(accountJson);

await verifyAccountUpdate(
account,
update,
Expand Down
1 change: 1 addition & 0 deletions src/snarky.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './bindings/crypto/bindings.js';
import { getSnarky, withThreadPool } from './bindings/js/wrapper.js';
import snarkySpec from './bindings/js/snarky-class-spec.js';
import { proxyClasses } from './bindings/js/proxy.js';
Expand Down
60 changes: 0 additions & 60 deletions tests/scripts/wait-for-docker-services.sh

This file was deleted.

1 change: 1 addition & 0 deletions tsconfig.mina-signer-web.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "./tsconfig.mina-signer.json",
"include": ["./src/mina-signer/MinaSigner.ts", "./src/**/*.web.ts"],
"exclude": ["./src/examples"],
"compilerOptions": {
"outDir": "src/mina-signer/dist/tmp"
}
Expand Down

0 comments on commit fe55c0e

Please sign in to comment.