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(tee): use hex serialization for RPC responses #2887

Merged
merged 2 commits into from
Sep 19, 2024

Commits on Sep 18, 2024

  1. feat(tee): use hex serialization for RPC responses

    Following Anton's suggestion, we have switched to hex serialization for
    API/RPC requests and responses. Previously, we used default JSON
    serialization for Vec<u8>, which resulted in a lengthy comma-separated
    list of integers.
    
    This change standardizes serialization, making it more efficient and
    reducing the size of the responses. The previous format, with a series
    of comma-separated integers for pubkey-like fields, looked odd.
    
    Then:
    ```
    curl -X POST\
         -H "Content-Type: application/json" \
         --data '{"jsonrpc": "2.0", "id": 1, "method": "unstable_getTeeProofs", "params": [491882, "sgx"] }' \
            https://mainnet.era.zksync.io
    {"jsonrpc":"2.0","result":[{"attestation":[3,0,2,0,0,0,0,0,10,<dozens of comma-separated integers here>
    ```
    
    Now:
    ```
    $ curl -X POST \
           -H "Content-Type: application/json" \
           --data '{"jsonrpc": "2.0", "id": 1, "method": "unstable_getTeeProofs", "params": [1, "sgx"] }' \
              http://localhost:3050
    {"jsonrpc":"2.0","result":[{"l1BatchNumber":1,"teeType":"sgx","pubkey":"0506070809","signature":"0001020304","proof":"0a0b0c0d0e","provedAt":"2024-09-16T11:53:38.253033Z","attestation":"0403020100"}],"id":1}
    ```
    
    This change needs to be deployed in lockstep with:
    matter-labs/teepot#209.
    pbeza committed Sep 18, 2024
    Configuration menu
    Copy the full SHA
    6529958 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ecaf6fc View commit details
    Browse the repository at this point in the history