Skip to content

feat(arithmetization): modify elf_to_json_gen to add ssz prefix as an independent blob at _input_start#3513

Merged
lorenzogentile404 merged 4 commits into
mainfrom
3511-featarithmetization-modify-elf_to_json_gen-to-add-ssz-prefix-as-an-independent-blob-at-_input_start
Jul 7, 2026
Merged

feat(arithmetization): modify elf_to_json_gen to add ssz prefix as an independent blob at _input_start#3513
lorenzogentile404 merged 4 commits into
mainfrom
3511-featarithmetization-modify-elf_to_json_gen-to-add-ssz-prefix-as-an-independent-blob-at-_input_start

Conversation

@lorenzogentile404

Copy link
Copy Markdown
Contributor

This is the current format of the JSON file taken as input by the RV interpreter written in zkc:

{
  "entry_point_and_blobs_count": "0x<entry_point:u64>_<blobs_count:u64>",
  "blobs_offset_and_size": "0x<blob0_offset:u64>_<blob0_size:u64>____<blob1_offset:u64>_<blob1_size:u64>____...",
  "blobs_data": "0x<blob0_bytes>____<blob1_bytes>____..."
}

When it comes to ssz files as input, we pre-process them to add at the beginning a 8 bytes prefix as LE containing the byte count of the ssz body.
We do not want to touch the ssz file, but instead just add that prefix at _input_start as an independent blob.
elf_to_json_gen is the script that needs to be edited.

Signed-off-by: Lorenzo Gentile <lorenzo.gentile@consensys.net>
Signed-off-by: Lorenzo Gentile <lorenzo.gentile@consensys.net>
@lorenzogentile404
lorenzogentile404 marked this pull request as ready for review July 6, 2026 16:23
…gen-to-add-ssz-prefix-as-an-independent-blob-at-_input_start

prefix := make([]byte, 8)
binary.LittleEndian.PutUint64(prefix, uint64(len(ssz)))
blobs := []memoryBlob{{offset: inBytesOffset, data: prefix, name: "ssz_length"}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess it's valid go if you were able to push it to the repo but wouldn't you wan to write

blobs := []memoryBlob{ memoryBlob{offset: inBytesOffset, data: prefix, name: "ssz_length"} }

instead ?

@lorenzogentile404 lorenzogentile404 Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The 2 are equivalent. In the first case, the outer keyword already defines what comes next, so the inner keyword can be omitted @OlivierBBB.

@OlivierBBB OlivierBBB left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

…gen-to-add-ssz-prefix-as-an-independent-blob-at-_input_start
@lorenzogentile404
lorenzogentile404 merged commit 09fcdb4 into main Jul 7, 2026
45 checks passed
@lorenzogentile404
lorenzogentile404 deleted the 3511-featarithmetization-modify-elf_to_json_gen-to-add-ssz-prefix-as-an-independent-blob-at-_input_start branch July 7, 2026 12:18
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.

feat(arithmetization): modify elf_to_json_gen to add ssz prefix as an independent blob at _input_start

2 participants