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

pink: Example for larger HTTP response #1281

Closed
wants to merge 1 commit into from
Closed

pink: Example for larger HTTP response #1281

wants to merge 1 commit into from

Conversation

kvinwang
Copy link
Collaborator

@kvinwang kvinwang commented May 25, 2023

Note

Don't merge. This PR shows an example of how to handle a bigger HTTP response.

In PR #1280, we have implemented support for batch HTTP requests and increased the HTTP response limit to 2MB. The following example is based on that PR.

Things not ready yet

  • At present, ink uses a static buffer with a hardcoded size of 16KB to exchange data across the boundary of the wasm virtual machine. The downstream contract does not have the ability to alter this configuration. Although a customizable solution has been proposed upstream, it has yet to be implemented. While we await their completion, we can implement a temporary solution by patching ink to expand the size of this static buffer.

  • cargo-contract is currently rigid in that it hardcodes the maximum available memory for the output WASM as 1MB. To overcome this, we've submitted a PR upstream to allow for runtime configuration. Until that PR is merged, we can use our fork of cargo-contract for compilation to bypass this limitation.

Steps to build this example

  • Install the patched cargo-contract
git clone https://github.com/kvinwang/cargo-contract
cd cargo-contract
git checkout max-memory
cargo install --path crates/cargo-contract
  • Clone and checkout this PR
git clone https://github.com/Phala-Network/phala-blockchain
cd phala-blockchain/e2e/contracts/check_system
git checkout big-http
cargo contract build --max-memory-pages 32

@kvinwang kvinwang changed the title Example for big HTTP response pink: Example for big HTTP response May 25, 2023
@kvinwang kvinwang changed the title pink: Example for big HTTP response pink: Example for larger HTTP response May 26, 2023
Base automatically changed from http-batch to master May 31, 2023 11:19
@kvinwang kvinwang closed this Dec 24, 2023
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.

1 participant