0.0.0 • Published 3 months ago

@hyperoracle/cle-cli-test v0.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 months ago

CLE CLI

CLI

Note: Only full image will be processed by zkOracle node. local (generated by commands ending with --local option) means the CLE is compiled locally and only contains partial computation (so that proving and executing will be faster).

The workflow of local CLE development must follow: Develop (code in /src) -> Compile (get compiled wasm image) -> Execute (get expected output) -> Prove (generate input and pre-test for actual proving in zkOracle) -> Verify (verify proof on-chain).

To upload and publish your CLE, you should Upload (upload code to IPFS), and then Publish (register CLE on onchain CLE Registry).

Compile

Compile for Full Image (Link Compiled with Compiler Server).

Usage

cle compile [root]

Options

OptionsDescription
--localCompile for Local Image
--yaml-path <path>Path to yaml file
--mapping-path <path>Path to mapping file

Execute

Execute Full Image.

Please save the CLE_STATE_OUTPUT string for following prove steps.

Usage

cle exec [...params] [root]

Usage cases

cle exec <blockId> [root]
cle exec <blockId> <offchainData> [root]

Arguments

ArgumentsDescription
<block id>Block number (or block hash) as runtime context
<offchainData>offchain data

Options

OptionsDescription
--localExecute Local Image

Set Up

Set Up Full Image

  • circuit-size: Specify the circuit size of image instead of the default recommended. eg. cle setup -- --circuit-size <size> (eg. 22).

Usage

cle setup [root]

Options

OptionsDescription
--localSet Up Local Image
-k, --circuit-size <size>Circuit size (k in 2^k) of image

Prove

Prove Full Image

Usage

cle prove [...params] [root]

Usage cases

cle prove <blockId> <expectedStateStr> [root]
cle prove <blockId> <offchainData> <expectedStateStr> [root]

Arguments

ArgumentsDescription
<block id>Block number (or block hash) as runtime context
<expected state>State output of the CLE execution
<offchainData>offchain data

Options

OptionsDescription
--localProve Local Image
-i, --inputgenRun in input generation Mode
-t, --testRun in test Mode
-p, --proveRun in prove Mode

Upload

Upload CLE (Code and Full Image).

Please save the ipfs_hash from the output dialog for following publish steps.

Usage

cle upload [root]

Options

OptionsDescription
--localUpload Local CLE (Code and Local Image)

Verify

Verify Proof Onchain.

Usage

cle verify <prove task id>

Arguments

ArgumentsDescription
<prove task id>Task id of prove task

Publish

Publish and Register CLE Onchain.

See also: Verifier Contract Interface.

Usage

cle publish <ipfs_hash> [bounty_reward_per_trigger]

Arguments

ArgumentsDescription
<ipfs hash>IPFS hash of uploaded CLE
[bounty reward per trigger]Bounty reward per trigger in ETH

Deposit

Publish and register CLE Onchain.

Usage

cle deposit <deployed contract address> <deposit amount>

Arguments

ArgumentsDescription
<deployed contract address>Contract address of deployed verification contract address
<deposit amount>Deposit amount in ETH

Config

Configuring CLE

When running CLE from the command line, the tool will automatically attempt to locate a configuration file named cle.config.js in the project’s root directory. It also supports other file extensions such as JS and TS.

The most basic config file looks like this:

// cle.config.js
export default {
  // config options
}

You can also explicitly specify a config file to use with the --config CLI option (resolved relative to cwd):

cle --config my-config.js

Config Intellisense

Since CLE ships with TypeScript typings, you can leverage your IDE's intellisense with jsdoc type hints:

/** @type {import('@hyperoracle/cle-cli-test').UserConfig} */
export default {
  // ...
}

Alternatively, you can use the defineConfig helper which should provide intellisense without the need for jsdoc annotations:

import { defineConfig } from '@hyperoracle/cle-cli-test'

export default defineConfig({
  // ...
})

CLE also directly supports TS config files. You can use cle.config.ts with the defineConfig helper as well.

Config Options

JsonRpcProviderUrl

  • Type: object
  • Default: { mainet: "", sepolia: "", goerli: ""}

Update your Etherum JSON RPC provider URL here. It is recommended to use providers that support debug_getRawReceipts RPC method.

UserPrivateKey

  • Type: string

Update your private key here to sign zkwasm messages. Please note that (during testnet phrase) your address balance (in zkwasm server) should > 0.

ZkwasmProviderUrl

  • Type: string
  • Default: https://zkwasm-explorer.delphinuslab.com:8090

CompilerServerEndpoint

  • Type: string
  • Default: http://compiler.hyperoracle.io/compile

PinataEndpoint

  • Type: string
  • Default: https://api.pinata.cloud/pinning/pinFileToIPFS

PinataJWT

  • Type: string

WasmBinPath

  • Type: string
  • Default: [root]/build/cle_full.wasm

CLE CLI Build-In a tag name is root.
The root is user project root path.
Of course, you can also place this tag at any position within the string.
LocalWasmBinPath is the same.

LocalWasmBinPath

  • Type: string
  • Default: [root]/build/cle_local.wasm