From 56fbdb03cc9b213de650d41359d2fa9391619962 Mon Sep 17 00:00:00 2001 From: Ian Joiner <14581281+iajoiner@users.noreply.github.com> Date: Mon, 28 Oct 2024 21:30:24 -0400 Subject: [PATCH 1/5] feat: add IO fix: warn on equality, error on decrease && simplify code fix: regenerate subxt for dynamic dory changes The chain recently merged changes to the commitment schemes types. This resulted in new type metadata being generated - in particular, CommitmentScheme::Dory is now CommitmentScheme::DynamicDory. feat: add and warn about postprocessing feat: add `PostprocessingLevel` fix: make sure it runs && address reviews fix: use count(*) in count_table fix: not use manual parsing feat: add json files to .gitignore fix: make `PostprocessingLevel` `ValueEnum` refactor: move bins fix: happy clippy docs: add `README.md` docs: swap out LICENSE docs: address reviews docs: address NIT fix: change default SUBSTRATE_NODE_URL to use wss. feat: copy chainlink example code ``` cp documentation/public/samples/ChainlinkFunctions/FunctionsConsumerExample.sol smart-contract/FunctionsConsumerExample.sol cp -r smart-contract-examples/functions-examples/examples/5-use-secrets-threshold example cp -r smart-contract-examples/functions-examples/package.json . ``` feat: add FunctionsConsumerAbi.json This ABI file can be generated using any solidity compiler. This was copied from Remix. feat: remove hardcoded values from example doc: add README explaining how to run the example feat: add code to retrieve sxt access token Co-authored-by: Jay White chore: add .env.enc to .gitignore feat: prepend wasm codegen to javascript job ``` cat sxt_proof_of_sql_sdk_wasm.js example/source.js > tmp && mv tmp example/source.js ``` fix: update generated javascript wasm bindings * removed an `export`s * now the wasm is loaded from a hardcoded url feat: add commitment request and decoding chore: add commented out line to enable running simulation only style: format js code using prettier `npx prettier example/source.js --write` feat: update codegen feat: add prover query and verification refactored source code secrets --- .gitignore | 1 + Cargo.lock | 19 +- Cargo.toml | 22 +- LICENSE | 69 +- README.md | 78 ++- sdk/build.rs => build.rs | 0 chainlink-functions/.gitignore | 2 + chainlink-functions/README.md | 13 + chainlink-functions/example/request.js | 250 +++++++ chainlink-functions/example/source.js | 30 + chainlink-functions/package.json | 19 + .../smart-contract/FunctionsConsumerAbi.json | 326 +++++++++ .../FunctionsConsumerExample.sol | 112 ++++ {sdk/src => examples/cli}/args.rs | 15 +- {sdk/src => examples/cli}/main.rs | 5 +- .../count-ethereum-core}/main.rs | 67 +- {sdk/proto => proto}/ingest.proto | 0 {sdk/proto => proto}/prover.proto | 0 scripts/count-ethereum-core/Cargo.toml | 16 - sdk/Cargo.toml | 26 - {sdk/src => src}/README.md | 0 {sdk/src => src}/auth.rs | 0 {sdk/src => src}/client.rs | 48 +- {sdk/src => src}/lib.rs | 4 +- {sdk/src => src}/substrate.rs | 2 +- {sdk/src => src}/sxt_chain_runtime.rs | 627 ++++++++++++++---- 26 files changed, 1506 insertions(+), 245 deletions(-) rename sdk/build.rs => build.rs (100%) create mode 100644 chainlink-functions/.gitignore create mode 100644 chainlink-functions/README.md create mode 100644 chainlink-functions/example/request.js create mode 100644 chainlink-functions/example/source.js create mode 100644 chainlink-functions/package.json create mode 100644 chainlink-functions/smart-contract/FunctionsConsumerAbi.json create mode 100644 chainlink-functions/smart-contract/FunctionsConsumerExample.sol rename {sdk/src => examples/cli}/args.rs (85%) rename {sdk/src => examples/cli}/main.rs (88%) rename {scripts/count-ethereum-core/src => examples/count-ethereum-core}/main.rs (55%) rename {sdk/proto => proto}/ingest.proto (100%) rename {sdk/proto => proto}/prover.proto (100%) delete mode 100644 scripts/count-ethereum-core/Cargo.toml delete mode 100644 sdk/Cargo.toml rename {sdk/src => src}/README.md (100%) rename {sdk/src => src}/auth.rs (100%) rename {sdk/src => src}/client.rs (68%) rename {sdk/src => src}/lib.rs (68%) rename {sdk/src => src}/substrate.rs (99%) rename {sdk/src => src}/sxt_chain_runtime.rs (96%) diff --git a/.gitignore b/.gitignore index 12e7476..079527f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .env +**/*.json # Rust # Generated by Cargo diff --git a/Cargo.lock b/Cargo.lock index 8841dbf..fa4772d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1226,22 +1226,6 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" -[[package]] -name = "count-ethereum-core" -version = "0.1.0" -dependencies = [ - "clap", - "dotenv", - "env_logger", - "futures", - "indexmap 2.6.0", - "log", - "proof-of-sql", - "serde_json", - "sxt-proof-of-sql-sdk", - "tokio", -] - [[package]] name = "cpufeatures" version = "0.2.14" @@ -4730,8 +4714,11 @@ dependencies = [ "ark-serialize", "clap", "dotenv", + "env_logger", "flexbuffers", "futures", + "indexmap 2.6.0", + "log", "postcard", "proof-of-sql", "proof-of-sql-parser", diff --git a/Cargo.toml b/Cargo.toml index 3a85f5c..6d76417 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,10 @@ -[workspace] -members = ["./scripts/count-ethereum-core", "sdk"] +[package] +name = "sxt-proof-of-sql-sdk" +version = "0.1.0" +edition = "2021" +resolver = "2" -[workspace.dependencies] +[dependencies] ark-serialize = { version = "0.4.0", default-features = false } clap = { version = "4.5.20", features = ["derive", "env"] } dotenv = "0.15" @@ -18,6 +21,17 @@ reqwest = { version = "0.12", features = ["json"] } serde = { version = "1.0", features = ["serde_derive"] } serde_json = "1.0" subxt = "0.37.0" -sxt-proof-of-sql-sdk = { path = "sdk" } tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] } tonic = { version = "0.11", features = ["tls", "tls-roots"] } + +[build-dependencies] +prost-build = "0.12" +tonic-build = { version = "0.11" } + +[[example]] +name = "cli" +path = "examples/cli/main.rs" + +[[example]] +name = "count-ethereum-core" +path = "examples/count-ethereum-core/main.rs" diff --git a/LICENSE b/LICENSE index b6dc943..6f0003f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,70 @@ Copyright (C) 2024 Space and Time Labs, Inc. -All Rights Reserved. +Cryptographic Open Software License 1.0 -This software may not be copied, distributed, modified, and/or utilized in any way without the express permission of Space and Time Labs, Inc. \ No newline at end of file +This license contains the terms and conditions under which Space +and Time Labs, Inc. ("Space and Time") makes available this +Software. Your use of the Software is subject to these terms and +conditions. + +Space and Time grants you ("Licensee") a license to use, modify, +and redistribute the Software, but only (a) for Non-Commercial +Use, or (b) for Commercial Use with the Space and Time Platform +only. You must use the Software only as allowed by applicable +law. + +If Licensee makes available a copy of the Software to any third +party, the Software must be subject to the terms of this license +only, and Licensee must provide a copy of this license to that +third party. + +If Licensee makes changes or additions to the Software, Licensee +may license those changes or additions under terms of Licensee's +choice, but Licensee cannot change this license for the +Software. + +These terms do not allow Licensee to sublicense or transfer any +of Licensee’s rights to anyone else. These terms do not imply +any other licenses not expressly granted in this license. + +If Licensee violates any of these terms, or uses the Software in +a way not authorized under this license, the license granted to +Licensee ends immediately. + +If Licensee makes, or authorizes any other person to make, any +written claim that the Software, or any other product or service +of Space and Time, infringes or contributes to infringement of +any patent, all rights granted to Licensee under this license +end immediately. + +As far as the law allows, the Software is provided AS IS, +without any warranty or condition, and Space and Time will not +be liable to Licensee for any damages arising out of these terms +or the use or nature of the Software, under any kind of legal +claim. If the disclaimer in this paragraph is unenforceable +under applicable law, this license is void. + +Terms in this license are used as follows: + +The "Software" is any software made available by Space and Time +under this license. + +A "Space and Time Product" is any product or service offered by +Space and Time or its affiliates. + +"Non-Commercial Use" means personal, academic, scientific, or +research and development use, or evaluating the Software, but +does not include uses where the Software facilitates any +transaction of economic value or supports any system that +provides any economic or commercial value other than on the +Space and Time Platform. + +Any use that is not a Non-Commercial Use is a "Commercial Use." + +"Space and Time Platform" means the enterprise data platform, or +node operations within a Space and Time decentralized network, +in each case for processing database queries with cryptographic +proofs, that is made available by Space and Time. + +To "use" means any use, modification, distribution or other +exploitation of the Software or any part of it. \ No newline at end of file diff --git a/README.md b/README.md index 3f900b5..a200c86 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,70 @@ -# Sxt Proof Of Sql Sdk +# Space and Time (SxT) Proof of SQL SDK -sxt-node +An SDK to help users interact with the Space and Time (SxT) TestNet and execute Proof of SQL queries. -## πŸ“‘ Table of Contents +## Introduction -- [πŸ› οΈ Installation](#installation) -- [πŸš€ Usage](#usage) -- [🀝 Contributing](#contributing) - - [πŸ“ Commit Messages](#commit-messages) -- [πŸ“§ Contact](#contact) -- [πŸ“š Additional Resources](#additional-resources) +The Space and Time Proof of SQL SDK is a Rust crate designed to simplify the process of running SQL queries against the Space and Time TestNet and verifying the results using cryptographic proofs. It leverages the [Proof of SQL](https://github.com/spaceandtimelabs/sxt-proof-of-sql) framework to ensure the integrity and correctness of query results. -## πŸ› οΈ Installation +## Installation -Provide instructions on how to install or set up the project. Include any dependencies that need to be installed and how to install them. +Add the following to your `Cargo.toml`: -## πŸš€ Usage +```toml +[dependencies] +sxt-proof-of-sql-sdk = "0.1.0" +``` +Then, run: -Explain how to use the project. Provide examples if applicable. This could include command line instructions, code snippets, or screenshots. +```bash +cargo build +``` -## 🀝 Contributing +## Usage +### Running Examples -If you would like others to contribute to your project, provide guidelines for how they can do so. This could include information on how to report bugs, suggest enhancements, or submit pull requests. +To run the provided example that counts entries in the Ethereum core table: -#### πŸ“ Commit Messages +```bash -Please ensure your commits follow the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) standards. Doing so allows our CI system to properly categorize changes during the release process. +cargo run --example cli -- -q "select * from ethereum.blocks" --table-ref "ethereum.blocks" +``` -## πŸ“§ Contact +### Basic Usage in Code -For questions on this repository, please reach out to [JayWhite2357](https://github.com/JayWhite2357). +Here's how you can use the `SxTClient` in your Rust application: -## πŸ“š Additional Resources +```rust -- [πŸ“‹ Changelog](CHANGELOG.md) -- [πŸ“œ License](LICENSE) -- [πŸ‘¨β€πŸ’» Code Owners](CODEOWNERS) \ No newline at end of file +use sxt_proof_of_sql_sdk::SxTClient; + +#[tokio::main] +async fn main() -> Result<(), Box> { + // Initialize the SxT client with necessary URLs and API key + let client = SxTClient::new( + "https://api.spaceandtime.dev".to_string(), + "https://proxy.api.spaceandtime.dev".to_string(), + "https://rpc.testnet.sxt.network".to_string(), + "your_sxt_api_key".to_string(), + "path/to/verifier_setup.bin".to_string(), + ); + + // Execute and verify a SQL query + let result = client + .query_and_verify("SELECT COUNT(*) FROM ethereum.transactions", "ethereum.transactions") + .await?; + + println!("Query Result: {:?}", result); + Ok(()) +} +``` + +Note: Replace "your_sxt_api_key" with your actual SxT API key, and ensure the `verifier_setup.bin` file is correctly specified. You can use the [file here](https://github.com/spaceandtimelabs/sxt-proof-of-sql-sdk/blob/main/verifier_setup.bin) or fetch the files [here](https://github.com/spaceandtimelabs/sxt-proof-of-sql/releases/tag/dory-prover-params-nu-16). + +## Getting an API Key + +To obtain an API key for accessing SxT services, please refer to the [Space and Time docs](https://docs.spaceandtime.io/docs/accreditation-use-api-keys). + +## License + +This project is licensed under the terms of the [Cryptographic Open Software License 1.0](https://github.com/spaceandtimelabs/sxt-proof-of-sql-sdk/blob/main/LICENSE). \ No newline at end of file diff --git a/sdk/build.rs b/build.rs similarity index 100% rename from sdk/build.rs rename to build.rs diff --git a/chainlink-functions/.gitignore b/chainlink-functions/.gitignore new file mode 100644 index 0000000..3302050 --- /dev/null +++ b/chainlink-functions/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +.env.enc diff --git a/chainlink-functions/README.md b/chainlink-functions/README.md new file mode 100644 index 0000000..4943c99 --- /dev/null +++ b/chainlink-functions/README.md @@ -0,0 +1,13 @@ +This example is heavily borrowed from https://docs.chain.link/chainlink-functions/tutorials/api-use-secrets. +1. Run `npm install` to install the dependencies. +2. Set up your on chain resources as shown here: https://docs.chain.link/chainlink-functions/tutorials/api-use-secrets#configure-your-onchain-resources. +3. Add the following environment variables, either in a `.env` file, or using `npx env-enc set`. + ``` + CONSUMER_ADDRESS=0x8dFf78B7EE3128D00E90611FBeD20A71397064D9 # REPLACE this with your Functions consumer address + SUBSCRIPTION_ID=3 # REPLACE this with your subscription ID + LINK_TOKEN_ADDRESS=0x779877A7B0D9E8603169DdbD7836e478b4624789 # REPLACE this with your wallet address + ETHEREUM_SEPOLIA_RPC_URL= + PRIVATE_KEY= + SXT_API_KEY= + ``` +4. Run `node example/request.js` to upload the secrets, run a simulation, and then submit a chainlink job. \ No newline at end of file diff --git a/chainlink-functions/example/request.js b/chainlink-functions/example/request.js new file mode 100644 index 0000000..79d32fa --- /dev/null +++ b/chainlink-functions/example/request.js @@ -0,0 +1,250 @@ +const fs = require("fs"); +const path = require("path"); +const { + SubscriptionManager, + SecretsManager, + simulateScript, + ResponseListener, + ReturnType, + decodeResult, + FulfillmentCode, +} = require("@chainlink/functions-toolkit"); +const functionsConsumerAbi = require("../smart-contract/FunctionsConsumerAbi.json"); +const ethers = require("ethers"); +require('dotenv').config(); // This will load from .env file in addition to env-enc file. +require("@chainlink/env-enc").config(); + +const consumerAddress = process.env.CONSUMER_ADDRESS; +const subscriptionId = process.env.SUBSCRIPTION_ID; + +const makeRequestSepolia = async () => { + // hardcoded for Ethereum Sepolia + const routerAddress = "0xb83E47C2bC239B3bf370bc41e1459A34b41238D0"; + const linkTokenAddress = process.env.LINK_TOKEN_ADDRESS; + const donId = "fun-ethereum-sepolia-1"; + const explorerUrl = "https://sepolia.etherscan.io"; + const gatewayUrls = [ + "https://01.functions-gateway.testnet.chain.link/", + "https://02.functions-gateway.testnet.chain.link/", + ]; + + // Initialize functions settings + const source = fs + .readFileSync(path.resolve(__dirname, "source.js")) + .toString(); + + const args = []; + const secrets = { apiKey: process.env.SXT_API_KEY }; + const slotIdNumber = 0; // slot ID where to upload the secrets + const expirationTimeMinutes = 15; // expiration time in minutes of the secrets + const gasLimit = 300000; + + // Initialize ethers signer and provider to interact with the contracts onchain + const privateKey = process.env.PRIVATE_KEY; // fetch PRIVATE_KEY + if (!privateKey) + throw new Error( + "private key not provided - check your environment variables" + ); + + const rpcUrl = process.env.ETHEREUM_SEPOLIA_RPC_URL; // fetch Sepolia RPC URL + + if (!rpcUrl) + throw new Error(`rpcUrl not provided - check your environment variables`); + + const provider = new ethers.providers.JsonRpcProvider(rpcUrl); + + const wallet = new ethers.Wallet(privateKey); + const signer = wallet.connect(provider); // create ethers signer for signing transactions + + ///////// START SIMULATION //////////// + + console.log("Start simulation..."); + + const response = await simulateScript({ + source: source, + args: args, + bytesArgs: [], // bytesArgs - arguments can be encoded off-chain to bytes. + secrets: secrets, + }); + + console.log("Simulation result", response); + const errorString = response.errorString; + if (errorString) { + console.log(`❌ Error during simulation: `, errorString); + } else { + const returnType = ReturnType.uint256; + const responseBytesHexstring = response.responseBytesHexstring; + if (ethers.utils.arrayify(responseBytesHexstring).length > 0) { + const decodedResponse = decodeResult( + response.responseBytesHexstring, + returnType + ); + console.log(`βœ… Decoded response to ${returnType}: `, decodedResponse); + } + } + + //////// ESTIMATE REQUEST COSTS //////// + console.log("\nEstimate request costs..."); + // Initialize and return SubscriptionManager + const subscriptionManager = new SubscriptionManager({ + signer: signer, + linkTokenAddress: linkTokenAddress, + functionsRouterAddress: routerAddress, + }); + await subscriptionManager.initialize(); + + // estimate costs in Juels + + const gasPriceWei = await signer.getGasPrice(); // get gasPrice in wei + + const estimatedCostInJuels = + await subscriptionManager.estimateFunctionsRequestCost({ + donId: donId, // ID of the DON to which the Functions request will be sent + subscriptionId: subscriptionId, // Subscription ID + callbackGasLimit: gasLimit, // Total gas used by the consumer contract's callback + gasPriceWei: BigInt(gasPriceWei), // Gas price in gWei + }); + + console.log( + `Fulfillment cost estimated to ${ethers.utils.formatEther( + estimatedCostInJuels + )} LINK` + ); + + // process.exit(0); // Uncomment to stop the script after simulation + + //////// MAKE REQUEST //////// + + console.log("\nMake request..."); + + // First encrypt secrets and upload the encrypted secrets to the DON + const secretsManager = new SecretsManager({ + signer: signer, + functionsRouterAddress: routerAddress, + donId: donId, + }); + await secretsManager.initialize(); + + // Encrypt secrets and upload to DON + const encryptedSecretsObj = await secretsManager.encryptSecrets(secrets); + + console.log( + `Upload encrypted secret to gateways ${gatewayUrls}. slotId ${slotIdNumber}. Expiration in minutes: ${expirationTimeMinutes}` + ); + // Upload secrets + const uploadResult = await secretsManager.uploadEncryptedSecretsToDON({ + encryptedSecretsHexstring: encryptedSecretsObj.encryptedSecrets, + gatewayUrls: gatewayUrls, + slotId: slotIdNumber, + minutesUntilExpiration: expirationTimeMinutes, + }); + + if (!uploadResult.success) + throw new Error(`Encrypted secrets not uploaded to ${gatewayUrls}`); + + console.log( + `\nβœ… Secrets uploaded properly to gateways ${gatewayUrls}! Gateways response: `, + uploadResult + ); + + const donHostedSecretsVersion = parseInt(uploadResult.version); // fetch the reference of the encrypted secrets + + const functionsConsumer = new ethers.Contract( + consumerAddress, + functionsConsumerAbi, + signer + ); + + // Actual transaction call + const transaction = await functionsConsumer.sendRequest( + source, // source + "0x", // user hosted secrets - encryptedSecretsUrls - empty in this example + slotIdNumber, // slot ID of the encrypted secrets + donHostedSecretsVersion, // version of the encrypted secrets + args, + [], // bytesArgs - arguments can be encoded off-chain to bytes. + subscriptionId, + gasLimit, + ethers.utils.formatBytes32String(donId) // jobId is bytes32 representation of donId + ); + + // Log transaction details + console.log( + `\nβœ… Functions request sent! Transaction hash ${transaction.hash}. Waiting for a response...` + ); + + console.log( + `See your request in the explorer ${explorerUrl}/tx/${transaction.hash}` + ); + + const responseListener = new ResponseListener({ + provider: provider, + functionsRouterAddress: routerAddress, + }); // Instantiate a ResponseListener object to wait for fulfillment. + (async () => { + try { + const response = await new Promise((resolve, reject) => { + responseListener + .listenForResponseFromTransaction(transaction.hash) + .then((response) => { + resolve(response); // Resolves once the request has been fulfilled. + }) + .catch((error) => { + reject(error); // Indicate that an error occurred while waiting for fulfillment. + }); + }); + + const fulfillmentCode = response.fulfillmentCode; + + if (fulfillmentCode === FulfillmentCode.FULFILLED) { + console.log( + `\nβœ… Request ${response.requestId + } successfully fulfilled. Cost is ${ethers.utils.formatEther( + response.totalCostInJuels + )} LINK.Complete reponse: `, + response + ); + } else if (fulfillmentCode === FulfillmentCode.USER_CALLBACK_ERROR) { + console.log( + `\n⚠️ Request ${response.requestId + } fulfilled. However, the consumer contract callback failed. Cost is ${ethers.utils.formatEther( + response.totalCostInJuels + )} LINK.Complete reponse: `, + response + ); + } else { + console.log( + `\n❌ Request ${response.requestId + } not fulfilled. Code: ${fulfillmentCode}. Cost is ${ethers.utils.formatEther( + response.totalCostInJuels + )} LINK.Complete reponse: `, + response + ); + } + + const errorString = response.errorString; + if (errorString) { + console.log(`\n❌ Error during the execution: `, errorString); + } else { + const responseBytesHexstring = response.responseBytesHexstring; + if (ethers.utils.arrayify(responseBytesHexstring).length > 0) { + const decodedResponse = decodeResult( + response.responseBytesHexstring, + ReturnType.uint256 + ); + console.log( + `\nβœ… Decoded response to ${ReturnType.uint256}: `, + decodedResponse + ); + } + } + } catch (error) { + console.error("Error listening for response:", error); + } + })(); +}; + +makeRequestSepolia().catch((e) => { + console.error(e); + process.exit(1); +}); diff --git a/chainlink-functions/example/source.js b/chainlink-functions/example/source.js new file mode 100644 index 0000000..cc98f96 --- /dev/null +++ b/chainlink-functions/example/source.js @@ -0,0 +1,30 @@ +// Import the package +const SxTProofModule = await import("npm:sxt-chain-sdk"); + +// Extract the default export (SxTProof class) +const SxTProof = SxTProofModule.default; + +// Define test parameters +const queryString = 'SELECT SUM(BLOCK_NUMBER), COUNT(*) FROM ETHEREUM.BLOCKS'; +const commitmentKey = + '0xca407206ec1ab726b2636c4b145ac28749505e273536fae35330b966dac69e86a4832a125c0464e066dd20add960efb518424c4f434b5320455448455245554d4a9e6f9b8d43f6ad008f8c291929dee201'; + +if (!secrets.apiKey) { + throw Error("Missing secret: apiKey"); +} + +// Step 1: Initialize the SxTProof instance +const proof = new SxTProof(queryString, commitmentKey, secrets.apiKey); + +try { + // Step 2: Initialize the wasm module + await proof.init(); + + // Step 3: Verify the proof + const result = await proof.verify(); +} catch (error) { + // Step 4: Handle errors +} + +// Step 5: Final message +return Functions.encodeString("Verified"); diff --git a/chainlink-functions/package.json b/chainlink-functions/package.json new file mode 100644 index 0000000..5a1cab7 --- /dev/null +++ b/chainlink-functions/package.json @@ -0,0 +1,19 @@ +{ + "name": "functions-examples", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "@chainlink/env-enc": "^1.0.5", + "@chainlink/functions-toolkit": "^0.2.7", + "ethers": "^5.7.2" + }, + "devDependencies": { + "dotenv": "^16.4.5" + } +} diff --git a/chainlink-functions/smart-contract/FunctionsConsumerAbi.json b/chainlink-functions/smart-contract/FunctionsConsumerAbi.json new file mode 100644 index 0000000..703db80 --- /dev/null +++ b/chainlink-functions/smart-contract/FunctionsConsumerAbi.json @@ -0,0 +1,326 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "router", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "EmptyArgs", + "type": "error" + }, + { + "inputs": [], + "name": "EmptySecrets", + "type": "error" + }, + { + "inputs": [], + "name": "EmptySource", + "type": "error" + }, + { + "inputs": [], + "name": "NoInlineSecrets", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyRouterCanFulfill", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "requestId", + "type": "bytes32" + } + ], + "name": "UnexpectedRequestID", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "OwnershipTransferRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + } + ], + "name": "RequestFulfilled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + } + ], + "name": "RequestSent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "requestId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "err", + "type": "bytes" + } + ], + "name": "Response", + "type": "event" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "requestId", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "response", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "err", + "type": "bytes" + } + ], + "name": "handleOracleFulfillment", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "s_lastError", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "s_lastRequestId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "s_lastResponse", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "source", + "type": "string" + }, + { + "internalType": "bytes", + "name": "encryptedSecretsUrls", + "type": "bytes" + }, + { + "internalType": "uint8", + "name": "donHostedSecretsSlotID", + "type": "uint8" + }, + { + "internalType": "uint64", + "name": "donHostedSecretsVersion", + "type": "uint64" + }, + { + "internalType": "string[]", + "name": "args", + "type": "string[]" + }, + { + "internalType": "bytes[]", + "name": "bytesArgs", + "type": "bytes[]" + }, + { + "internalType": "uint64", + "name": "subscriptionId", + "type": "uint64" + }, + { + "internalType": "uint32", + "name": "gasLimit", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "donID", + "type": "bytes32" + } + ], + "name": "sendRequest", + "outputs": [ + { + "internalType": "bytes32", + "name": "requestId", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "request", + "type": "bytes" + }, + { + "internalType": "uint64", + "name": "subscriptionId", + "type": "uint64" + }, + { + "internalType": "uint32", + "name": "gasLimit", + "type": "uint32" + }, + { + "internalType": "bytes32", + "name": "donID", + "type": "bytes32" + } + ], + "name": "sendRequestCBOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "requestId", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/chainlink-functions/smart-contract/FunctionsConsumerExample.sol b/chainlink-functions/smart-contract/FunctionsConsumerExample.sol new file mode 100644 index 0000000..8b28421 --- /dev/null +++ b/chainlink-functions/smart-contract/FunctionsConsumerExample.sol @@ -0,0 +1,112 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.19; + +import {FunctionsClient} from "@chainlink/contracts/src/v0.8/functions/v1_0_0/FunctionsClient.sol"; +import {ConfirmedOwner} from "@chainlink/contracts/src/v0.8/shared/access/ConfirmedOwner.sol"; +import {FunctionsRequest} from "@chainlink/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsRequest.sol"; + +/** + * THIS IS AN EXAMPLE CONTRACT THAT USES HARDCODED VALUES FOR CLARITY. + * THIS IS AN EXAMPLE CONTRACT THAT USES UN-AUDITED CODE. + * DO NOT USE THIS CODE IN PRODUCTION. + */ +contract FunctionsConsumerExample is FunctionsClient, ConfirmedOwner { + using FunctionsRequest for FunctionsRequest.Request; + + bytes32 public s_lastRequestId; + bytes public s_lastResponse; + bytes public s_lastError; + + error UnexpectedRequestID(bytes32 requestId); + + event Response(bytes32 indexed requestId, bytes response, bytes err); + + constructor( + address router + ) FunctionsClient(router) ConfirmedOwner(msg.sender) {} + + /** + * @notice Send a simple request + * @param source JavaScript source code + * @param encryptedSecretsUrls Encrypted URLs where to fetch user secrets + * @param donHostedSecretsSlotID Don hosted secrets slotId + * @param donHostedSecretsVersion Don hosted secrets version + * @param args List of arguments accessible from within the source code + * @param bytesArgs Array of bytes arguments, represented as hex strings + * @param subscriptionId Billing ID + */ + function sendRequest( + string memory source, + bytes memory encryptedSecretsUrls, + uint8 donHostedSecretsSlotID, + uint64 donHostedSecretsVersion, + string[] memory args, + bytes[] memory bytesArgs, + uint64 subscriptionId, + uint32 gasLimit, + bytes32 donID + ) external onlyOwner returns (bytes32 requestId) { + FunctionsRequest.Request memory req; + req.initializeRequestForInlineJavaScript(source); + if (encryptedSecretsUrls.length > 0) + req.addSecretsReference(encryptedSecretsUrls); + else if (donHostedSecretsVersion > 0) { + req.addDONHostedSecrets( + donHostedSecretsSlotID, + donHostedSecretsVersion + ); + } + if (args.length > 0) req.setArgs(args); + if (bytesArgs.length > 0) req.setBytesArgs(bytesArgs); + s_lastRequestId = _sendRequest( + req.encodeCBOR(), + subscriptionId, + gasLimit, + donID + ); + return s_lastRequestId; + } + + /** + * @notice Send a pre-encoded CBOR request + * @param request CBOR-encoded request data + * @param subscriptionId Billing ID + * @param gasLimit The maximum amount of gas the request can consume + * @param donID ID of the job to be invoked + * @return requestId The ID of the sent request + */ + function sendRequestCBOR( + bytes memory request, + uint64 subscriptionId, + uint32 gasLimit, + bytes32 donID + ) external onlyOwner returns (bytes32 requestId) { + s_lastRequestId = _sendRequest( + request, + subscriptionId, + gasLimit, + donID + ); + return s_lastRequestId; + } + + /** + * @notice Store latest result/error + * @param requestId The request ID, returned by sendRequest() + * @param response Aggregated response from the user code + * @param err Aggregated error from the user code or from the execution pipeline + * Either response or error parameter will be set, but never both + */ + function fulfillRequest( + bytes32 requestId, + bytes memory response, + bytes memory err + ) internal override { + if (s_lastRequestId != requestId) { + revert UnexpectedRequestID(requestId); + } + s_lastResponse = response; + s_lastError = err; + emit Response(requestId, s_lastResponse, s_lastError); + } +} diff --git a/sdk/src/args.rs b/examples/cli/args.rs similarity index 85% rename from sdk/src/args.rs rename to examples/cli/args.rs index be02423..40df744 100644 --- a/sdk/src/args.rs +++ b/examples/cli/args.rs @@ -1,5 +1,5 @@ -use crate::SxTClient; use clap::Parser; +use sxt_proof_of_sql_sdk::{PostprocessingLevel, SxTClient}; /// Struct to define and parse command-line arguments for Proof of SQL Client. /// @@ -44,7 +44,7 @@ pub struct SdkArgs { #[arg( long, value_name = "SUBSTRATE_NODE_URL", - default_value = "https://rpc.testnet.sxt.network", + default_value = "wss://rpc.testnet.sxt.network", env = "SUBSTRATE_NODE_URL" )] pub substrate_node_url: String, @@ -79,6 +79,16 @@ pub struct SdkArgs { default_value = "verifier_setup.bin" )] pub verifier_setup: String, + + /// Level of postprocessing allowed. Default is `Cheap`. + #[arg( + long, + value_name = "POSTPROCESSING_LEVEL", + default_value = "cheap", + value_enum, + help = "Level of postprocessing allowed, default is `Cheap`" + )] + pub postprocessing_level: PostprocessingLevel, } impl From<&SdkArgs> for SxTClient { @@ -90,5 +100,6 @@ impl From<&SdkArgs> for SxTClient { args.sxt_api_key.clone(), args.verifier_setup.clone(), ) + .with_postprocessing(args.postprocessing_level) } } diff --git a/sdk/src/main.rs b/examples/cli/main.rs similarity index 88% rename from sdk/src/main.rs rename to examples/cli/main.rs index e4aab0e..c7d92e0 100644 --- a/sdk/src/main.rs +++ b/examples/cli/main.rs @@ -1,6 +1,9 @@ +mod args; + +use crate::args::SdkArgs; use clap::Parser; use dotenv::dotenv; -use sxt_proof_of_sql_sdk::{SdkArgs, SxTClient}; +use sxt_proof_of_sql_sdk::SxTClient; #[tokio::main] async fn main() -> Result<(), Box> { diff --git a/scripts/count-ethereum-core/src/main.rs b/examples/count-ethereum-core/main.rs similarity index 55% rename from scripts/count-ethereum-core/src/main.rs rename to examples/count-ethereum-core/main.rs index 6162966..28de4a8 100644 --- a/scripts/count-ethereum-core/src/main.rs +++ b/examples/count-ethereum-core/main.rs @@ -1,13 +1,12 @@ use futures::StreamExt; use indexmap::IndexMap; use proof_of_sql::base::database::OwnedColumn; -use std::{env, fs::File, io::BufReader, sync::Arc}; +use std::{cmp::Ordering, env, fs::File, io::BufReader, path::Path, sync::Arc}; use sxt_proof_of_sql_sdk::SxTClient; -#[allow(dead_code)] const ETHEREUM_CORE_COUNTS_FILE: &str = "ethereum-core-counts.json"; -const ETHEREUM_CORE_TABLES: [&str; 21] = [ +const ETHEREUM_CORE_TABLES: [&str; 11] = [ "ETHEREUM.BLOCKS", "ETHEREUM.BLOCK_DETAILS", "ETHEREUM.TRANSACTIONS", @@ -17,26 +16,17 @@ const ETHEREUM_CORE_TABLES: [&str; 21] = [ "ETHEREUM.NFT_COLLECTIONS", "ETHEREUM.NFTS", "ETHEREUM.NATIVETOKEN_TRANSFERS", - "ETHEREUM.ERC20_EVT_TRANSFER", - "ETHEREUM.ERC20_EVT_APPROVAL", - "ETHEREUM.ERC721_EVT_TRANSFER", - "ETHEREUM.ERC721_EVT_APPROVAL", - "ETHEREUM.ERC1155_EVT_TRANSFER", - "ETHEREUM.CONTRACT_EVT_APPROVALFORALL", - "ETHEREUM.CONTRACT_EVT_OWNERSHIPTRANSFERRED", - "ETHEREUM.ERC1155_EVT_TRANSFERBATCH", - "ETHEREUM.NATIVE_WALLETS", "ETHEREUM.FUNGIBLETOKEN_WALLETS", - "ETHEREUM.ERC721_OWNERS", "ETHEREUM.ERC1155_OWNERS", ]; +/// Count the number of rows in a table async fn count_table( client: &SxTClient, table_ref: &str, ) -> Result> { let uppercased_table_ref = table_ref.to_uppercase(); - let query = format!("SELECT * FROM {uppercased_table_ref}"); + let query = format!("SELECT COUNT(*) FROM {uppercased_table_ref}"); let table = client .query_and_verify(&query, &uppercased_table_ref) .await?; @@ -51,26 +41,54 @@ async fn count_table( Ok(int_column[0]) } +/// Compare current and previous counts and warn if current is less than previous or if current is absent while previous is present +fn compare_counts( + current_counts: &IndexMap, + previous_counts: &IndexMap, + table_names: &[&str], +) { + for table_name in table_names { + let current_count = current_counts.get(*table_name).unwrap_or(&0); + let previous_count = previous_counts.get(*table_name).unwrap_or(&0); + match previous_count.cmp(current_count) { + Ordering::Less => { + log::info!( + "count of {table_name} increased from {previous_count} to {current_count}" + ); + } + Ordering::Equal => { + log::warn!("count of {table_name} was and remains {current_count}"); + } + Ordering::Greater => { + log::error!( + "count of {table_name} decreased from {previous_count} to {current_count}" + ); + } + } + } +} + /// Load the previous counts file -#[allow(dead_code)] -async fn load_from_file() -> IndexMap { - let file = File::open(ETHEREUM_CORE_COUNTS_FILE).expect("failed to open file"); +fn load_from_file(file_path: &str) -> IndexMap { + // Check if the file exists + if !Path::new(file_path).exists() { + return IndexMap::new(); + } + let file = File::open(file_path).expect("failed to open file"); let mut reader = BufReader::new(&file); serde_json::from_reader(&mut reader).expect("failed to parse file") } /// Save the current counts to a file -#[allow(dead_code)] -async fn save_to_file(counts: IndexMap) { - let file = File::create(ETHEREUM_CORE_COUNTS_FILE).expect("failed to create file"); - serde_json::to_writer(&file, &counts).expect("failed to write file"); +fn save_to_file(counts: &IndexMap, file_path: &str) { + let file = File::create(file_path).expect("failed to create file"); + serde_json::to_writer(&file, counts).expect("failed to write file"); } #[tokio::main] async fn main() { env_logger::init(); dotenv::dotenv().unwrap(); - let client = Arc::new(SxTClient::new( env::var("PROVER_ROOT_URL").unwrap_or("https://api.spaceandtime.dev".to_string()), env::var("AUTH_ROOT_URL").unwrap_or("https://proxy.api.spaceandtime.dev".to_string()), @@ -94,5 +112,8 @@ async fn main() { }) .collect() .await; - println!("current_counts: {current_counts:?}"); + save_to_file(¤t_counts, ETHEREUM_CORE_COUNTS_FILE); + // Compare previous and current counts + let previous_counts = load_from_file(ETHEREUM_CORE_COUNTS_FILE); + compare_counts(¤t_counts, &previous_counts, ÐEREUM_CORE_TABLES); } diff --git a/sdk/proto/ingest.proto b/proto/ingest.proto similarity index 100% rename from sdk/proto/ingest.proto rename to proto/ingest.proto diff --git a/sdk/proto/prover.proto b/proto/prover.proto similarity index 100% rename from sdk/proto/prover.proto rename to proto/prover.proto diff --git a/scripts/count-ethereum-core/Cargo.toml b/scripts/count-ethereum-core/Cargo.toml deleted file mode 100644 index 9ed91a4..0000000 --- a/scripts/count-ethereum-core/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "count-ethereum-core" -version = "0.1.0" -edition = "2021" - -[dependencies] -clap.workspace = true -dotenv.workspace = true -env_logger.workspace = true -log.workspace = true -futures.workspace = true -indexmap.workspace = true -proof-of-sql.workspace = true -serde_json.workspace = true -sxt-proof-of-sql-sdk.workspace = true -tokio.workspace = true diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml deleted file mode 100644 index a2646e2..0000000 --- a/sdk/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[package] -name = "sxt-proof-of-sql-sdk" -version = "0.1.0" -edition = "2021" - -[dependencies] -ark-serialize.workspace = true -clap.workspace = true -dotenv.workspace = true -flexbuffers.workspace = true -futures.workspace = true -postcard.workspace = true -proof-of-sql-parser.workspace = true -prost.workspace = true -reqwest.workspace = true -serde.workspace = true -serde_json.workspace = true -subxt.workspace = true -tokio.workspace = true -tonic.workspace = true -proof-of-sql.workspace = true - - -[build-dependencies] -prost-build = "0.12" -tonic-build = { version = "0.11" } diff --git a/sdk/src/README.md b/src/README.md similarity index 100% rename from sdk/src/README.md rename to src/README.md diff --git a/sdk/src/auth.rs b/src/auth.rs similarity index 100% rename from sdk/src/auth.rs rename to src/auth.rs diff --git a/sdk/src/client.rs b/src/client.rs similarity index 68% rename from sdk/src/client.rs rename to src/client.rs index 8415fd8..70bb32c 100644 --- a/sdk/src/client.rs +++ b/src/client.rs @@ -1,10 +1,15 @@ use crate::{get_access_token, query_commitments}; +use clap::ValueEnum; use proof_of_sql::{ base::database::{OwnedTable, TableRef}, proof_primitive::dory::{ DoryScalar, DynamicDoryCommitment, DynamicDoryEvaluationProof, VerifierSetup, }, - sql::{parse::QueryExpr, proof::VerifiableQueryResult}, + sql::{ + parse::QueryExpr, + postprocessing::{apply_postprocessing_steps, OwnedTablePostprocessing}, + proof::VerifiableQueryResult, + }, }; use prover::{ProverContextRange, ProverQuery, ProverResponse}; use reqwest::Client; @@ -14,6 +19,19 @@ mod prover { tonic::include_proto!("sxt.core"); } +/// Level of postprocessing allowed +/// +/// Some postprocessing steps are expensive so we allow the user to control the level of postprocessing. +#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)] +pub enum PostprocessingLevel { + /// No postprocessing allowed + None, + /// Only cheap postprocessing allowed + Cheap, + /// All postprocessing allowed + All, +} + /// Space and Time (SxT) client #[derive(Debug, Clone)] pub struct SxTClient { @@ -34,6 +52,9 @@ pub struct SxTClient { /// Path to the verifier setup binary file pub verifier_setup: String, + + /// Level of postprocessing allowed. Default is [`PostprocessingLevel::Cheap`]. + pub postprocessing_level: PostprocessingLevel, } impl SxTClient { @@ -51,9 +72,16 @@ impl SxTClient { substrate_node_url, sxt_api_key, verifier_setup, + postprocessing_level: PostprocessingLevel::Cheap, } } + /// Set the level of postprocessing allowed + pub fn with_postprocessing(mut self, postprocessing_level: PostprocessingLevel) -> Self { + self.postprocessing_level = postprocessing_level; + self + } + /// Query and verify a SQL query /// /// Run a SQL query and verify the result using Dynamic Dory. @@ -117,6 +145,22 @@ impl SxTClient { let owned_table_result = proof .verify(proof_plan, &accessor, &serialized_result, &&verifier_setup)? .table; - Ok(owned_table_result) + // Apply postprocessing steps + let postprocessing = query_expr.postprocessing(); + let is_postprocessing_expensive = postprocessing.iter().any(|step| { + matches!( + step, + OwnedTablePostprocessing::Slice(_) | OwnedTablePostprocessing::GroupBy(_) + ) + }); + match (self.postprocessing_level, postprocessing.len(), is_postprocessing_expensive) { + (_, 0, false) => Ok(owned_table_result), + (PostprocessingLevel::All, _, _) | (PostprocessingLevel::Cheap, _, false) => { + let transformed_result: OwnedTable = + apply_postprocessing_steps(owned_table_result, postprocessing)?; + Ok(transformed_result) + } + _ => Err("Required postprocessing is not allowed. Please examine your query or change `PostprocessingLevel` using `SxTClient::with_postprocessing`".into()), + } } } diff --git a/sdk/src/lib.rs b/src/lib.rs similarity index 68% rename from sdk/src/lib.rs rename to src/lib.rs index e06f226..61f9662 100644 --- a/sdk/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,7 @@ -mod args; -pub use args::SdkArgs; mod auth; pub use auth::get_access_token; mod client; -pub use client::SxTClient; +pub use client::{PostprocessingLevel, SxTClient}; mod substrate; pub use substrate::query_commitments; mod sxt_chain_runtime; diff --git a/sdk/src/substrate.rs b/src/substrate.rs similarity index 99% rename from sdk/src/substrate.rs rename to src/substrate.rs index 102e795..4b0d463 100644 --- a/sdk/src/substrate.rs +++ b/src/substrate.rs @@ -50,7 +50,7 @@ pub async fn query_commitments( let table_id = resource_id_to_table_id(&id); let commitments_query = storage() .commitments() - .commitment_storage_map(&table_id, &CommitmentScheme::Dory); + .commitment_storage_map(&table_id, &CommitmentScheme::DynamicDory); let table_commitment_bytes: TableCommitmentBytes = api .storage() .at_latest() diff --git a/sdk/src/sxt_chain_runtime.rs b/src/sxt_chain_runtime.rs similarity index 96% rename from sdk/src/sxt_chain_runtime.rs rename to src/sxt_chain_runtime.rs index 5260ac8..f1f6f88 100644 --- a/sdk/src/sxt_chain_runtime.rs +++ b/src/sxt_chain_runtime.rs @@ -1,4 +1,4 @@ -#[allow(dead_code, unused_imports, non_camel_case_types)] +#[allow(dead_code, unused_imports, non_camel_case_types, unreachable_patterns)] #[allow(clippy::all)] #[allow(rustdoc::broken_intra_doc_links)] pub mod api { @@ -34,13 +34,13 @@ pub mod api { "TransactionPaymentCallApi", "GenesisBuilder", ]; - #[doc = r" The error type returned when there is a runtime issue."] + #[doc = r" The error type that is returned when there is a runtime issue."] pub type DispatchError = runtime_types::sp_runtime::DispatchError; #[doc = r" The outer event enum."] pub type Event = runtime_types::sxt_runtime::RuntimeEvent; #[doc = r" The outer extrinsic enum."] pub type Call = runtime_types::sxt_runtime::RuntimeCall; - #[doc = r" The outer error enum representing the DispatchError's Module variant."] + #[doc = r" The outer error enum represents the DispatchError's Module variant."] pub type Error = runtime_types::sxt_runtime::RuntimeError; pub fn constants() -> ConstantsApi { ConstantsApi @@ -182,6 +182,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -205,6 +206,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -231,6 +233,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -327,6 +330,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -351,6 +355,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -376,6 +381,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -490,6 +496,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -516,6 +523,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -539,6 +547,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -565,6 +574,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -637,6 +647,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -694,6 +705,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -767,6 +779,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -791,6 +804,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -874,6 +888,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -905,6 +920,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1055,6 +1071,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1083,6 +1100,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1113,6 +1131,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1138,6 +1157,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1191,6 +1211,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1306,6 +1327,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1336,6 +1358,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1362,6 +1385,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1387,6 +1411,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1416,10 +1441,10 @@ pub mod api { "query_call_info", types::QueryCallInfo { call, len }, [ - 71u8, 171u8, 240u8, 225u8, 162u8, 9u8, 33u8, 142u8, 188u8, 238u8, - 237u8, 122u8, 188u8, 203u8, 140u8, 142u8, 62u8, 184u8, 45u8, 52u8, - 212u8, 234u8, 14u8, 144u8, 195u8, 178u8, 161u8, 58u8, 172u8, 27u8, - 205u8, 236u8, + 31u8, 193u8, 192u8, 150u8, 123u8, 94u8, 210u8, 18u8, 148u8, 65u8, + 233u8, 133u8, 77u8, 48u8, 101u8, 212u8, 236u8, 16u8, 219u8, 42u8, + 221u8, 179u8, 217u8, 229u8, 180u8, 79u8, 133u8, 23u8, 125u8, 142u8, + 61u8, 26u8, ], ) } @@ -1437,9 +1462,10 @@ pub mod api { "query_call_fee_details", types::QueryCallFeeDetails { call, len }, [ - 147u8, 102u8, 223u8, 213u8, 229u8, 168u8, 156u8, 97u8, 108u8, 57u8, - 95u8, 120u8, 90u8, 215u8, 61u8, 117u8, 45u8, 84u8, 166u8, 187u8, 104u8, - 40u8, 59u8, 214u8, 228u8, 109u8, 79u8, 7u8, 36u8, 13u8, 207u8, 157u8, + 124u8, 177u8, 227u8, 241u8, 25u8, 191u8, 100u8, 185u8, 83u8, 214u8, + 174u8, 75u8, 35u8, 175u8, 46u8, 255u8, 81u8, 65u8, 90u8, 206u8, 100u8, + 231u8, 110u8, 210u8, 119u8, 34u8, 148u8, 218u8, 244u8, 154u8, 12u8, + 211u8, ], ) } @@ -1505,6 +1531,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1535,6 +1562,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1561,6 +1589,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1586,6 +1615,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1707,6 +1737,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1735,6 +1766,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1761,6 +1793,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1875,9 +1908,9 @@ pub mod api { .hash(); runtime_metadata_hash == [ - 254u8, 6u8, 242u8, 241u8, 79u8, 16u8, 62u8, 211u8, 117u8, 26u8, 36u8, 233u8, 39u8, - 24u8, 46u8, 252u8, 253u8, 97u8, 199u8, 196u8, 12u8, 106u8, 39u8, 44u8, 60u8, 48u8, - 227u8, 62u8, 124u8, 250u8, 170u8, 159u8, + 107u8, 158u8, 146u8, 35u8, 208u8, 129u8, 35u8, 224u8, 13u8, 192u8, 225u8, 67u8, + 122u8, 189u8, 128u8, 58u8, 191u8, 243u8, 64u8, 57u8, 147u8, 111u8, 7u8, 172u8, + 109u8, 218u8, 91u8, 0u8, 95u8, 139u8, 152u8, 156u8, ] } pub mod system { @@ -1899,6 +1932,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1928,6 +1962,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1954,6 +1989,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -1981,6 +2017,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2011,6 +2048,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2040,6 +2078,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2068,6 +2107,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2100,6 +2140,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2127,6 +2168,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2156,6 +2198,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2189,6 +2232,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -2457,6 +2501,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "An extrinsic completed successfully."] @@ -2479,6 +2524,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "An extrinsic failed."] @@ -2503,6 +2549,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "`:code` was updated."] @@ -2519,6 +2566,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "A new account was created."] @@ -2541,6 +2589,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "An account was reaped."] @@ -2563,6 +2612,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "On on-chain remark happened."] @@ -2587,6 +2637,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "An upgrade was authorized."] @@ -3016,10 +3067,9 @@ pub mod api { "Events", (), [ - 183u8, 209u8, 107u8, 114u8, 59u8, 49u8, 222u8, 55u8, 79u8, 251u8, - 151u8, 59u8, 186u8, 209u8, 186u8, 91u8, 169u8, 23u8, 154u8, 162u8, - 165u8, 102u8, 223u8, 158u8, 97u8, 63u8, 175u8, 0u8, 17u8, 186u8, 165u8, - 24u8, + 179u8, 124u8, 24u8, 183u8, 126u8, 25u8, 165u8, 146u8, 72u8, 120u8, + 71u8, 188u8, 73u8, 89u8, 23u8, 209u8, 152u8, 128u8, 21u8, 94u8, 16u8, + 108u8, 21u8, 39u8, 129u8, 2u8, 9u8, 67u8, 219u8, 244u8, 115u8, 58u8, ], ) } @@ -3346,6 +3396,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -3629,6 +3680,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -3666,6 +3718,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -3708,6 +3761,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -3847,6 +3901,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "New authority set has been applied."] @@ -3872,6 +3927,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Current authority set has been paused."] @@ -3888,6 +3944,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Current authority set has been resumed."] @@ -4218,6 +4275,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4256,6 +4314,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4294,6 +4353,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4331,6 +4391,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4376,6 +4437,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4409,6 +4471,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4444,6 +4507,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4478,6 +4542,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4511,6 +4576,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -4772,6 +4838,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "An account was created with some free balance."] @@ -4796,6 +4863,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "An account was removed whose balance was non-zero but below ExistentialDeposit,"] @@ -4821,6 +4889,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Transfer succeeded."] @@ -4847,6 +4916,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "A balance was set by root."] @@ -4871,6 +4941,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some balance was reserved (moved from free to reserved)."] @@ -4895,6 +4966,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some balance was unreserved (moved from reserved to free)."] @@ -4919,6 +4991,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some balance was moved from the reserve of the first account to the second account."] @@ -4949,6 +5022,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some amount was deposited (e.g. for transaction fees)."] @@ -4973,6 +5047,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some amount was withdrawn from the account (e.g. for transaction fees)."] @@ -4997,6 +5072,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some amount was removed from the account (e.g. for misbehavior)."] @@ -5021,6 +5097,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some amount was minted into an account."] @@ -5045,6 +5122,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some amount was burned from an account."] @@ -5069,6 +5147,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some amount was suspended from an account (it can be restored later)."] @@ -5093,6 +5172,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some amount was restored into an account."] @@ -5117,6 +5197,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "An account was upgraded."] @@ -5139,6 +5220,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Total issuance was increased by `amount`, creating a credit to be balanced."] @@ -5161,6 +5243,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Total issuance was decreased by `amount`, creating a debt to be balanced."] @@ -5183,6 +5266,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some balance was locked."] @@ -5207,6 +5291,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some balance was unlocked."] @@ -5231,6 +5316,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some balance was frozen."] @@ -5255,6 +5341,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Some balance was thawed."] @@ -5279,6 +5366,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "The `TotalIssuance` was forcefully changed."] @@ -5793,6 +5881,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "A transaction fee `actual_fee`, of which `tip` was added to the minimum inclusion fee,"] @@ -5936,6 +6025,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -5962,6 +6052,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -5995,6 +6086,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6025,6 +6117,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6059,6 +6152,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6089,9 +6183,10 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 233u8, 28u8, 3u8, 66u8, 229u8, 154u8, 169u8, 11u8, 176u8, 221u8, 177u8, - 110u8, 121u8, 183u8, 161u8, 105u8, 236u8, 85u8, 112u8, 84u8, 106u8, - 61u8, 185u8, 196u8, 224u8, 0u8, 177u8, 89u8, 155u8, 92u8, 194u8, 192u8, + 121u8, 108u8, 175u8, 85u8, 201u8, 197u8, 89u8, 129u8, 221u8, 240u8, + 29u8, 162u8, 174u8, 216u8, 24u8, 247u8, 110u8, 44u8, 93u8, 238u8, 88u8, + 238u8, 214u8, 120u8, 117u8, 130u8, 241u8, 100u8, 176u8, 188u8, 9u8, + 178u8, ], ) } @@ -6114,9 +6209,10 @@ pub mod api { weight, }, [ - 12u8, 243u8, 153u8, 74u8, 134u8, 197u8, 248u8, 172u8, 15u8, 205u8, - 253u8, 77u8, 146u8, 3u8, 156u8, 232u8, 52u8, 37u8, 28u8, 176u8, 56u8, - 163u8, 83u8, 223u8, 14u8, 0u8, 250u8, 246u8, 72u8, 69u8, 87u8, 79u8, + 28u8, 103u8, 180u8, 200u8, 98u8, 83u8, 110u8, 252u8, 126u8, 67u8, + 206u8, 121u8, 157u8, 176u8, 42u8, 217u8, 49u8, 136u8, 130u8, 152u8, + 189u8, 53u8, 206u8, 128u8, 19u8, 193u8, 59u8, 136u8, 97u8, 136u8, + 117u8, 166u8, ], ) } @@ -6156,9 +6252,10 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 61u8, 123u8, 73u8, 63u8, 140u8, 112u8, 252u8, 31u8, 188u8, 65u8, 85u8, - 222u8, 30u8, 223u8, 83u8, 178u8, 126u8, 219u8, 65u8, 9u8, 172u8, 5u8, - 61u8, 219u8, 242u8, 20u8, 142u8, 6u8, 84u8, 178u8, 121u8, 145u8, + 172u8, 38u8, 215u8, 159u8, 53u8, 125u8, 226u8, 67u8, 122u8, 63u8, + 212u8, 168u8, 201u8, 233u8, 17u8, 167u8, 204u8, 229u8, 158u8, 132u8, + 234u8, 139u8, 241u8, 55u8, 23u8, 80u8, 172u8, 74u8, 131u8, 212u8, 62u8, + 81u8, ], ) } @@ -6195,6 +6292,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "A sudo call just took place."] @@ -6218,6 +6316,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "The sudo key has been updated."] @@ -6242,6 +6341,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "The key was permanently removed."] @@ -6258,6 +6358,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "A [sudo_as](Pallet::sudo_as) call just took place."] @@ -6346,6 +6447,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6376,6 +6478,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6475,6 +6578,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "A user has successfully set a new value."] @@ -6550,6 +6654,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6582,6 +6687,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6655,6 +6761,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "The permissions for this account id were updated"] @@ -6757,6 +6864,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6791,6 +6899,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -6811,6 +6920,49 @@ pub mod api { const PALLET: &'static str = "Tables"; const CALL: &'static str = "create_tables_with_snapshot_and_commitment"; } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "Clear schemas and tables from chain state for all namespaces and identifiers"] + pub struct ClearTables; + impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for ClearTables { + const PALLET: &'static str = "Tables"; + const CALL: &'static str = "clear_tables"; + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "Attempts to recreate all tables stored in the genesis, but does not start loading from"] + #[doc = "snapshot"] + pub struct CreateEmptyGenesisTables; + impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for CreateEmptyGenesisTables { + const PALLET: &'static str = "Tables"; + const CALL: &'static str = "create_empty_genesis_tables"; + } } pub struct TransactionApi; impl TransactionApi { @@ -6851,10 +7003,45 @@ pub mod api { tables, }, [ - 184u8, 9u8, 153u8, 87u8, 182u8, 139u8, 192u8, 35u8, 192u8, 253u8, - 150u8, 154u8, 174u8, 102u8, 70u8, 203u8, 62u8, 47u8, 202u8, 97u8, 19u8, - 85u8, 159u8, 160u8, 124u8, 215u8, 160u8, 245u8, 198u8, 146u8, 0u8, - 246u8, + 105u8, 2u8, 154u8, 98u8, 230u8, 183u8, 121u8, 239u8, 132u8, 71u8, 77u8, + 196u8, 185u8, 162u8, 158u8, 70u8, 51u8, 229u8, 69u8, 166u8, 100u8, + 207u8, 170u8, 167u8, 85u8, 95u8, 169u8, 142u8, 69u8, 65u8, 132u8, + 204u8, + ], + ) + } + #[doc = "Clear schemas and tables from chain state for all namespaces and identifiers"] + pub fn clear_tables( + &self, + ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload + { + ::subxt::ext::subxt_core::tx::payload::StaticPayload::new_static( + "Tables", + "clear_tables", + types::ClearTables {}, + [ + 123u8, 107u8, 124u8, 78u8, 63u8, 175u8, 84u8, 52u8, 114u8, 22u8, 231u8, + 91u8, 130u8, 192u8, 178u8, 220u8, 209u8, 153u8, 48u8, 232u8, 125u8, + 155u8, 30u8, 155u8, 13u8, 196u8, 143u8, 20u8, 60u8, 192u8, 58u8, 6u8, + ], + ) + } + #[doc = "Attempts to recreate all tables stored in the genesis, but does not start loading from"] + #[doc = "snapshot"] + pub fn create_empty_genesis_tables( + &self, + ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload< + types::CreateEmptyGenesisTables, + > { + ::subxt::ext::subxt_core::tx::payload::StaticPayload::new_static( + "Tables", + "create_empty_genesis_tables", + types::CreateEmptyGenesisTables {}, + [ + 244u8, 105u8, 207u8, 169u8, 123u8, 107u8, 178u8, 208u8, 224u8, 130u8, + 151u8, 117u8, 110u8, 38u8, 198u8, 112u8, 84u8, 31u8, 255u8, 85u8, + 248u8, 24u8, 11u8, 136u8, 186u8, 177u8, 124u8, 252u8, 10u8, 250u8, 7u8, + 166u8, ], ) } @@ -6872,6 +7059,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "The schema for a table has been updated"] @@ -6898,17 +7086,18 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "Tables have been created with known commitments"] - pub struct TablesCreatedWithCommitments( - pub tables_created_with_commitments::Field0, - pub tables_created_with_commitments::Field1, - ); + pub struct TablesCreatedWithCommitments { + pub source_and_mode: tables_created_with_commitments::SourceAndMode, + pub table_list: tables_created_with_commitments::TableList, + } pub mod tables_created_with_commitments { use super::runtime_types; - pub type Field0 = runtime_types::sxt_core::tables::SourceAndMode; - pub type Field1 = runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > , runtime_types :: proof_of_sql_commitment_map :: commitment_scheme :: PerCommitmentScheme < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: OptionType < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: ConcreteType < runtime_types :: proof_of_sql_commitment_map :: commitment_storage_map :: TableCommitmentBytes > > > , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > ; + pub type SourceAndMode = runtime_types::sxt_core::tables::SourceAndMode; + pub type TableList = runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > , runtime_types :: proof_of_sql_commitment_map :: commitment_scheme :: PerCommitmentScheme < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: OptionType < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: ConcreteType < runtime_types :: proof_of_sql_commitment_map :: commitment_storage_map :: TableCommitmentBytes > > > , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > ; } impl ::subxt::ext::subxt_core::events::StaticEvent for TablesCreatedWithCommitments { const PALLET: &'static str = "Tables"; @@ -6925,6 +7114,11 @@ pub mod api { pub type Param0 = runtime_types::sxt_core::tables::Source; pub type Param1 = runtime_types::sxt_core::tables::IndexerMode; } + pub mod genesis_tables { + use super::runtime_types; + pub type GenesisTables = runtime_types::sxt_core::tables::GenesisTableList; + pub type Param0 = runtime_types::sxt_core::tables::SourceAndMode; + } pub mod schemas { use super::runtime_types; pub type Schemas = runtime_types::bounded_collections::bounded_vec::BoundedVec< @@ -7035,6 +7229,53 @@ pub mod api { ], ) } + pub fn genesis_tables_iter( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::genesis_tables::GenesisTables, + (), + (), + ::subxt::ext::subxt_core::utils::Yes, + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Tables", + "GenesisTables", + (), + [ + 3u8, 209u8, 217u8, 231u8, 136u8, 88u8, 83u8, 16u8, 213u8, 43u8, 72u8, + 194u8, 255u8, 190u8, 125u8, 252u8, 220u8, 222u8, 74u8, 151u8, 182u8, + 112u8, 6u8, 89u8, 197u8, 119u8, 108u8, 253u8, 196u8, 226u8, 151u8, + 140u8, + ], + ) + } + pub fn genesis_tables( + &self, + _0: impl ::core::borrow::Borrow, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + ::subxt::ext::subxt_core::storage::address::StaticStorageKey< + types::genesis_tables::Param0, + >, + types::genesis_tables::GenesisTables, + ::subxt::ext::subxt_core::utils::Yes, + (), + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Tables", + "GenesisTables", + ::subxt::ext::subxt_core::storage::address::StaticStorageKey::new( + _0.borrow(), + ), + [ + 3u8, 209u8, 217u8, 231u8, 136u8, 88u8, 83u8, 16u8, 213u8, 43u8, 72u8, + 194u8, 255u8, 190u8, 125u8, 252u8, 220u8, 222u8, 74u8, 151u8, 182u8, + 112u8, 6u8, 89u8, 197u8, 119u8, 108u8, 253u8, 196u8, 226u8, 151u8, + 140u8, + ], + ) + } pub fn schemas_iter( &self, ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< @@ -7183,6 +7424,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7251,6 +7493,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "This event is emitted every time data is submitted by an indexer."] @@ -7278,6 +7521,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] #[doc = "This event is emitted when a quorum is reached amongst submissions and the"] @@ -7486,11 +7730,6 @@ pub mod api { pub type Param0 = runtime_types::sxt_core::tables::TableIdentifier; pub type Param1 = runtime_types :: proof_of_sql_commitment_map :: commitment_scheme :: CommitmentScheme ; } - pub mod stored_public_parameters { - use super::runtime_types; - pub type StoredPublicParameters = - runtime_types::sxt_core::commitments::PublicParametersBytes; - } pub mod default_commitment_schemes { use super::runtime_types; pub type DefaultCommitmentSchemes = runtime_types :: proof_of_sql_commitment_map :: commitment_scheme :: CommitmentSchemeFlags ; @@ -7513,9 +7752,10 @@ pub mod api { "CommitmentStorageMap", (), [ - 105u8, 72u8, 0u8, 32u8, 172u8, 20u8, 52u8, 253u8, 15u8, 22u8, 29u8, - 150u8, 22u8, 15u8, 250u8, 117u8, 42u8, 65u8, 206u8, 36u8, 87u8, 110u8, - 141u8, 24u8, 154u8, 208u8, 83u8, 213u8, 138u8, 34u8, 160u8, 145u8, + 86u8, 192u8, 207u8, 246u8, 148u8, 237u8, 137u8, 43u8, 159u8, 125u8, + 100u8, 195u8, 104u8, 180u8, 108u8, 149u8, 183u8, 44u8, 161u8, 35u8, + 56u8, 246u8, 69u8, 210u8, 199u8, 139u8, 154u8, 235u8, 92u8, 148u8, + 138u8, 42u8, ], ) } @@ -7539,9 +7779,10 @@ pub mod api { _0.borrow(), ), [ - 105u8, 72u8, 0u8, 32u8, 172u8, 20u8, 52u8, 253u8, 15u8, 22u8, 29u8, - 150u8, 22u8, 15u8, 250u8, 117u8, 42u8, 65u8, 206u8, 36u8, 87u8, 110u8, - 141u8, 24u8, 154u8, 208u8, 83u8, 213u8, 138u8, 34u8, 160u8, 145u8, + 86u8, 192u8, 207u8, 246u8, 148u8, 237u8, 137u8, 43u8, 159u8, 125u8, + 100u8, 195u8, 104u8, 180u8, 108u8, 149u8, 183u8, 44u8, 161u8, 35u8, + 56u8, 246u8, 69u8, 210u8, 199u8, 139u8, 154u8, 235u8, 92u8, 148u8, + 138u8, 42u8, ], ) } @@ -7576,30 +7817,10 @@ pub mod api { ), ), [ - 105u8, 72u8, 0u8, 32u8, 172u8, 20u8, 52u8, 253u8, 15u8, 22u8, 29u8, - 150u8, 22u8, 15u8, 250u8, 117u8, 42u8, 65u8, 206u8, 36u8, 87u8, 110u8, - 141u8, 24u8, 154u8, 208u8, 83u8, 213u8, 138u8, 34u8, 160u8, 145u8, - ], - ) - } - #[doc = " Proof of sql public parameters storage."] - pub fn stored_public_parameters( - &self, - ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< - (), - types::stored_public_parameters::StoredPublicParameters, - ::subxt::ext::subxt_core::utils::Yes, - (), - (), - > { - ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( - "Commitments", - "StoredPublicParameters", - (), - [ - 96u8, 104u8, 7u8, 248u8, 218u8, 40u8, 235u8, 187u8, 41u8, 106u8, 153u8, - 170u8, 55u8, 33u8, 192u8, 189u8, 220u8, 205u8, 167u8, 35u8, 5u8, 223u8, - 88u8, 61u8, 253u8, 39u8, 18u8, 193u8, 59u8, 190u8, 236u8, 174u8, + 86u8, 192u8, 207u8, 246u8, 148u8, 237u8, 137u8, 43u8, 159u8, 125u8, + 100u8, 195u8, 104u8, 180u8, 108u8, 149u8, 183u8, 44u8, 161u8, 35u8, + 56u8, 246u8, 69u8, 210u8, 199u8, 139u8, 154u8, 235u8, 92u8, 148u8, + 138u8, 42u8, ], ) } @@ -7618,9 +7839,9 @@ pub mod api { "DefaultCommitmentSchemes", (), [ - 20u8, 77u8, 203u8, 254u8, 27u8, 52u8, 134u8, 198u8, 49u8, 40u8, 88u8, - 241u8, 18u8, 71u8, 80u8, 114u8, 120u8, 255u8, 239u8, 78u8, 8u8, 134u8, - 112u8, 171u8, 14u8, 86u8, 114u8, 89u8, 92u8, 133u8, 248u8, 66u8, + 107u8, 56u8, 234u8, 43u8, 253u8, 96u8, 181u8, 8u8, 24u8, 137u8, 246u8, + 176u8, 162u8, 174u8, 107u8, 175u8, 41u8, 35u8, 58u8, 123u8, 206u8, + 16u8, 150u8, 210u8, 218u8, 70u8, 133u8, 29u8, 111u8, 56u8, 149u8, 67u8, ], ) } @@ -7641,6 +7862,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7659,6 +7881,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7678,6 +7901,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct Equivocation<_0, _1, _2> { @@ -7694,6 +7918,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct Precommit<_0, _1> { @@ -7708,6 +7933,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct Prevote<_0, _1> { @@ -7727,6 +7953,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7749,6 +7976,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7768,6 +7996,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7788,6 +8017,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7814,6 +8044,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7834,6 +8065,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7862,6 +8094,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7880,6 +8113,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7898,6 +8132,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7916,6 +8151,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7934,6 +8170,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7952,6 +8189,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7970,6 +8208,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -7989,6 +8228,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8008,6 +8248,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8029,6 +8270,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8055,6 +8297,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8157,6 +8400,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8205,6 +8449,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8259,6 +8504,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct AccountInfo<_0, _1> { @@ -8276,6 +8522,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct CodeUpgradeAuthorization { @@ -8290,6 +8537,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct EventRecord<_0, _1> { @@ -8305,6 +8553,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct LastRuntimeUpgradeInfo { @@ -8320,6 +8569,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum Phase { @@ -8343,6 +8593,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8490,6 +8741,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8543,6 +8795,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8694,6 +8947,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8714,6 +8968,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8734,6 +8989,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8754,6 +9010,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8769,6 +9026,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8791,6 +9049,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8815,6 +9074,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8824,69 +9084,66 @@ pub mod api { #[doc = "The errors that can occur within this pallet."] pub enum Error { #[codec(index = 0)] - #[doc = "Failed to deserialize proof-of-sql public parameters from storage."] - DeserializePublicParameters, - #[codec(index = 1)] #[doc = "Proof-of-sql commitment has too many columns."] CommitmentWithTooManyColumns, - #[codec(index = 2)] + #[codec(index = 1)] #[doc = "Failed to serialize proof-of-sql commitment."] SerializeCommitment, - #[codec(index = 3)] + #[codec(index = 2)] #[doc = "Failed to deserialize proof-of-sql commitment."] DeserializeCommitment, - #[codec(index = 4)] + #[codec(index = 3)] #[doc = "Snapshot commitments don't match table definition."] InappropriateSnapshotCommitments, - #[codec(index = 5)] + #[codec(index = 4)] #[doc = "Table must have at least one column."] CreateTableWithNoColumns, - #[codec(index = 6)] + #[codec(index = 5)] #[doc = "Table has invalid identifier."] CreateTableWithInvalidIdentifier, - #[codec(index = 7)] + #[codec(index = 6)] #[doc = "Table has duplicate identifiers."] CreateTableWithDuplicateIdentifiers, - #[codec(index = 8)] + #[codec(index = 7)] #[doc = "Table uses reserved metadata prefix."] CreateTableWithReservedMetadataPrefix, - #[codec(index = 9)] + #[codec(index = 8)] #[doc = "Timestamp column precision should be 0, 3, or 6."] TimestampColumnWithInvalidPrecision, - #[codec(index = 10)] - #[doc = "Timestamp columns should be timestamp-aware."] - TimestampColumnWithoutTimezone, - #[codec(index = 11)] + #[codec(index = 9)] #[doc = "Decimal/numeric columns should have constrained precision and scale."] DecimalColumnWithoutPrecision, - #[codec(index = 12)] + #[codec(index = 10)] #[doc = "Decimal/numeric columns should have precision between 1 and 75."] DecimalColumnWithInvalidPrecision, - #[codec(index = 13)] + #[codec(index = 11)] #[doc = "Decimal/numeric columns should have scale between 0 and 127."] DecimalColumnWithInvalidScale, - #[codec(index = 14)] + #[codec(index = 12)] #[doc = "Column type not supported."] ColumnWithUnsupportedDataType, - #[codec(index = 15)] + #[codec(index = 13)] #[doc = "Column should be NOT NULL."] ColumnWithoutNotNull, - #[codec(index = 16)] + #[codec(index = 14)] #[doc = "Column option not supported."] ColumnWithUnsupportedOption, - #[codec(index = 17)] + #[codec(index = 15)] #[doc = "Existing commitments of different schemes don't agree on table range."] ExistingCommitmentsRangeMismatch, - #[codec(index = 18)] + #[codec(index = 16)] + #[doc = "Existing commitments of different schemes don't agree on column order."] + ExistingCommitmentsColumnOrderMismatch, + #[codec(index = 17)] #[doc = "Cannot update table with no existing commitments."] NoExistingCommitments, - #[codec(index = 19)] + #[codec(index = 18)] #[doc = "Insert data contains values out of bounds of scalar field."] InsertDataOutOfBounds, - #[codec(index = 20)] + #[codec(index = 19)] #[doc = "Insert data does not match existing commitments."] InsertDataDoesntMatchExistingCommitments, - #[codec(index = 21)] + #[codec(index = 20)] #[doc = "Table identifier already exists in commitment storage."] TableAlreadyExists, } @@ -8904,6 +9161,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -8971,6 +9229,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9011,6 +9270,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9043,6 +9303,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct StoredPendingChange<_0> { @@ -9063,6 +9324,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum StoredState<_0> { @@ -9088,6 +9350,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9117,6 +9380,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9152,6 +9416,9 @@ pub mod api { #[codec(index = 8)] #[doc = "Error deserializing the table as an OnChainTable"] TableDeserializationError, + #[codec(index = 9)] + #[doc = "Error deserializing the table as an OnChainTable"] + TableSerializationError, } #[derive( :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, @@ -9161,6 +9428,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9205,6 +9473,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9236,6 +9505,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9265,6 +9535,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9296,6 +9567,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9360,6 +9632,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9380,6 +9653,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9424,6 +9698,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9432,7 +9707,7 @@ pub mod api { )] #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] pub enum Call { - # [codec (index = 0)] # [doc = "TODO: add docs"] update_tables { source_and_mode : runtime_types :: sxt_core :: tables :: SourceAndMode , tables : runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > , } , # [codec (index = 1)] # [doc = "Create tables with a known commit and snapshot url from which data can be loaded"] create_tables_with_snapshot_and_commitment { source_and_mode : runtime_types :: sxt_core :: tables :: SourceAndMode , tables : runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > , runtime_types :: proof_of_sql_commitment_map :: commitment_scheme :: PerCommitmentScheme < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: OptionType < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: ConcreteType < runtime_types :: proof_of_sql_commitment_map :: commitment_storage_map :: TableCommitmentBytes > > > , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > , } , } + # [codec (index = 0)] # [doc = "TODO: add docs"] update_tables { source_and_mode : runtime_types :: sxt_core :: tables :: SourceAndMode , tables : runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > , } , # [codec (index = 1)] # [doc = "Create tables with a known commit and snapshot url from which data can be loaded"] create_tables_with_snapshot_and_commitment { source_and_mode : runtime_types :: sxt_core :: tables :: SourceAndMode , tables : runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > , runtime_types :: proof_of_sql_commitment_map :: commitment_scheme :: PerCommitmentScheme < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: OptionType < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: ConcreteType < runtime_types :: proof_of_sql_commitment_map :: commitment_storage_map :: TableCommitmentBytes > > > , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > , } , # [codec (index = 3)] # [doc = "Clear schemas and tables from chain state for all namespaces and identifiers"] clear_tables , # [codec (index = 2)] # [doc = "Attempts to recreate all tables stored in the genesis, but does not start loading from"] # [doc = "snapshot"] create_empty_genesis_tables , } #[derive( :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, @@ -9441,6 +9716,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9455,6 +9731,15 @@ pub mod api { #[codec(index = 1)] #[doc = "Existing commit for this table identifier"] IdentifierAlreadyExists, + #[codec(index = 2)] + #[doc = "Failed to parse Create Statement DDL"] + CreateStatementParseError, + #[codec(index = 3)] + #[doc = "Not all schemas were removed"] + NotAllSchemasRemovedError, + #[codec(index = 4)] + #[doc = "Not all commitments were removed"] + NotAllCommitmentsRemovedError, } #[derive( :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, @@ -9464,6 +9749,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9472,7 +9758,7 @@ pub mod api { )] #[doc = "The `Event` enum of this pallet"] pub enum Event { - # [codec (index = 0)] # [doc = "The schema for a table has been updated"] SchemaUpdated (runtime_types :: sxt_core :: tables :: SourceAndMode , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > ,) , # [codec (index = 1)] # [doc = "Tables have been created with known commitments"] TablesCreatedWithCommitments (runtime_types :: sxt_core :: tables :: SourceAndMode , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > , runtime_types :: proof_of_sql_commitment_map :: commitment_scheme :: PerCommitmentScheme < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: OptionType < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: ConcreteType < runtime_types :: proof_of_sql_commitment_map :: commitment_storage_map :: TableCommitmentBytes > > > , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > ,) , } + # [codec (index = 0)] # [doc = "The schema for a table has been updated"] SchemaUpdated (runtime_types :: sxt_core :: tables :: SourceAndMode , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > ,) , # [codec (index = 1)] # [doc = "Tables have been created with known commitments"] TablesCreatedWithCommitments { source_and_mode : runtime_types :: sxt_core :: tables :: SourceAndMode , table_list : runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < (runtime_types :: sxt_core :: tables :: TableIdentifier , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > , runtime_types :: proof_of_sql_commitment_map :: commitment_scheme :: PerCommitmentScheme < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: OptionType < runtime_types :: proof_of_sql_commitment_map :: generic_over_commitment :: ConcreteType < runtime_types :: proof_of_sql_commitment_map :: commitment_storage_map :: TableCommitmentBytes > > > , runtime_types :: bounded_collections :: bounded_vec :: BoundedVec < :: core :: primitive :: u8 > ,) > , } , } } } pub mod pallet_template { @@ -9487,6 +9773,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9537,6 +9824,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9567,6 +9855,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9605,6 +9894,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9652,6 +9942,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9680,6 +9971,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9700,6 +9992,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9719,6 +10012,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9739,6 +10033,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct ChargeTransactionPayment(#[codec(compact)] pub ::core::primitive::u128); @@ -9750,6 +10045,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum Releases { @@ -9769,6 +10065,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct U256(pub [::core::primitive::u64; 4usize]); @@ -9785,6 +10082,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9795,7 +10093,7 @@ pub mod api { #[codec(index = 0)] Ipa, #[codec(index = 1)] - Dory, + DynamicDory, } #[derive( :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, @@ -9805,6 +10103,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9813,7 +10112,7 @@ pub mod api { )] pub struct CommitmentSchemeFlags { pub ipa: ::core::primitive::bool, - pub dory: ::core::primitive::bool, + pub dynamic_dory: ::core::primitive::bool, } #[derive( :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, @@ -9823,13 +10122,14 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] #[encode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" )] - pub struct PerCommitmentScheme < _0 > { pub ipa : :: core :: option :: Option < runtime_types :: proof_of_sql_commitment_map :: commitment_storage_map :: TableCommitmentBytes > , pub dory : :: core :: option :: Option < runtime_types :: proof_of_sql_commitment_map :: commitment_storage_map :: TableCommitmentBytes > , # [codec (skip)] pub __ignore : :: core :: marker :: PhantomData < _0 > } + pub struct PerCommitmentScheme < _0 > { pub ipa : :: core :: option :: Option < runtime_types :: proof_of_sql_commitment_map :: commitment_storage_map :: TableCommitmentBytes > , pub dynamic_dory : :: core :: option :: Option < runtime_types :: proof_of_sql_commitment_map :: commitment_storage_map :: TableCommitmentBytes > , # [codec (skip)] pub __ignore : :: core :: marker :: PhantomData < _0 > } } pub mod commitment_storage_map { use super::runtime_types; @@ -9841,6 +10141,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9863,6 +10164,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9878,6 +10180,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9900,6 +10203,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9916,6 +10220,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum ArithmeticError { @@ -9941,6 +10246,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9963,6 +10269,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9978,6 +10285,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -9994,6 +10302,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum Equivocation<_0, _1> { @@ -10022,6 +10331,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct EquivocationProof<_0, _1> { @@ -10040,6 +10350,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct Slot(pub ::core::primitive::u64); @@ -10052,6 +10363,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct SlotDuration(pub ::core::primitive::u64); @@ -10068,6 +10380,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10084,6 +10397,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct OpaqueMetadata( @@ -10097,6 +10411,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum Void {} @@ -10111,6 +10426,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct CheckInherentsResult { @@ -10126,6 +10442,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct InherentData { @@ -10149,6 +10466,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10170,6 +10488,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10189,6 +10508,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10227,6 +10547,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10758,6 +11079,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10784,6 +11106,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10822,6 +11145,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10844,6 +11168,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10864,6 +11189,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10886,6 +11212,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -10912,6 +11239,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum DispatchError { @@ -10952,6 +11280,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum ExtrinsicInclusionMode { @@ -10968,6 +11297,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct ModuleError { @@ -10982,6 +11312,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum MultiSignature { @@ -11000,6 +11331,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct OpaqueValue( @@ -11013,6 +11345,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum TokenError { @@ -11045,6 +11378,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum TransactionalError { @@ -11064,6 +11398,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct RuntimeVersion { @@ -11092,6 +11427,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11113,6 +11449,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct RuntimeDbWeight { @@ -11122,28 +11459,6 @@ pub mod api { } pub mod sxt_core { use super::runtime_types; - pub mod commitments { - use super::runtime_types; - #[derive( - :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, - :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, - :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] - #[decode_as_type( - crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" - )] - #[encode_as_type( - crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" - )] - pub struct PublicParametersBytes { - pub data: runtime_types::bounded_collections::bounded_vec::BoundedVec< - ::core::primitive::u8, - >, - } - } pub mod indexing { use super::runtime_types; #[derive( @@ -11154,6 +11469,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11178,6 +11494,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11202,6 +11519,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11222,6 +11540,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11240,6 +11559,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11272,6 +11592,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11295,6 +11616,51 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + pub struct GenesisTable { + pub statement: runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + pub url: runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + pub identifier: runtime_types::sxt_core::tables::TableIdentifier, + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + pub struct GenesisTableList { + pub tables: runtime_types::bounded_collections::bounded_vec::BoundedVec< + runtime_types::sxt_core::tables::GenesisTable, + >, + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: codec :: Decode, + :: subxt :: ext :: subxt_core :: ext :: codec :: Encode, + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11329,6 +11695,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11359,6 +11726,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11377,6 +11745,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type( crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" )] @@ -11403,6 +11772,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct Runtime; @@ -11414,6 +11784,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum RuntimeCall { @@ -11444,6 +11815,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum RuntimeError { @@ -11474,6 +11846,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum RuntimeEvent { @@ -11504,6 +11877,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum RuntimeFreezeReason {} @@ -11515,6 +11889,7 @@ pub mod api { Debug, )] # [codec (crate = :: subxt :: ext :: subxt_core :: ext :: codec)] + #[codec(dumb_trait_bound)] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub enum RuntimeHoldReason {} From ed2fc7092290e9b58f6ac59a3c2780134ac95ed9 Mon Sep 17 00:00:00 2001 From: "dustin.ray" Date: Wed, 20 Nov 2024 15:24:02 -0800 Subject: [PATCH 2/5] fix: update source --- chainlink-functions/example/source.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/chainlink-functions/example/source.js b/chainlink-functions/example/source.js index cc98f96..d349f9a 100644 --- a/chainlink-functions/example/source.js +++ b/chainlink-functions/example/source.js @@ -13,18 +13,15 @@ if (!secrets.apiKey) { throw Error("Missing secret: apiKey"); } -// Step 1: Initialize the SxTProof instance +// Initialize the SxTProof instance const proof = new SxTProof(queryString, commitmentKey, secrets.apiKey); try { - // Step 2: Initialize the wasm module - await proof.init(); - - // Step 3: Verify the proof - const result = await proof.verify(); + // Kick off the proof and await execution + const result = await proof.executeWorkflow(); + console.log("Workflow completed successfully:", result); + return Functions.encodeString("Verified"); } catch (error) { - // Step 4: Handle errors -} - -// Step 5: Final message -return Functions.encodeString("Verified"); + console.log("Workflow failed:"); + return Functions.encodeString("Failed: ", error); +} \ No newline at end of file From 9a244b283461af261475c865a99204206becf53d Mon Sep 17 00:00:00 2001 From: "dustin.ray" Date: Wed, 20 Nov 2024 15:26:03 -0800 Subject: [PATCH 3/5] feat: add source npm package --- chainlink-functions/source/index.js | 643 ++++++++++++++++++++++++++++ 1 file changed, 643 insertions(+) create mode 100644 chainlink-functions/source/index.js diff --git a/chainlink-functions/source/index.js b/chainlink-functions/source/index.js new file mode 100644 index 0000000..3152eb1 --- /dev/null +++ b/chainlink-functions/source/index.js @@ -0,0 +1,643 @@ +// sxt-chain-sdk/index.js + +class SxTProof { + constructor(queryString, commitmentKey, apiKey) { + this.queryString = queryString; + this.commitmentKey = commitmentKey; + this.apiKey = apiKey; + + } + + async executeWorkflow() { + const heap = new Array(128).fill(undefined); + + heap.push(undefined, null, true, false); + + function getObject(idx) { + return heap[idx]; + } + + let heap_next = heap.length; + + function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; + } + + function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; + } + + const cachedTextDecoder = + typeof TextDecoder !== "undefined" + ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) + : { + decode: () => { + throw Error("TextDecoder not available"); + }, + }; + + if (typeof TextDecoder !== "undefined") { + cachedTextDecoder.decode(); + } + + let cachedUint8ArrayMemory0 = null; + + function getUint8ArrayMemory0() { + if ( + cachedUint8ArrayMemory0 === null || + cachedUint8ArrayMemory0.byteLength === 0 + ) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; + } + + function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode( + getUint8ArrayMemory0().subarray(ptr, ptr + len), + ); + } + + function addHeapObject(obj) { + if (heap_next === heap.length) heap.push(heap.length + 1); + const idx = heap_next; + heap_next = heap[idx]; + + heap[idx] = obj; + return idx; + } + + let WASM_VECTOR_LEN = 0; + + const cachedTextEncoder = + typeof TextEncoder !== "undefined" + ? new TextEncoder("utf-8") + : { + encode: () => { + throw Error("TextEncoder not available"); + }, + }; + + const encodeString = function (arg, view) { + return cachedTextEncoder.encodeInto(arg, view); + }; + + function passStringToWasm0(arg, malloc, realloc) { + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8ArrayMemory0() + .subarray(ptr, ptr + buf.length) + .set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } + + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; + + const mem = getUint8ArrayMemory0(); + + let offset = 0; + + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7f) break; + mem[ptr + offset] = code; + } + + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0; + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); + const ret = encodeString(arg, view); + + offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; + } + + WASM_VECTOR_LEN = offset; + return ptr; + } + + function isLikeNone(x) { + return x === undefined || x === null; + } + + let cachedDataViewMemory0 = null; + + function getDataViewMemory0() { + if ( + cachedDataViewMemory0 === null || + cachedDataViewMemory0.buffer.detached === true || + (cachedDataViewMemory0.buffer.detached === undefined && + cachedDataViewMemory0.buffer !== wasm.memory.buffer) + ) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); + } + return cachedDataViewMemory0; + } + + function getArrayJsValueFromWasm0(ptr, len) { + ptr = ptr >>> 0; + const mem = getDataViewMemory0(); + const result = []; + for (let i = ptr; i < ptr + 4 * len; i += 4) { + result.push(takeObject(mem.getUint32(i, true))); + } + return result; + } + + function passArrayJsValueToWasm0(array, malloc) { + const ptr = malloc(array.length * 4, 4) >>> 0; + const mem = getDataViewMemory0(); + for (let i = 0; i < array.length; i++) { + mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true); + } + WASM_VECTOR_LEN = array.length; + return ptr; + } + /** + * @param {string} table_ref + * @returns {string} + */ + function commitment_storage_key_dory(table_ref) { + let deferred3_0; + let deferred3_1; + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0( + table_ref, + wasm.__wbindgen_malloc, + wasm.__wbindgen_realloc, + ); + const len0 = WASM_VECTOR_LEN; + wasm.commitment_storage_key_dory(retptr, ptr0, len0); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); + var ptr2 = r0; + var len2 = r1; + if (r3) { + ptr2 = 0; + len2 = 0; + throw takeObject(r2); + } + deferred3_0 = ptr2; + deferred3_1 = len2; + return getStringFromWasm0(ptr2, len2); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + wasm.__wbindgen_free(deferred3_0, deferred3_1, 1); + } + } + + /** + * @param {string} query + * @param {(TableRefAndCommitment)[]} commitments + * @returns {ProverQueryAndQueryExprAndCommitments} + */ + function plan_prover_query_dory(query, commitments) { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0( + query, + wasm.__wbindgen_malloc, + wasm.__wbindgen_realloc, + ); + const len0 = WASM_VECTOR_LEN; + const ptr1 = passArrayJsValueToWasm0(commitments, wasm.__wbindgen_malloc); + const len1 = WASM_VECTOR_LEN; + wasm.plan_prover_query_dory(retptr, ptr0, len0, ptr1, len1); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); + if (r2) { + throw takeObject(r1); + } + return ProverQueryAndQueryExprAndCommitments.__wrap(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } + } + + /** + * @param {any} prover_response_json + * @param {any} query_expr_json + * @param {(TableRefAndCommitment)[]} commitments + * @returns {any} + */ + function verify_prover_response_dory( + prover_response_json, + query_expr_json, + commitments, + ) { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passArrayJsValueToWasm0(commitments, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + wasm.verify_prover_response_dory( + retptr, + addHeapObject(prover_response_json), + addHeapObject(query_expr_json), + ptr0, + len0, + ); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } + } + + function handleError(f, args) { + try { + return f.apply(this, args); + } catch (e) { + wasm.__wbindgen_exn_store(addHeapObject(e)); + } + } + + const ProverQueryAndQueryExprAndCommitmentsFinalization = + typeof FinalizationRegistry === "undefined" + ? { register: () => { }, unregister: () => { } } + : new FinalizationRegistry((ptr) => + wasm.__wbg_proverqueryandqueryexprandcommitments_free(ptr >>> 0, 1), + ); + + class ProverQueryAndQueryExprAndCommitments { + static __wrap(ptr) { + ptr = ptr >>> 0; + const obj = Object.create(ProverQueryAndQueryExprAndCommitments.prototype); + obj.__wbg_ptr = ptr; + ProverQueryAndQueryExprAndCommitmentsFinalization.register( + obj, + obj.__wbg_ptr, + obj, + ); + return obj; + } + + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + ProverQueryAndQueryExprAndCommitmentsFinalization.unregister(this); + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); + wasm.__wbg_proverqueryandqueryexprandcommitments_free(ptr, 0); + } + /** + * @returns {any} + */ + get prover_query_json() { + const ret = + wasm.__wbg_get_proverqueryandqueryexprandcommitments_prover_query_json( + this.__wbg_ptr, + ); + return takeObject(ret); + } + /** + * @param {any} arg0 + */ + set prover_query_json(arg0) { + wasm.__wbg_set_proverqueryandqueryexprandcommitments_prover_query_json( + this.__wbg_ptr, + addHeapObject(arg0), + ); + } + /** + * @returns {any} + */ + get query_expr_json() { + const ret = + wasm.__wbg_get_proverqueryandqueryexprandcommitments_query_expr_json( + this.__wbg_ptr, + ); + return takeObject(ret); + } + /** + * @param {any} arg0 + */ + set query_expr_json(arg0) { + wasm.__wbg_set_proverqueryandqueryexprandcommitments_query_expr_json( + this.__wbg_ptr, + addHeapObject(arg0), + ); + } + /** + * @returns {(TableRefAndCommitment)[]} + */ + get commitments() { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.__wbg_get_proverqueryandqueryexprandcommitments_commitments( + retptr, + this.__wbg_ptr, + ); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + var v1 = getArrayJsValueFromWasm0(r0, r1).slice(); + wasm.__wbindgen_free(r0, r1 * 4, 4); + return v1; + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } + } + /** + * @param {(TableRefAndCommitment)[]} arg0 + */ + set commitments(arg0) { + const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + wasm.__wbg_set_proverqueryandqueryexprandcommitments_commitments( + this.__wbg_ptr, + ptr0, + len0, + ); + } + } + + const TableRefAndCommitmentFinalization = + typeof FinalizationRegistry === "undefined" + ? { register: () => { }, unregister: () => { } } + : new FinalizationRegistry((ptr) => + wasm.__wbg_tablerefandcommitment_free(ptr >>> 0, 1), + ); + + class TableRefAndCommitment { + static __wrap(ptr) { + ptr = ptr >>> 0; + const obj = Object.create(TableRefAndCommitment.prototype); + obj.__wbg_ptr = ptr; + TableRefAndCommitmentFinalization.register(obj, obj.__wbg_ptr, obj); + return obj; + } + + static __unwrap(jsValue) { + if (!(jsValue instanceof TableRefAndCommitment)) { + return 0; + } + return jsValue.__destroy_into_raw(); + } + + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + TableRefAndCommitmentFinalization.unregister(this); + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); + wasm.__wbg_tablerefandcommitment_free(ptr, 0); + } + /** + * @param {string} table_ref + * @param {string} table_commitment_hex + */ + constructor(table_ref, table_commitment_hex) { + const ptr0 = passStringToWasm0( + table_ref, + wasm.__wbindgen_malloc, + wasm.__wbindgen_realloc, + ); + const len0 = WASM_VECTOR_LEN; + const ptr1 = passStringToWasm0( + table_commitment_hex, + wasm.__wbindgen_malloc, + wasm.__wbindgen_realloc, + ); + const len1 = WASM_VECTOR_LEN; + const ret = wasm.tablerefandcommitment_new(ptr0, len0, ptr1, len1); + this.__wbg_ptr = ret >>> 0; + TableRefAndCommitmentFinalization.register(this, this.__wbg_ptr, this); + return this; + } + } + + const imports = { + __wbindgen_placeholder__: { + __wbindgen_object_drop_ref: function (arg0) { + takeObject(arg0); + }, + __wbindgen_is_undefined: function (arg0) { + const ret = getObject(arg0) === undefined; + return ret; + }, + __wbindgen_string_new: function (arg0, arg1) { + const ret = getStringFromWasm0(arg0, arg1); + return addHeapObject(ret); + }, + __wbindgen_object_clone_ref: function (arg0) { + const ret = getObject(arg0); + return addHeapObject(ret); + }, + __wbg_tablerefandcommitment_new: function (arg0) { + const ret = TableRefAndCommitment.__wrap(arg0); + return addHeapObject(ret); + }, + __wbg_tablerefandcommitment_unwrap: function (arg0) { + const ret = TableRefAndCommitment.__unwrap(takeObject(arg0)); + return ret; + }, + __wbindgen_string_get: function (arg0, arg1) { + const obj = getObject(arg1); + const ret = typeof obj === "string" ? obj : undefined; + var ptr1 = isLikeNone(ret) + ? 0 + : passStringToWasm0( + ret, + wasm.__wbindgen_malloc, + wasm.__wbindgen_realloc, + ); + var len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_parse_51ee5409072379d3: function () { + return handleError(function (arg0, arg1) { + const ret = JSON.parse(getStringFromWasm0(arg0, arg1)); + return addHeapObject(ret); + }, arguments); + }, + __wbg_stringify_eead5648c09faaf8: function () { + return handleError(function (arg0) { + const ret = JSON.stringify(getObject(arg0)); + return addHeapObject(ret); + }, arguments); + }, + __wbindgen_throw: function (arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); + }, + }, + }; + + const wasmRequest = await makeHttpRequest({ + url: "https://raw.githubusercontent.com/spaceandtimelabs/sxt-proof-of-sql-sdk/feat/wasm-bindgen/crates/proof-of-sql-sdk-wasm/pkg/sxt_proof_of_sql_sdk_wasm_bg.wasm", + method: "GET", + responseType: "arraybuffer", + }); + + if (wasmRequest.error || wasmRequest.status !== 200) { + throw new Error("Error retrieving wasm file"); + } + + // Convert the response data to a Uint8Array for WebAssembly instantiation + const wasmCode = new Uint8Array(wasmRequest.data); + + const wasmInstance = (await WebAssembly.instantiate(wasmCode, imports)) + .instance; + const wasm = wasmInstance.exports; + const __wasm = wasm; + + // Ensure the API key is available + if (!this.apiKey) { + throw Error("API Key Not Found"); + } + + // Construct a payload to fetch an accesstoken to be used for + // api access to the prover. It is a required component of the payload to + // receive a proof. + // Set the secrets field to an apiKey that you own for your sxt account. + + // Execute the API request using makeHttpRequest + const authResponse = await makeHttpRequest({ + url: "https://proxy.api.spaceandtime.dev/auth/apikey", + method: "POST", + headers: { + apikey: this.apiKey, + "Content-Type": "application/json", + }, + }); + + if (authResponse.error) { + throw new Error("Error querying auth endpoint: " + authResponse.message); + } + + // Extract the access token, truncate it to 256 characters, and return it as an encoded string + const accessToken = authResponse.data.accessToken; + + // TODO: make this not be hardcoded: + const commitmentResponse = await makeHttpRequest({ + url: "https://rpc.testnet.sxt.network/", + method: "POST", + headers: { + "Content-Type": "application/json", + }, + data: { + id: 1, + jsonrpc: "2.0", + method: "state_getStorage", + params: [this.commitmentKey], + }, + }); + + if (commitmentResponse.error) { + throw new Error("Error querying RPC node: " + commitmentResponse.message); + } + + let commitment = commitmentResponse.data.result.slice(2); // remove the 0x prefix + let commitments = [new TableRefAndCommitment("ETHEREUM.BLOCKS", commitment)]; + const plannedProverQuery = plan_prover_query_dory( + this.queryString, + commitments, + ); + const proverQuery = plannedProverQuery.prover_query_json; + const queryExpr = plannedProverQuery.query_expr_json; + commitments = plannedProverQuery.commitments; + + // proverQuery.query_context["ETHEREUM.BLOCKS"].ends = [100]; + + const proverResponse = await makeHttpRequest({ + url: "https://api.spaceandtime.dev/v1/prove", + method: "POST", + headers: { + Authorization: "Bearer " + accessToken, + "content-type": "application/json", + }, + data: proverQuery, + }); + + if (proverResponse.error) { + throw new Error("Error querying prover: " + proverResponse.message); + } + + const proverResponseJson = proverResponse.data; + + try { + const result = verify_prover_response_dory( + proverResponseJson, + queryExpr, + commitments, + ); + return Functions.encodeString("Verified"); + } catch (e) { + if (e instanceof String) { + if (e.slice(0, 22) === "verification failure: ") { + return Functions.encodeString("Invalid"); + } + } + throw e; + } + + } +} + +export default SxTProof; + + +async function makeHttpRequest({ url, method = "GET", headers = {}, data = null, responseType = "json" }) { + + const controller = new AbortController(); + const id = setTimeout(() => controller.abort(), 3000); + const response = await fetch(url, { + method, + headers, + body: data ? JSON.stringify(data) : undefined, + signal: controller.signal, + }); + clearTimeout(id); + + if (!response.ok) { + return { error: `HTTP error! Status: ${response.status} ${response.statusText}` }; + } + + let data_; + try { + switch (responseType) { + case "json": + data_ = await response.json(); + break; + case "arraybuffer": + data_ = await response.arrayBuffer(); + break; + case "text": + data_ = await response.text(); + break; + default: + return { error: `Unsupported responseType: ${responseType}` }; + } + } catch (e) { + return { error: `Error parsing response: ${e.message}` }; + } + + return { data: data_ }; +} + + From b6aa69f1613b6da38b852ad2fc9d518b3b596110 Mon Sep 17 00:00:00 2001 From: "dustin.ray" Date: Wed, 20 Nov 2024 15:37:04 -0800 Subject: [PATCH 4/5] feat: error handling --- chainlink-functions/example/source.js | 2 +- chainlink-functions/source/index.js | 1012 +++++++++++++------------ 2 files changed, 510 insertions(+), 504 deletions(-) diff --git a/chainlink-functions/example/source.js b/chainlink-functions/example/source.js index d349f9a..8d2575f 100644 --- a/chainlink-functions/example/source.js +++ b/chainlink-functions/example/source.js @@ -22,6 +22,6 @@ try { console.log("Workflow completed successfully:", result); return Functions.encodeString("Verified"); } catch (error) { - console.log("Workflow failed:"); + console.log("Workflow failed: ", error); return Functions.encodeString("Failed: ", error); } \ No newline at end of file diff --git a/chainlink-functions/source/index.js b/chainlink-functions/source/index.js index 3152eb1..23b05fa 100644 --- a/chainlink-functions/source/index.js +++ b/chainlink-functions/source/index.js @@ -9,593 +9,599 @@ class SxTProof { } async executeWorkflow() { - const heap = new Array(128).fill(undefined); - - heap.push(undefined, null, true, false); - - function getObject(idx) { - return heap[idx]; - } - - let heap_next = heap.length; - - function dropObject(idx) { - if (idx < 132) return; - heap[idx] = heap_next; - heap_next = idx; - } - - function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; - } + try { + const heap = new Array(128).fill(undefined); - const cachedTextDecoder = - typeof TextDecoder !== "undefined" - ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) - : { - decode: () => { - throw Error("TextDecoder not available"); - }, - }; + heap.push(undefined, null, true, false); - if (typeof TextDecoder !== "undefined") { - cachedTextDecoder.decode(); - } + function getObject(idx) { + return heap[idx]; + } - let cachedUint8ArrayMemory0 = null; + let heap_next = heap.length; - function getUint8ArrayMemory0() { - if ( - cachedUint8ArrayMemory0 === null || - cachedUint8ArrayMemory0.byteLength === 0 - ) { - cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; } - return cachedUint8ArrayMemory0; - } - - function getStringFromWasm0(ptr, len) { - ptr = ptr >>> 0; - return cachedTextDecoder.decode( - getUint8ArrayMemory0().subarray(ptr, ptr + len), - ); - } - function addHeapObject(obj) { - if (heap_next === heap.length) heap.push(heap.length + 1); - const idx = heap_next; - heap_next = heap[idx]; + function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; + } - heap[idx] = obj; - return idx; - } + const cachedTextDecoder = + typeof TextDecoder !== "undefined" + ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) + : { + decode: () => { + throw Error("TextDecoder not available"); + }, + }; + + if (typeof TextDecoder !== "undefined") { + cachedTextDecoder.decode(); + } - let WASM_VECTOR_LEN = 0; + let cachedUint8ArrayMemory0 = null; - const cachedTextEncoder = - typeof TextEncoder !== "undefined" - ? new TextEncoder("utf-8") - : { - encode: () => { - throw Error("TextEncoder not available"); - }, - }; - - const encodeString = function (arg, view) { - return cachedTextEncoder.encodeInto(arg, view); - }; - - function passStringToWasm0(arg, malloc, realloc) { - if (realloc === undefined) { - const buf = cachedTextEncoder.encode(arg); - const ptr = malloc(buf.length, 1) >>> 0; - getUint8ArrayMemory0() - .subarray(ptr, ptr + buf.length) - .set(buf); - WASM_VECTOR_LEN = buf.length; - return ptr; + function getUint8ArrayMemory0() { + if ( + cachedUint8ArrayMemory0 === null || + cachedUint8ArrayMemory0.byteLength === 0 + ) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; } - let len = arg.length; - let ptr = malloc(len, 1) >>> 0; - - const mem = getUint8ArrayMemory0(); + function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode( + getUint8ArrayMemory0().subarray(ptr, ptr + len), + ); + } - let offset = 0; + function addHeapObject(obj) { + if (heap_next === heap.length) heap.push(heap.length + 1); + const idx = heap_next; + heap_next = heap[idx]; - for (; offset < len; offset++) { - const code = arg.charCodeAt(offset); - if (code > 0x7f) break; - mem[ptr + offset] = code; + heap[idx] = obj; + return idx; } - if (offset !== len) { - if (offset !== 0) { - arg = arg.slice(offset); + let WASM_VECTOR_LEN = 0; + + const cachedTextEncoder = + typeof TextEncoder !== "undefined" + ? new TextEncoder("utf-8") + : { + encode: () => { + throw Error("TextEncoder not available"); + }, + }; + + const encodeString = function (arg, view) { + return cachedTextEncoder.encodeInto(arg, view); + }; + + function passStringToWasm0(arg, malloc, realloc) { + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8ArrayMemory0() + .subarray(ptr, ptr + buf.length) + .set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; } - ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0; - const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); - const ret = encodeString(arg, view); - - offset += ret.written; - ptr = realloc(ptr, len, offset, 1) >>> 0; - } - WASM_VECTOR_LEN = offset; - return ptr; - } + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; - function isLikeNone(x) { - return x === undefined || x === null; - } + const mem = getUint8ArrayMemory0(); - let cachedDataViewMemory0 = null; + let offset = 0; - function getDataViewMemory0() { - if ( - cachedDataViewMemory0 === null || - cachedDataViewMemory0.buffer.detached === true || - (cachedDataViewMemory0.buffer.detached === undefined && - cachedDataViewMemory0.buffer !== wasm.memory.buffer) - ) { - cachedDataViewMemory0 = new DataView(wasm.memory.buffer); - } - return cachedDataViewMemory0; - } + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7f) break; + mem[ptr + offset] = code; + } - function getArrayJsValueFromWasm0(ptr, len) { - ptr = ptr >>> 0; - const mem = getDataViewMemory0(); - const result = []; - for (let i = ptr; i < ptr + 4 * len; i += 4) { - result.push(takeObject(mem.getUint32(i, true))); - } - return result; - } + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0; + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); + const ret = encodeString(arg, view); - function passArrayJsValueToWasm0(array, malloc) { - const ptr = malloc(array.length * 4, 4) >>> 0; - const mem = getDataViewMemory0(); - for (let i = 0; i < array.length; i++) { - mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true); - } - WASM_VECTOR_LEN = array.length; - return ptr; - } - /** - * @param {string} table_ref - * @returns {string} - */ - function commitment_storage_key_dory(table_ref) { - let deferred3_0; - let deferred3_1; - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - const ptr0 = passStringToWasm0( - table_ref, - wasm.__wbindgen_malloc, - wasm.__wbindgen_realloc, - ); - const len0 = WASM_VECTOR_LEN; - wasm.commitment_storage_key_dory(retptr, ptr0, len0); - var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); - var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); - var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); - var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); - var ptr2 = r0; - var len2 = r1; - if (r3) { - ptr2 = 0; - len2 = 0; - throw takeObject(r2); + offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; } - deferred3_0 = ptr2; - deferred3_1 = len2; - return getStringFromWasm0(ptr2, len2); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - wasm.__wbindgen_free(deferred3_0, deferred3_1, 1); - } - } - /** - * @param {string} query - * @param {(TableRefAndCommitment)[]} commitments - * @returns {ProverQueryAndQueryExprAndCommitments} - */ - function plan_prover_query_dory(query, commitments) { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - const ptr0 = passStringToWasm0( - query, - wasm.__wbindgen_malloc, - wasm.__wbindgen_realloc, - ); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArrayJsValueToWasm0(commitments, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - wasm.plan_prover_query_dory(retptr, ptr0, len0, ptr1, len1); - var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); - var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); - var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); - if (r2) { - throw takeObject(r1); - } - return ProverQueryAndQueryExprAndCommitments.__wrap(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); + WASM_VECTOR_LEN = offset; + return ptr; } - } - /** - * @param {any} prover_response_json - * @param {any} query_expr_json - * @param {(TableRefAndCommitment)[]} commitments - * @returns {any} - */ - function verify_prover_response_dory( - prover_response_json, - query_expr_json, - commitments, - ) { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - const ptr0 = passArrayJsValueToWasm0(commitments, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - wasm.verify_prover_response_dory( - retptr, - addHeapObject(prover_response_json), - addHeapObject(query_expr_json), - ptr0, - len0, - ); - var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); - var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); - var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); - if (r2) { - throw takeObject(r1); - } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); + function isLikeNone(x) { + return x === undefined || x === null; } - } - function handleError(f, args) { - try { - return f.apply(this, args); - } catch (e) { - wasm.__wbindgen_exn_store(addHeapObject(e)); - } - } + let cachedDataViewMemory0 = null; - const ProverQueryAndQueryExprAndCommitmentsFinalization = - typeof FinalizationRegistry === "undefined" - ? { register: () => { }, unregister: () => { } } - : new FinalizationRegistry((ptr) => - wasm.__wbg_proverqueryandqueryexprandcommitments_free(ptr >>> 0, 1), - ); + function getDataViewMemory0() { + if ( + cachedDataViewMemory0 === null || + cachedDataViewMemory0.buffer.detached === true || + (cachedDataViewMemory0.buffer.detached === undefined && + cachedDataViewMemory0.buffer !== wasm.memory.buffer) + ) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); + } + return cachedDataViewMemory0; + } - class ProverQueryAndQueryExprAndCommitments { - static __wrap(ptr) { + function getArrayJsValueFromWasm0(ptr, len) { ptr = ptr >>> 0; - const obj = Object.create(ProverQueryAndQueryExprAndCommitments.prototype); - obj.__wbg_ptr = ptr; - ProverQueryAndQueryExprAndCommitmentsFinalization.register( - obj, - obj.__wbg_ptr, - obj, - ); - return obj; + const mem = getDataViewMemory0(); + const result = []; + for (let i = ptr; i < ptr + 4 * len; i += 4) { + result.push(takeObject(mem.getUint32(i, true))); + } + return result; } - __destroy_into_raw() { - const ptr = this.__wbg_ptr; - this.__wbg_ptr = 0; - ProverQueryAndQueryExprAndCommitmentsFinalization.unregister(this); + function passArrayJsValueToWasm0(array, malloc) { + const ptr = malloc(array.length * 4, 4) >>> 0; + const mem = getDataViewMemory0(); + for (let i = 0; i < array.length; i++) { + mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true); + } + WASM_VECTOR_LEN = array.length; return ptr; } - - free() { - const ptr = this.__destroy_into_raw(); - wasm.__wbg_proverqueryandqueryexprandcommitments_free(ptr, 0); - } /** - * @returns {any} + * @param {string} table_ref + * @returns {string} */ - get prover_query_json() { - const ret = - wasm.__wbg_get_proverqueryandqueryexprandcommitments_prover_query_json( - this.__wbg_ptr, + function commitment_storage_key_dory(table_ref) { + let deferred3_0; + let deferred3_1; + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0( + table_ref, + wasm.__wbindgen_malloc, + wasm.__wbindgen_realloc, ); - return takeObject(ret); - } - /** - * @param {any} arg0 - */ - set prover_query_json(arg0) { - wasm.__wbg_set_proverqueryandqueryexprandcommitments_prover_query_json( - this.__wbg_ptr, - addHeapObject(arg0), - ); + const len0 = WASM_VECTOR_LEN; + wasm.commitment_storage_key_dory(retptr, ptr0, len0); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); + var ptr2 = r0; + var len2 = r1; + if (r3) { + ptr2 = 0; + len2 = 0; + throw takeObject(r2); + } + deferred3_0 = ptr2; + deferred3_1 = len2; + return getStringFromWasm0(ptr2, len2); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + wasm.__wbindgen_free(deferred3_0, deferred3_1, 1); + } } + /** - * @returns {any} + * @param {string} query + * @param {(TableRefAndCommitment)[]} commitments + * @returns {ProverQueryAndQueryExprAndCommitments} */ - get query_expr_json() { - const ret = - wasm.__wbg_get_proverqueryandqueryexprandcommitments_query_expr_json( - this.__wbg_ptr, + function plan_prover_query_dory(query, commitments) { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0( + query, + wasm.__wbindgen_malloc, + wasm.__wbindgen_realloc, ); - return takeObject(ret); - } - /** - * @param {any} arg0 - */ - set query_expr_json(arg0) { - wasm.__wbg_set_proverqueryandqueryexprandcommitments_query_expr_json( - this.__wbg_ptr, - addHeapObject(arg0), - ); + const len0 = WASM_VECTOR_LEN; + const ptr1 = passArrayJsValueToWasm0(commitments, wasm.__wbindgen_malloc); + const len1 = WASM_VECTOR_LEN; + wasm.plan_prover_query_dory(retptr, ptr0, len0, ptr1, len1); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); + if (r2) { + throw takeObject(r1); + } + return ProverQueryAndQueryExprAndCommitments.__wrap(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } } + /** - * @returns {(TableRefAndCommitment)[]} + * @param {any} prover_response_json + * @param {any} query_expr_json + * @param {(TableRefAndCommitment)[]} commitments + * @returns {any} */ - get commitments() { + function verify_prover_response_dory( + prover_response_json, + query_expr_json, + commitments, + ) { try { const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.__wbg_get_proverqueryandqueryexprandcommitments_commitments( + const ptr0 = passArrayJsValueToWasm0(commitments, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + wasm.verify_prover_response_dory( retptr, - this.__wbg_ptr, + addHeapObject(prover_response_json), + addHeapObject(query_expr_json), + ptr0, + len0, ); var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); - var v1 = getArrayJsValueFromWasm0(r0, r1).slice(); - wasm.__wbindgen_free(r0, r1 * 4, 4); - return v1; + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); } finally { wasm.__wbindgen_add_to_stack_pointer(16); } } - /** - * @param {(TableRefAndCommitment)[]} arg0 - */ - set commitments(arg0) { - const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - wasm.__wbg_set_proverqueryandqueryexprandcommitments_commitments( - this.__wbg_ptr, - ptr0, - len0, - ); + + function handleError(f, args) { + try { + return f.apply(this, args); + } catch (e) { + wasm.__wbindgen_exn_store(addHeapObject(e)); + } } - } - const TableRefAndCommitmentFinalization = - typeof FinalizationRegistry === "undefined" - ? { register: () => { }, unregister: () => { } } - : new FinalizationRegistry((ptr) => - wasm.__wbg_tablerefandcommitment_free(ptr >>> 0, 1), - ); + const ProverQueryAndQueryExprAndCommitmentsFinalization = + typeof FinalizationRegistry === "undefined" + ? { register: () => { }, unregister: () => { } } + : new FinalizationRegistry((ptr) => + wasm.__wbg_proverqueryandqueryexprandcommitments_free(ptr >>> 0, 1), + ); - class TableRefAndCommitment { - static __wrap(ptr) { - ptr = ptr >>> 0; - const obj = Object.create(TableRefAndCommitment.prototype); - obj.__wbg_ptr = ptr; - TableRefAndCommitmentFinalization.register(obj, obj.__wbg_ptr, obj); - return obj; - } + class ProverQueryAndQueryExprAndCommitments { + static __wrap(ptr) { + ptr = ptr >>> 0; + const obj = Object.create(ProverQueryAndQueryExprAndCommitments.prototype); + obj.__wbg_ptr = ptr; + ProverQueryAndQueryExprAndCommitmentsFinalization.register( + obj, + obj.__wbg_ptr, + obj, + ); + return obj; + } - static __unwrap(jsValue) { - if (!(jsValue instanceof TableRefAndCommitment)) { - return 0; + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + ProverQueryAndQueryExprAndCommitmentsFinalization.unregister(this); + return ptr; } - return jsValue.__destroy_into_raw(); - } - __destroy_into_raw() { - const ptr = this.__wbg_ptr; - this.__wbg_ptr = 0; - TableRefAndCommitmentFinalization.unregister(this); - return ptr; + free() { + const ptr = this.__destroy_into_raw(); + wasm.__wbg_proverqueryandqueryexprandcommitments_free(ptr, 0); + } + /** + * @returns {any} + */ + get prover_query_json() { + const ret = + wasm.__wbg_get_proverqueryandqueryexprandcommitments_prover_query_json( + this.__wbg_ptr, + ); + return takeObject(ret); + } + /** + * @param {any} arg0 + */ + set prover_query_json(arg0) { + wasm.__wbg_set_proverqueryandqueryexprandcommitments_prover_query_json( + this.__wbg_ptr, + addHeapObject(arg0), + ); + } + /** + * @returns {any} + */ + get query_expr_json() { + const ret = + wasm.__wbg_get_proverqueryandqueryexprandcommitments_query_expr_json( + this.__wbg_ptr, + ); + return takeObject(ret); + } + /** + * @param {any} arg0 + */ + set query_expr_json(arg0) { + wasm.__wbg_set_proverqueryandqueryexprandcommitments_query_expr_json( + this.__wbg_ptr, + addHeapObject(arg0), + ); + } + /** + * @returns {(TableRefAndCommitment)[]} + */ + get commitments() { + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.__wbg_get_proverqueryandqueryexprandcommitments_commitments( + retptr, + this.__wbg_ptr, + ); + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); + var v1 = getArrayJsValueFromWasm0(r0, r1).slice(); + wasm.__wbindgen_free(r0, r1 * 4, 4); + return v1; + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + } + } + /** + * @param {(TableRefAndCommitment)[]} arg0 + */ + set commitments(arg0) { + const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + wasm.__wbg_set_proverqueryandqueryexprandcommitments_commitments( + this.__wbg_ptr, + ptr0, + len0, + ); + } } - free() { - const ptr = this.__destroy_into_raw(); - wasm.__wbg_tablerefandcommitment_free(ptr, 0); - } - /** - * @param {string} table_ref - * @param {string} table_commitment_hex - */ - constructor(table_ref, table_commitment_hex) { - const ptr0 = passStringToWasm0( - table_ref, - wasm.__wbindgen_malloc, - wasm.__wbindgen_realloc, - ); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passStringToWasm0( - table_commitment_hex, - wasm.__wbindgen_malloc, - wasm.__wbindgen_realloc, - ); - const len1 = WASM_VECTOR_LEN; - const ret = wasm.tablerefandcommitment_new(ptr0, len0, ptr1, len1); - this.__wbg_ptr = ret >>> 0; - TableRefAndCommitmentFinalization.register(this, this.__wbg_ptr, this); - return this; + const TableRefAndCommitmentFinalization = + typeof FinalizationRegistry === "undefined" + ? { register: () => { }, unregister: () => { } } + : new FinalizationRegistry((ptr) => + wasm.__wbg_tablerefandcommitment_free(ptr >>> 0, 1), + ); + + class TableRefAndCommitment { + static __wrap(ptr) { + ptr = ptr >>> 0; + const obj = Object.create(TableRefAndCommitment.prototype); + obj.__wbg_ptr = ptr; + TableRefAndCommitmentFinalization.register(obj, obj.__wbg_ptr, obj); + return obj; + } + + static __unwrap(jsValue) { + if (!(jsValue instanceof TableRefAndCommitment)) { + return 0; + } + return jsValue.__destroy_into_raw(); + } + + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + TableRefAndCommitmentFinalization.unregister(this); + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); + wasm.__wbg_tablerefandcommitment_free(ptr, 0); + } + /** + * @param {string} table_ref + * @param {string} table_commitment_hex + */ + constructor(table_ref, table_commitment_hex) { + const ptr0 = passStringToWasm0( + table_ref, + wasm.__wbindgen_malloc, + wasm.__wbindgen_realloc, + ); + const len0 = WASM_VECTOR_LEN; + const ptr1 = passStringToWasm0( + table_commitment_hex, + wasm.__wbindgen_malloc, + wasm.__wbindgen_realloc, + ); + const len1 = WASM_VECTOR_LEN; + const ret = wasm.tablerefandcommitment_new(ptr0, len0, ptr1, len1); + this.__wbg_ptr = ret >>> 0; + TableRefAndCommitmentFinalization.register(this, this.__wbg_ptr, this); + return this; + } } - } - const imports = { - __wbindgen_placeholder__: { - __wbindgen_object_drop_ref: function (arg0) { - takeObject(arg0); - }, - __wbindgen_is_undefined: function (arg0) { - const ret = getObject(arg0) === undefined; - return ret; - }, - __wbindgen_string_new: function (arg0, arg1) { - const ret = getStringFromWasm0(arg0, arg1); - return addHeapObject(ret); - }, - __wbindgen_object_clone_ref: function (arg0) { - const ret = getObject(arg0); - return addHeapObject(ret); - }, - __wbg_tablerefandcommitment_new: function (arg0) { - const ret = TableRefAndCommitment.__wrap(arg0); - return addHeapObject(ret); - }, - __wbg_tablerefandcommitment_unwrap: function (arg0) { - const ret = TableRefAndCommitment.__unwrap(takeObject(arg0)); - return ret; - }, - __wbindgen_string_get: function (arg0, arg1) { - const obj = getObject(arg1); - const ret = typeof obj === "string" ? obj : undefined; - var ptr1 = isLikeNone(ret) - ? 0 - : passStringToWasm0( - ret, - wasm.__wbindgen_malloc, - wasm.__wbindgen_realloc, - ); - var len1 = WASM_VECTOR_LEN; - getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); - getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); - }, - __wbg_parse_51ee5409072379d3: function () { - return handleError(function (arg0, arg1) { - const ret = JSON.parse(getStringFromWasm0(arg0, arg1)); + const imports = { + __wbindgen_placeholder__: { + __wbindgen_object_drop_ref: function (arg0) { + takeObject(arg0); + }, + __wbindgen_is_undefined: function (arg0) { + const ret = getObject(arg0) === undefined; + return ret; + }, + __wbindgen_string_new: function (arg0, arg1) { + const ret = getStringFromWasm0(arg0, arg1); return addHeapObject(ret); - }, arguments); - }, - __wbg_stringify_eead5648c09faaf8: function () { - return handleError(function (arg0) { - const ret = JSON.stringify(getObject(arg0)); + }, + __wbindgen_object_clone_ref: function (arg0) { + const ret = getObject(arg0); return addHeapObject(ret); - }, arguments); - }, - __wbindgen_throw: function (arg0, arg1) { - throw new Error(getStringFromWasm0(arg0, arg1)); + }, + __wbg_tablerefandcommitment_new: function (arg0) { + const ret = TableRefAndCommitment.__wrap(arg0); + return addHeapObject(ret); + }, + __wbg_tablerefandcommitment_unwrap: function (arg0) { + const ret = TableRefAndCommitment.__unwrap(takeObject(arg0)); + return ret; + }, + __wbindgen_string_get: function (arg0, arg1) { + const obj = getObject(arg1); + const ret = typeof obj === "string" ? obj : undefined; + var ptr1 = isLikeNone(ret) + ? 0 + : passStringToWasm0( + ret, + wasm.__wbindgen_malloc, + wasm.__wbindgen_realloc, + ); + var len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_parse_51ee5409072379d3: function () { + return handleError(function (arg0, arg1) { + const ret = JSON.parse(getStringFromWasm0(arg0, arg1)); + return addHeapObject(ret); + }, arguments); + }, + __wbg_stringify_eead5648c09faaf8: function () { + return handleError(function (arg0) { + const ret = JSON.stringify(getObject(arg0)); + return addHeapObject(ret); + }, arguments); + }, + __wbindgen_throw: function (arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); + }, }, - }, - }; + }; - const wasmRequest = await makeHttpRequest({ - url: "https://raw.githubusercontent.com/spaceandtimelabs/sxt-proof-of-sql-sdk/feat/wasm-bindgen/crates/proof-of-sql-sdk-wasm/pkg/sxt_proof_of_sql_sdk_wasm_bg.wasm", - method: "GET", - responseType: "arraybuffer", - }); + const wasmRequest = await makeHttpRequest({ + url: "https://raw.githubusercontent.com/spaceandtimelabs/sxt-proof-of-sql-sdk/feat/wasm-bindgen/crates/proof-of-sql-sdk-wasm/pkg/sxt_proof_of_sql_sdk_wasm_bg.wasm", + method: "GET", + responseType: "arraybuffer", + }); - if (wasmRequest.error || wasmRequest.status !== 200) { - throw new Error("Error retrieving wasm file"); - } + if (wasmRequest.error || wasmRequest.status !== 200) { + throw new Error("Error retrieving wasm file"); + } - // Convert the response data to a Uint8Array for WebAssembly instantiation - const wasmCode = new Uint8Array(wasmRequest.data); + // Convert the response data to a Uint8Array for WebAssembly instantiation + const wasmCode = new Uint8Array(wasmRequest.data); - const wasmInstance = (await WebAssembly.instantiate(wasmCode, imports)) - .instance; - const wasm = wasmInstance.exports; - const __wasm = wasm; + const wasmInstance = (await WebAssembly.instantiate(wasmCode, imports)) + .instance; + const wasm = wasmInstance.exports; + const __wasm = wasm; - // Ensure the API key is available - if (!this.apiKey) { - throw Error("API Key Not Found"); - } + // Ensure the API key is available + if (!this.apiKey) { + throw Error("API Key Not Found"); + } - // Construct a payload to fetch an accesstoken to be used for - // api access to the prover. It is a required component of the payload to - // receive a proof. - // Set the secrets field to an apiKey that you own for your sxt account. - - // Execute the API request using makeHttpRequest - const authResponse = await makeHttpRequest({ - url: "https://proxy.api.spaceandtime.dev/auth/apikey", - method: "POST", - headers: { - apikey: this.apiKey, - "Content-Type": "application/json", - }, - }); - - if (authResponse.error) { - throw new Error("Error querying auth endpoint: " + authResponse.message); - } + // Construct a payload to fetch an accesstoken to be used for + // api access to the prover. It is a required component of the payload to + // receive a proof. + // Set the secrets field to an apiKey that you own for your sxt account. + + // Execute the API request using makeHttpRequest + const authResponse = await makeHttpRequest({ + url: "https://proxy.api.spaceandtime.dev/auth/apikey", + method: "POST", + headers: { + apikey: this.apiKey, + "Content-Type": "application/json", + }, + }); - // Extract the access token, truncate it to 256 characters, and return it as an encoded string - const accessToken = authResponse.data.accessToken; - - // TODO: make this not be hardcoded: - const commitmentResponse = await makeHttpRequest({ - url: "https://rpc.testnet.sxt.network/", - method: "POST", - headers: { - "Content-Type": "application/json", - }, - data: { - id: 1, - jsonrpc: "2.0", - method: "state_getStorage", - params: [this.commitmentKey], - }, - }); - - if (commitmentResponse.error) { - throw new Error("Error querying RPC node: " + commitmentResponse.message); - } + if (authResponse.error) { + throw new Error("Error querying auth endpoint: " + authResponse.message); + } - let commitment = commitmentResponse.data.result.slice(2); // remove the 0x prefix - let commitments = [new TableRefAndCommitment("ETHEREUM.BLOCKS", commitment)]; - const plannedProverQuery = plan_prover_query_dory( - this.queryString, - commitments, - ); - const proverQuery = plannedProverQuery.prover_query_json; - const queryExpr = plannedProverQuery.query_expr_json; - commitments = plannedProverQuery.commitments; - - // proverQuery.query_context["ETHEREUM.BLOCKS"].ends = [100]; - - const proverResponse = await makeHttpRequest({ - url: "https://api.spaceandtime.dev/v1/prove", - method: "POST", - headers: { - Authorization: "Bearer " + accessToken, - "content-type": "application/json", - }, - data: proverQuery, - }); - - if (proverResponse.error) { - throw new Error("Error querying prover: " + proverResponse.message); - } + // Extract the access token, truncate it to 256 characters, and return it as an encoded string + const accessToken = authResponse.data.accessToken; + + // TODO: make this not be hardcoded: + const commitmentResponse = await makeHttpRequest({ + url: "https://rpc.testnet.sxt.network/", + method: "POST", + headers: { + "Content-Type": "application/json", + }, + data: { + id: 1, + jsonrpc: "2.0", + method: "state_getStorage", + params: [this.commitmentKey], + }, + }); - const proverResponseJson = proverResponse.data; + if (commitmentResponse.error) { + throw new Error("Error querying RPC node: " + commitmentResponse.message); + } - try { - const result = verify_prover_response_dory( - proverResponseJson, - queryExpr, + let commitment = commitmentResponse.data.result.slice(2); // remove the 0x prefix + let commitments = [new TableRefAndCommitment("ETHEREUM.BLOCKS", commitment)]; + const plannedProverQuery = plan_prover_query_dory( + this.queryString, commitments, ); - return Functions.encodeString("Verified"); - } catch (e) { - if (e instanceof String) { - if (e.slice(0, 22) === "verification failure: ") { - return Functions.encodeString("Invalid"); + const proverQuery = plannedProverQuery.prover_query_json; + const queryExpr = plannedProverQuery.query_expr_json; + commitments = plannedProverQuery.commitments; + + // proverQuery.query_context["ETHEREUM.BLOCKS"].ends = [100]; + + const proverResponse = await makeHttpRequest({ + url: "https://api.spaceandtime.dev/v1/prove", + method: "POST", + headers: { + Authorization: "Bearer " + accessToken, + "content-type": "application/json", + }, + data: proverQuery, + }); + + if (proverResponse.error) { + throw new Error("Error querying prover: " + proverResponse.message); + } + + const proverResponseJson = proverResponse.data; + + try { + const result = verify_prover_response_dory( + proverResponseJson, + queryExpr, + commitments, + ); + return Functions.encodeString("Verified"); + } catch (e) { + if (e instanceof String) { + if (e.slice(0, 22) === "verification failure: ") { + return Functions.encodeString("Invalid"); + } } + throw e; } - throw e; + + } catch (e) { + return Functions.encodeString("Failed: ", e); } + } } From edf25f140bd53664ed0c29eb1c269e6c871a81d0 Mon Sep 17 00:00:00 2001 From: "dustin.ray" Date: Wed, 20 Nov 2024 15:39:14 -0800 Subject: [PATCH 5/5] fix: try/catch --- chainlink-functions/source/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/chainlink-functions/source/index.js b/chainlink-functions/source/index.js index 23b05fa..5e2bd5a 100644 --- a/chainlink-functions/source/index.js +++ b/chainlink-functions/source/index.js @@ -600,8 +600,6 @@ class SxTProof { } catch (e) { return Functions.encodeString("Failed: ", e); } - - } }