# EPF Week 9 Update This week, I worked a bit more on my [PR](https://github.com/Dyslex7c/grandine-zk/pull/1) and I have fixed the blockers I was facing previously. As I consulted Artiom on how to approach the [error](https://github.com/ProjectZKM/Ziren/issues/267), he told me that implementing the 64-bit atomics for MIPS is the best thing to do, but it is quite hard so it's better to first remove those and run it and see how it goes. So I took the latter path for now and ran an end-to-end test ``"pectra-devnet-6 with epoch transition"`` which seemed to work correctly. Previously, I was using the fibo placeholder guest code I found from the [docs](https://docs.zkm.io/dev/guest-program.html) and later implemented the proper guest program. The core functionality of the program is that it reads serialized inputs using SSZ encoding, executes the state transition and generates proof. The three inputs are: - `state_ssz`(Beacon state) - The current state of the beacon chain - `block_ssz`(Signed beacon block) - The block to be processed - `cache_ssz`(Pubkey Cache) - Precomputed validator public keys The state transition operation applies Ethereum's consensus rules to transition the beacon state. The function implements complete beacon chain state transition logic, including block validation and state updates. ```rust state_transition(&config, &cache, &mut state, &block).unwrap(); ``` When the state transition has been executed successfully, the program commits to the new state's hash. In the following function, we create a cryptographic commitment that proves that the computation was performed correctly without revealing any intermediate steps. ```rust zkm_zkvm::io::commit_slice(&state.hash_tree_root().0); ``` ### Challenges While running the end-to-end test, both my guest code and host code compiled without any errors but I was facing a `panic: attempt to subtract with overflow` blocker which I was unable to resolve despite struggling for some time, so I decided to open an [issue](https://github.com/ProjectZKM/Ziren/issues/275) on Ziren's git repository and thankfully I was able to resolve it with their help. I faced another blocker `rust-lld: error: undefined symbol: read_vec_raw` which I was able to solve on my own. Finally, I was able to successfully run `execute` on the test `"pectra-devnet-6 with epoch transition"` and got the following output ```zsh Running test "pectra-devnet-6 with epoch transition" stdout: loading block and state... stderr: WARNING: Using insecure random number generator. stdout: loaded block and state stdout: performing state transition... stdout: performed state transition stdout: committed output elapsed: 875.524318833s cycles: 7514771682 state root after state transition: 0x30b0d2e6cec254a490b7c512fc24eae81db636b8dc55bbe5a11c07490c0c4b9d ``` I felt insecure after seeing `WARNING: Using insecure random number generator.`, but then realized it's not that problematic since Ethereum consensus is deterministic anyways and it doesn't rely on cryptographic secure randomness during state transitions. It is taking around 15 minutes to complete with 7.5 billion cycles. I think there is room for optimization here which I will look into in the upcoming weeks. ## Work for the next week This week I ran `execute without proving` in dev mode on one specific test case as I mentioned above. In the following weeks, I plan to execute this with other test cases as well and also start proving using both the local prover and via a network. I also plan to benchmark and analyze tests with different parameters using a GPU cloud based proving service (like Bonsai or CUDA for RISC0) which I have requested access for from the Ziren team and they said they will inform me once I'm granted access. ## Conclusion This week I was able to execute the first test and also overcome the critical blockers. From here, I will shift from basic execution to actual proof generation along with integration of the GPU-accelerated proving services to evaluate more on the performance. I look forward to my PR being reviewed and also to be able to use the GPU proving service by Ziren.