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

feat(sdk): support compressed response #469

Merged
merged 9 commits into from
Aug 24, 2023

Conversation

mask-pp
Copy link

@mask-pp mask-pp commented Aug 18, 2023

1. Purpose or design rationale of this PR

Enable use compression algorithm, support: gzip, zlib(deflate)
i.g:

  • use curl:

curl --location 'http://localhost:8545' -H 'Content-Type: application/json' --compressed --data '{"jsonrpc": "2.0", "method": "scroll_getBlockTraceByNumberOrHash","params": ["0x2ca4"],"id": 1}' -v -w '%{size_download}'

  • use by SDK:

`
client, err := ethclient.Dial("http://localhost:8545")

assert.NoError(t, err)

client.SetHeader("Accept-Encoding", "gzip")
`

2. PR title

Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:

  • build: Changes that affect the build system or external dependencies (example scopes: yarn, eslint, typescript)
  • ci: Changes to our CI configuration files and scripts (example scopes: vercel, github, cypress)
  • docs: Documentation-only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that doesn't fix a bug, or add a feature, or improves performance
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • test: Adding missing tests or correcting existing tests

3. Deployment tag versioning

Has the version in params/version.go been updated?

  • This PR doesn't involve a new deployment, git tag, docker image tag, and it doesn't affect traces
  • Yes

4. Breaking change label

Does this PR have the breaking-change label?

  • This PR is not a breaking change
  • Yes

@mask-pp mask-pp changed the title Feat/enable use http compression Feat/enable using http compression Aug 18, 2023
@Thegaram
Copy link

Are you sure this is not enabled by default? I've used queries like this before (using --compressed):

curl -H 'Content-Type: application/json' --compressed -d '{"jsonrpc":"2.0","id":"id","method":"eth_getLogs", "params": [{ "fromBlock": "0x0", "topics": [] }]}' http://localhost:8545

@mask-pp
Copy link
Author

mask-pp commented Aug 23, 2023

Are you sure this is not enabled by default? I've used queries like this before (using --compressed):

curl -H 'Content-Type: application/json' --compressed -d '{"jsonrpc":"2.0","id":"id","method":"eth_getLogs", "params": [{ "fromBlock": "0x0", "topics": [] }]}' http://localhost:8545

Use --header 'Content-Encoding: gzip' can works.

@mask-pp
Copy link
Author

mask-pp commented Aug 23, 2023

Are you sure this is not enabled by default? I've used queries like this before (using --compressed):

curl -H 'Content-Type: application/json' --compressed -d '{"jsonrpc":"2.0","id":"id","method":"eth_getLogs", "params": [{ "fromBlock": "0x0", "topics": [] }]}' http://localhost:8545

So, we just are able to decode the compressed content if client set "Accept-Encoding: gzip".

rpc/http.go Outdated Show resolved Hide resolved
rpc/http.go Outdated Show resolved Hide resolved
@mask-pp mask-pp requested a review from Thegaram August 23, 2023 06:25
@Thegaram Thegaram changed the title Feat/enable using http compression feat(sdk): support compressed response Aug 23, 2023
@icemelon icemelon merged commit eb79758 into develop Aug 24, 2023
5 checks passed
@icemelon icemelon deleted the feat/enable_http_compression branch August 24, 2023 11:59
Thegaram pushed a commit that referenced this pull request Aug 25, 2023
* enable use compression algorithm

* fix ci

* Just enable decode compressed content at ethclient

* fix comments

---------

Co-authored-by: Haichen Shen <shenhaichen@gmail.com>
Thegaram added a commit that referenced this pull request Aug 25, 2023
* feat: store skipped txs in local db

* bump version

* bump version

* fix test

* include L2 txs in skipped index

* goimports

* rename more

* bump version

* fix missed renames

* fix the bug when calculating l2TxCount. (#479)

* fix bug when calculate l2 tx count

* Update version

* fix: exclude L1 message from block payload size validation (#476)

* fix: exclude L1 message from block payload size validation

* fix the bug when calculating l2TxCount. (#479)

* fix bug when calculate l2 tx count

* Update version

* bump version

---------

Co-authored-by: maskpp <maskpp266@gmail.com>

* fix: update row estimation with scroll-prover `v0.7.2` (#475)

* Fix row estimation.

* Update libzkp.

* more

* prepare

* finish

* upgrade

* bump version

* fix tests

* Update to scroll-prover `v0.7.2`.

* fix tests

* Update miner/worker.go

Co-authored-by: Péter Garamvölgyi <peter@scroll.io>

* Update miner/worker.go

Co-authored-by: Péter Garamvölgyi <peter@scroll.io>

* Reset ccc when skips first tx.

* do not unnecessarily skip L1 message

* fix ccc reset and improve code readability

* seal block on circuitcapacitychecker.ErrUnknown

---------

Co-authored-by: HAOYUatHZ <haoyu@protonmail.com>
Co-authored-by: Péter Garamvölgyi <peter@scroll.io>

* refactor: simplify ccc revert to snapshot (#480)

* simplify ccc revert to snapshot

* Update version.go

---------

Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>

* feat: use --gcmode=archive and --cache.noprefetch=true by default (#482)

* feat: use --gcmode=archive and --cache.noprefetch=true by default

* refuse to start with invalid config

* lint

* lint

* feat(sdk): support compressed response (#469)

* enable use compression algorithm

* fix ci

* Just enable decode compressed content at ethclient

* fix comments

---------

Co-authored-by: Haichen Shen <shenhaichen@gmail.com>

* fix: disable pruning and prefetch if not flags are provided (#483)

Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>

* fix: update libzkp to use scroll-prover `v0.7.5` (#484)

* Update libzkp to use scroll-prover `v0.7.5`.

* Update version.

* address comments

* bump version

* nit

---------

Co-authored-by: maskpp <maskpp266@gmail.com>
Co-authored-by: Steven <asongala@163.com>
Co-authored-by: HAOYUatHZ <haoyu@protonmail.com>
Co-authored-by: iczc <iczcalan@gmail.com>
Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
Co-authored-by: Haichen Shen <shenhaichen@gmail.com>
Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>
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