Skip to content

Commit

Permalink
Merge pull request #1431 from o1-labs/refactor/file-names
Browse files Browse the repository at this point in the history
Rename files to follow convention
  • Loading branch information
mitschabaude authored Feb 13, 2024
2 parents 723f776 + a1dda36 commit 6b28285
Show file tree
Hide file tree
Showing 146 changed files with 174 additions and 175 deletions.
2 changes: 1 addition & 1 deletion README-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ See the [Docker Hub repository](https://hub.docker.com/r/o1labs/mina-local-netwo

Next up, get the Mina blockchain accounts information to be used in your zkApp.
After the local network is up and running, you can use the [Lightnet](https://github.com/o1-labs/o1js/blob/ec789794b2067addef6b6f9c9a91c6511e07e37c/src/lib/fetch.ts#L1012) `o1js API namespace` to get the accounts information.
See the corresponding example in [src/examples/zkapps/hello_world/run_live.ts](https://github.com/o1-labs/o1js/blob/ec789794b2067addef6b6f9c9a91c6511e07e37c/src/examples/zkapps/hello_world/run_live.ts).
See the corresponding example in [src/examples/zkapps/hello-world/run-live.ts](https://github.com/o1-labs/o1js/blob/ec789794b2067addef6b6f9c9a91c6511e07e37c/src/examples/zkapps/hello-world/run-live.ts).

### Profiling o1js

Expand Down
2 changes: 1 addition & 1 deletion generate-keys.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
import Client from './dist/node/mina-signer/MinaSigner.js';
import Client from './dist/node/mina-signer/mina-signer.js';

let client = new Client({ network: 'testnet' });

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
},
"scripts": {
"dev": "npx tsc -p tsconfig.test.json && node src/build/copy-to-dist.js",
"build": "node src/build/copy-artifacts.js && rimraf ./dist/node && npm run dev && node src/build/buildNode.js",
"build": "node src/build/copy-artifacts.js && rimraf ./dist/node && npm run dev && node src/build/build-node.js",
"build:bindings": "./src/bindings/scripts/build-o1js-node.sh",
"build:update-bindings": "./src/bindings/scripts/update-o1js-bindings.sh",
"build:wasm": "./src/bindings/scripts/update-wasm-and-types.sh",
"build:web": "rimraf ./dist/web && node src/build/buildWeb.js",
"build:web": "rimraf ./dist/web && node src/build/build-web.js",
"build:examples": "npm run build && rimraf ./dist/examples && npx tsc -p tsconfig.examples.json",
"build:docs": "npx typedoc --tsconfig ./tsconfig.web.json",
"prepublish:web": "NODE_ENV=production node src/build/buildWeb.js",
"prepublish:node": "node src/build/copy-artifacts.js && rimraf ./dist/node && npx tsc -p tsconfig.node.json && node src/build/copy-to-dist.js && NODE_ENV=production node src/build/buildNode.js",
"prepublish:web": "NODE_ENV=production node src/build/build-web.js",
"prepublish:node": "node src/build/copy-artifacts.js && rimraf ./dist/node && npx tsc -p tsconfig.node.json && node src/build/copy-to-dist.js && NODE_ENV=production node src/build/build-node.js",
"prepublishOnly": "npm run prepublish:web && npm run prepublish:node",
"dump-vks": "./run tests/vk-regression/vk-regression.ts --bundle --dump",
"format": "prettier --write --ignore-unknown **/*",
Expand All @@ -61,7 +61,7 @@
"test:integration": "./run-integration-tests.sh",
"test:unit": "./run-unit-tests.sh",
"test:e2e": "rimraf ./tests/report && rimraf ./tests/test-artifacts && npx playwright test",
"e2e:prepare-server": "npm run build:examples && (cp -rf dist/examples dist/web || :) && node src/build/e2eTestsBuildHelper.js && cp -rf src/examples/plain-html/index.html src/examples/plain-html/server.js tests/artifacts/html/*.html tests/artifacts/javascript/*.js dist/web",
"e2e:prepare-server": "npm run build:examples && (cp -rf dist/examples dist/web || :) && node src/build/e2e-tests-build-helper.js && cp -rf src/examples/plain-html/index.html src/examples/plain-html/server.js tests/artifacts/html/*.html tests/artifacts/javascript/*.js dist/web",
"e2e:run-server": "node dist/web/server.js",
"e2e:install": "npx playwright install --with-deps",
"e2e:show-report": "npx playwright show-report tests/report",
Expand Down
6 changes: 3 additions & 3 deletions run-ci-live-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ echo ""
echo "Running integration tests against the real Mina network."
echo ""

./run src/examples/zkapps/hello_world/run_live.ts --bundle | add_prefix "HELLO_WORLD" &
./run src/examples/zkapps/hello-world/run-live.ts --bundle | add_prefix "HELLO_WORLD" &
HELLO_WORLD_PROC=$!
./run src/examples/zkapps/dex/run_live.ts --bundle | add_prefix "DEX" &
./run src/examples/zkapps/dex/run-live.ts --bundle | add_prefix "DEX" &
DEX_PROC=$!
./run src/examples/fetch_live.ts --bundle | add_prefix "FETCH" &
./run src/examples/fetch-live.ts --bundle | add_prefix "FETCH" &
FETCH_PROC=$!

# Wait for each process and capture their exit statuses
Expand Down
6 changes: 3 additions & 3 deletions run-ci-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ set -e
case $TEST_TYPE in
"Simple integration tests")
echo "Running basic integration tests"
./run src/examples/zkapps/hello_world/run.ts --bundle
./run src/examples/simple_zkapp.ts --bundle
./run src/examples/zkapps/reducer/reducer_composite.ts --bundle
./run src/examples/zkapps/hello-world/run.ts --bundle
./run src/examples/simple-zkapp.ts --bundle
./run src/examples/zkapps/reducer/reducer-composite.ts --bundle
./run src/examples/zkapps/composability.ts --bundle
./run src/tests/fake-proof.ts
;;
Expand Down
2 changes: 1 addition & 1 deletion run-in-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fs from 'node:fs/promises';
import path from 'node:path';
import http from 'node:http';
import minimist from 'minimist';
import { build } from './src/build/buildExample.js';
import { build } from './src/build/build-example.js';

let {
_: [filePath],
Expand Down
6 changes: 3 additions & 3 deletions run-integration-tests.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
set -e

./run src/examples/zkapps/hello_world/run.ts --bundle
./run src/examples/zkapps/hello-world/run.ts --bundle
./run src/examples/zkapps/voting/run.ts --bundle
./run src/examples/simple_zkapp.ts --bundle
./run src/examples/zkapps/reducer/reducer_composite.ts --bundle
./run src/examples/simple-zkapp.ts --bundle
./run src/examples/zkapps/reducer/reducer-composite.ts --bundle
./run src/examples/zkapps/composability.ts --bundle
./run src/examples/zkapps/dex/run.ts --bundle
./run src/examples/zkapps/dex/happy-path-with-actions.ts --bundle
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let selfPath = fileURLToPath(import.meta.url);
let jsonPath = path.resolve(selfPath, '../../bindings/ocaml/jsLayout.json');
let jsLayout = JSON.parse(await fs.readFile(jsonPath, 'utf8'));

console.log(`jsLayoutToTypes.mjs: generating TS types from ${jsonPath}`);
console.log(`js-layout-to-types.mjs: generating TS types from ${jsonPath}`);

let builtinLeafTypes = new Set([
'number',
Expand Down
2 changes: 1 addition & 1 deletion src/build/run.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
import minimist from 'minimist';
import { buildAndImport, buildOne } from './buildExample.js';
import { buildAndImport, buildOne } from './build-example.js';

let {
_: [filePath],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/examples/plain-html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<script type="importmap">
{ "imports": { "o1js": "./index.js" } }
</script>
<script type="module" src="./simple_zkapp.js">
<script type="module" src="./simple-zkapp.js">
</script>
</head>
<body>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
PrivateKey,
fetchAccount,
} from 'o1js';
import { HelloWorld, adminPrivateKey } from './hello_world.js';
import { HelloWorld, adminPrivateKey } from './hello-world.js';

const useCustomLocalNetwork = process.env.USE_CUSTOM_LOCAL_NETWORK === 'true';
const zkAppKey = PrivateKey.random();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AccountUpdate, Field, Mina, PrivateKey } from 'o1js';
import { getProfiler } from '../../utils/profiler.js';
import { HelloWorld, adminPrivateKey } from './hello_world.js';
import { HelloWorld, adminPrivateKey } from './hello-world.js';

const HelloWorldProfier = getProfiler('Hello World');
HelloWorldProfier.start('Hello World test flow');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/examples/zkapps/voting/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from 'o1js';
import { VotingApp, VotingAppParams } from './factory.js';
import { Member, MyMerkleWitness } from './member.js';
import { OffchainStorage } from './off_chain_storage.js';
import { OffchainStorage } from './off-chain-storage.js';
import {
ParticipantPreconditions,
ElectionPreconditions,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import {
} from 'o1js';
import { VotingApp, VotingAppParams } from './factory.js';
import { Member, MyMerkleWitness } from './member.js';
import { OffchainStorage } from './off_chain_storage.js';
import { OffchainStorage } from './off-chain-storage.js';
import {
ParticipantPreconditions,
ElectionPreconditions,
} from './preconditions.js';
import { getResults, vote } from './voting_lib.js';
import { getResults, vote } from './voting-lib.js';
await isReady;

const Berkeley = Mina.Network({
Expand Down
2 changes: 1 addition & 1 deletion src/examples/zkapps/voting/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ParticipantPreconditions,
} from './preconditions.js';

import { OffchainStorage } from './off_chain_storage.js';
import { OffchainStorage } from './off-chain-storage.js';
import { Member } from './member.js';
import { testSet } from './test.js';
import { getProfiler } from '../../utils/profiler.js';
Expand Down
8 changes: 4 additions & 4 deletions src/examples/zkapps/voting/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ import {
UInt32,
Permissions,
} from 'o1js';
import { deployContracts, deployInvalidContracts } from './deployContracts.js';
import { DummyContract } from './dummyContract.js';
import { deployContracts, deployInvalidContracts } from './deploy-contracts.js';
import { DummyContract } from './dummy-contract.js';
import { VotingAppParams } from './factory.js';
import { Member, MyMerkleWitness } from './member.js';
import { Membership_ } from './membership.js';
import { OffchainStorage } from './off_chain_storage.js';
import { OffchainStorage } from './off-chain-storage.js';
import { Voting_ } from './voting.js';
import {
assertValidTx,
getResults,
registerMember,
vote,
} from './voting_lib.js';
} from './voting-lib.js';

type Votes = OffchainStorage<Member>;
type Candidates = OffchainStorage<Member>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Member, MyMerkleWitness } from './member.js';
import { OffchainStorage } from './off_chain_storage.js';
import { OffchainStorage } from './off-chain-storage.js';
import { Voting_ } from './voting.js';
import { Mina, PrivateKey } from 'o1js';
import { Printer } from 'prettier';
Expand Down
16 changes: 8 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export type {
FlexibleProvable,
FlexibleProvablePure,
InferProvable,
} from './lib/circuit_value.js';
} from './lib/circuit-value.js';
export {
CircuitValue,
prop,
Expand All @@ -31,7 +31,7 @@ export {
provablePure,
Struct,
Unconstrained,
} from './lib/circuit_value.js';
} from './lib/circuit-value.js';
export { Provable } from './lib/provable.js';
export { Circuit, Keypair, public_, circuitMain } from './lib/circuit.js';
export { UInt32, UInt64, Int64, Sign, UInt8 } from './lib/int.js';
Expand All @@ -56,7 +56,7 @@ export {
} from './lib/zkapp.js';
export { state, State, declareState } from './lib/state.js';

export type { JsonProof } from './lib/proof_system.js';
export type { JsonProof } from './lib/proof-system.js';
export {
Proof,
SelfProof,
Expand All @@ -65,7 +65,7 @@ export {
Undefined,
Void,
VerificationKey,
} from './lib/proof_system.js';
} from './lib/proof-system.js';
export { Cache, CacheHeader } from './lib/proof-system/cache.js';

export {
Expand All @@ -77,7 +77,7 @@ export {
TransactionVersion,
AccountUpdateForest,
AccountUpdateTree,
} from './lib/account_update.js';
} from './lib/account-update.js';

export { TokenAccountUpdateIterator } from './lib/mina/token/forest-iterator.js';
export { TokenContract } from './lib/mina/token/token-contract.js';
Expand All @@ -99,12 +99,12 @@ export {
export * as Encryption from './lib/encryption.js';
export * as Encoding from './bindings/lib/encoding.js';
export { Character, CircuitString } from './lib/string.js';
export { MerkleTree, MerkleWitness } from './lib/merkle_tree.js';
export { MerkleMap, MerkleMapWitness } from './lib/merkle_map.js';
export { MerkleTree, MerkleWitness } from './lib/merkle-tree.js';
export { MerkleMap, MerkleMapWitness } from './lib/merkle-map.js';

export { Nullifier } from './lib/nullifier.js';

import { ExperimentalZkProgram, ZkProgram } from './lib/proof_system.js';
import { ExperimentalZkProgram, ZkProgram } from './lib/proof-system.js';
export { ZkProgram };

export { Crypto } from './lib/crypto.js';
Expand Down
4 changes: 2 additions & 2 deletions src/lib/account_update.ts → src/lib/account-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
provable,
provablePure,
StructNoJson,
} from './circuit_value.js';
} from './circuit-value.js';
import { memoizationContext, memoizeWitness, Provable } from './provable.js';
import { Field, Bool } from './core.js';
import { Pickles, Test } from '../snarky.js';
Expand All @@ -27,7 +27,7 @@ import {
ClosedInterval,
getAccountPreconditions,
} from './precondition.js';
import { dummyBase64Proof, Empty, Proof, Prover } from './proof_system.js';
import { dummyBase64Proof, Empty, Proof, Prover } from './proof-system.js';
import { Memo } from '../mina-signer/src/memo.js';
import {
Events,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/lib/caller.unit-test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AccountUpdate, TokenId } from './account_update.js';
import { AccountUpdate, TokenId } from './account-update.js';
import * as Mina from './mina.js';
import { expect } from 'expect';

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/lib/circuit_value.ts → src/lib/circuit-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type {
import { Provable } from './provable.js';
import { assert } from './errors.js';
import { inCheckedComputation } from './provable-context.js';
import { Proof } from './proof_system.js';
import { Proof } from './proof-system.js';

// external API
export {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { provable, Struct, Unconstrained } from './circuit_value.js';
import { provable, Struct, Unconstrained } from './circuit-value.js';
import { UInt32 } from './int.js';
import { PrivateKey, PublicKey } from './signature.js';
import { expect } from 'expect';
import { method, SmartContract } from './zkapp.js';
import { LocalBlockchain, setActiveInstance, transaction } from './mina.js';
import { State, state } from './state.js';
import { AccountUpdate } from './account_update.js';
import { AccountUpdate } from './account-update.js';
import { Provable } from './provable.js';
import { Field } from './core.js';

Expand Down
2 changes: 1 addition & 1 deletion src/lib/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CurveParams as CurveParams_ } from '../bindings/crypto/elliptic-curve-e
import {
CurveAffine,
createCurveAffine,
} from '../bindings/crypto/elliptic_curve.js';
} from '../bindings/crypto/elliptic-curve.js';

// crypto namespace
const Crypto = {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'isomorphic-fetch';
import { Field } from './core.js';
import { UInt32, UInt64 } from './int.js';
import { Actions, TokenId } from './account_update.js';
import { Actions, TokenId } from './account-update.js';
import { PublicKey, PrivateKey } from './signature.js';
import { NetworkValue } from './precondition.js';
import { Types } from '../bindings/mina-transaction/types.js';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/field.unit-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { test, Random } from './testing/property.js';
import { deepEqual, throws } from 'node:assert/strict';
import { Provable } from './provable.js';
import { Binable } from '../bindings/lib/binable.js';
import { ProvableExtended } from './circuit_value.js';
import { ProvableExtended } from './circuit-value.js';
import { FieldType } from './field.js';
import {
equivalentProvable as equivalent,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/foreign-curve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import {
CurveParams,
CurveAffine,
createCurveAffine,
} from '../bindings/crypto/elliptic_curve.js';
} from '../bindings/crypto/elliptic-curve.js';
import type { Group } from './group.js';
import { ProvablePureExtended } from './circuit_value.js';
import { ProvablePureExtended } from './circuit-value.js';
import { AlmostForeignField, createForeignField } from './foreign-field.js';
import { EllipticCurve, Point } from './gadgets/elliptic-curve.js';
import { Field3 } from './gadgets/foreign-field.js';
Expand Down
4 changes: 2 additions & 2 deletions src/lib/foreign-curve.unit-test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createForeignCurve } from './foreign-curve.js';
import { Fq } from '../bindings/crypto/finite_field.js';
import { Vesta as V } from '../bindings/crypto/elliptic_curve.js';
import { Fq } from '../bindings/crypto/finite-field.js';
import { Vesta as V } from '../bindings/crypto/elliptic-curve.js';
import { Provable } from './provable.js';
import { Field } from './field.js';
import { Crypto } from './crypto.js';
Expand Down
4 changes: 2 additions & 2 deletions src/lib/foreign-ecdsa.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { provableFromClass } from '../bindings/lib/provable-snarky.js';
import { CurveParams } from '../bindings/crypto/elliptic_curve.js';
import { ProvablePureExtended } from './circuit_value.js';
import { CurveParams } from '../bindings/crypto/elliptic-curve.js';
import { ProvablePureExtended } from './circuit-value.js';
import {
FlexiblePoint,
ForeignCurve,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/foreign-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
Fp,
FiniteField,
createField,
} from '../bindings/crypto/finite_field.js';
} from '../bindings/crypto/finite-field.js';
import { Field, FieldVar, checkBitLength, withMessage } from './field.js';
import { Provable } from './provable.js';
import { Bool } from './bool.js';
Expand All @@ -13,7 +13,7 @@ import { Gadgets } from './gadgets/gadgets.js';
import { ForeignField as FF } from './gadgets/foreign-field.js';
import { assert } from './gadgets/common.js';
import { l3, l } from './gadgets/range-check.js';
import { ProvablePureExtended } from './circuit_value.js';
import { ProvablePureExtended } from './circuit-value.js';

// external API
export { createForeignField };
Expand Down
2 changes: 1 addition & 1 deletion src/lib/gadgets/arithmetic.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Bool } from '../bool.js';
import { provableTuple } from '../circuit_value.js';
import { provableTuple } from '../circuit-value.js';
import { Field } from '../core.js';
import { assert } from '../errors.js';
import { Provable } from '../provable.js';
Expand Down
Loading

0 comments on commit 6b28285

Please sign in to comment.