Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] feat: use import to run wasm/client code #33

Closed
wants to merge 9 commits into from

Conversation

JayWhite2357
Copy link
Contributor

Rationale for this change

We want to be able to use the SDK more simply from within Chainlink.

What changes are included in this PR?

See the individual commits.

In particular, there is a build_index.sh script that prepends the generated js code from wasm-pack to the index_tail.js. None of the generated code needs to change. It can simply be used from within the index_tail.js code.

Ultimately, we need to turn this script into a CI job that publishes to npm.

Are these changes tested?

Yes.

Dustin-Ray and others added 6 commits November 21, 2024 01:29
Additionally, some code is refactored to simplify the usage of the SDK

Note: there is a build_index.sh script that must be run to build the artifacts needed to import. This script is temporary and should be replace by a CI job that publishes to npm.
@Dustin-Ray
Copy link
Contributor

This branch currently fails with:

Start simulation...
Simulation result {
  capturedTerminalOutput: '\x1B[0m\x1B[32mDownload\x1B[0m https://raw.githubusercontent.com/spaceandtimelabs/sxt-proof-of-sql-sdk/feat/import-sdk/chainlink-functions/source/index.js\n' +
    'Workflow failed:  verification failure: failed to interpret or verify query results: Verification error: round evaluation does not match claimed sum\n',
  responseBytesHexstring: '0x4661696c65643a20'
}
✅ Decoded response to uint256:  5071450569674340896n

Is this expected?

@Dustin-Ray
Copy link
Contributor

I also noticed the cost of running this example has ballooned in the simulation, although its unlikely this is the real world cost, just worth pointing out:

Estimate request costs...
Fulfillment cost estimated to 76.237712263510214221 LINK

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be committed? The wasm-packed js isn't

Base automatically changed from chainlink-functions-sdk-main to main November 21, 2024 23:45
@Dustin-Ray Dustin-Ray enabled auto-merge November 22, 2024 00:10
Copy link

github-actions bot commented Nov 22, 2024

0.1.0 (2024-11-22)

Bug Fixes

  • change default SUBSTRATE_NODE_URL to use wss. (adcb4f2
  • happy clippy (72db025
  • happy clippy (996d400
  • happy fmt (d03f732
  • happy fmt (f3f78cd
  • happy fmt && clippy (17f0d74
  • make (6f4a527
  • make and more natural, replace placeholder for default (1a0762c
  • make sure it runs && address reviews (2f02091
  • not use manual parsing (b183ec7
  • regenerate subxt for dynamic dory changes (dc5274e
  • remove references to particular tables in (026e95a
  • switch to blitzar (7713991
  • try/catch (2cc292d
  • update code to use imports properly (f5a6582
  • update generated javascript wasm bindings (07959b4
  • update source (4b58f46
  • uppercase tables and other misc changes (d12619d
  • use correct VerifierSetup (7ee77e1
  • use count(*) in count_table (0d1dec6
  • warn on equality, error on decrease && simplify code (c85d633

Features

  • add .env to .gitignore (8b717b8
  • add (c27df89
  • add (bb8644d
  • add and warn about postprocessing (c7d5054
  • add bearer token generation (6de29a7
  • add CLI args (dea746d
  • add code to retrieve sxt access token (906129f
  • add commitment request and decoding (1dcfbd5
  • add FunctionsConsumerAbi.json (0e77823
  • add generated file (65332be
  • add I/O and get the code to run (42560ff
  • add IO (551d01c
  • add json files to .gitignore (cdc7956
  • add minimal example (a3d4a81
  • add prover query and verification (b216b7e
  • add source npm package (10bc611
  • add standard Rust .gitignore && remove PoSQL repo-specific stuff from PR template (cc880ea
  • bump PoSQL to 0.33.5 && switch to loading of verifier setup from file (fe1cd53
  • copy chainlink example code (d6479bd
  • Create README (376c965
  • derive common traits for SdkArgs (af2c9da
  • error handling (e5047f1
  • fix errors and get the code to compile (957fe22
  • fix table range && bump proofs to 0.33.15 (32946c5
  • make commitmentKey non-hardcoded (f10a02a
  • make repo a cargo workspace with an sdk member (b4e8e0c
  • move most functionality to a lib.rs function (cff1e5f
  • prepend wasm codegen to javascript job (0b49b46
  • remove hardcoded values from example (5d18dc9
  • switch to an external prover (7ab8eb6
  • switch to DynamicDory in substrate module (e21503b
  • switch to REST endpoint (c0c1eed
  • switch to substrate (b4c9785
  • update (db69e39
  • Update Code Owners (7aa1610
  • update codegen (99a186f
  • Update License (d77235f

@JayWhite2357 JayWhite2357 marked this pull request as draft November 22, 2024 16:28
@JayWhite2357 JayWhite2357 changed the title feat: use import to run wasm/client code [DO NOT MERGE] feat: use import to run wasm/client code Nov 22, 2024
@JayWhite2357
Copy link
Contributor Author

This PR is not ready to merge. The majority of it should never be merged into main.

@JayWhite2357 JayWhite2357 changed the title [DO NOT MERGE] feat: use import to run wasm/client code [DO NOT MERGE into main] feat: use import to run wasm/client code Nov 22, 2024
@JayWhite2357 JayWhite2357 changed the title [DO NOT MERGE into main] feat: use import to run wasm/client code [DO NOT MERGE] feat: use import to run wasm/client code Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants