scroll-tech / ceno

Accelerate Zero-knowledge Virtual Machine by Non-uniform Prover Based on GKR Protocol
Apache License 2.0
21 stars 2 forks source link

Simplify a few conversions to `Expression` #517

Closed matthiasgoergens closed 4 days ago

matthiasgoergens commented 4 days ago

Just something that came up while reviewing some other code.

Especially ceno_zkvm/src/chip_handler/memory.rs and ceno_zkvm/src/chip_handler/register.rs become a bit more readable.

matthiasgoergens commented 4 days ago

It's also possible to pack more fields into fewer vec.

Sorry, what do you mean?

naure commented 4 days ago
                [
                    vec![RAMType::Memory.into(), memory_addr.clone()],
                    vec![value.clone()],
                    vec![prev_ts.clone()],
                ]
                .concat()

to

vec![RAMType::Memory.into(), memory_addr.clone(), value.clone(), prev_ts.clone()]

and similar.

matthiasgoergens commented 4 days ago

Oh, I see. Thanks for explaining. I don't even know why our code is so silly in the first place.