ethereum / c-kzg-4844

A minimal implementation of the Polynomial Commitments API for EIP-4844 and EIP-7594, written in C.
Apache License 2.0
112 stars 105 forks source link

Split core implementation into multiple files #464

Closed asn-d6 closed 1 month ago

asn-d6 commented 1 month ago

Splits codebase into: common/4844/7594 files

asn-d6 commented 1 month ago

I did a bit of #include cleanup. I think we should include header files from the source files when needed, and only include stuff in the header files if it's needed by the header file itself. It seems like this is the general (but not mandatory) convention.

I think this way it's cleaner to see what each source file needs, and also cleaner for the compiler to understand what each header file actually needs.

As a sidenote, see how I had to modify the python C wrapper. The wrapper file was using boolean types even tho it was not including stbool. The compilation worked because <stdbool.h> was silently (and needlessly) included by an include of ckzg.h.

asn-d6 commented 1 month ago

I think there is an issue with the Makefile now. For example, run make, then do a modification to common.c and run make again. The Makefile won't notice that common.c was modified, and will just move on with running the tests.