zkevm-specs icon indicating copy to clipboard operation
zkevm-specs copied to clipboard

Use 32 byte RLC in simple opcode gadgets instead of variable byte RLC

Open ed255 opened this issue 3 years ago • 3 comments

Currently different opcode gadgets use different number of bytes for RLC encoding depending on the type of data when doing lookups.

For example, for CALLER we use 20 bytes, for CALLDATASIZE we use 5 bytes.

Following a discussion with @han0110: we could reuse the constraints to encode a 32 byte RLC in all places as an optimization.

See more details in the original discussion: https://github.com/appliedzkp/zkevm-specs/pull/96#discussion_r788593342

ed255 avatar Jan 21 '22 16:01 ed255

@kilic, are your concerns about ECC multiplication cycles related to this?

ChihChengLiang avatar Jan 25 '22 08:01 ChihChengLiang

We should decide on this maybe as we have a lot of opcodes implemented refering to this and would be nice to decide on it for the upcoming ones.

See for example: https://github.com/privacy-scaling-explorations/zkevm-specs/pull/241/files#

cc: @ChihChengLiang @han0110 @ed255 @kilic

CPerezz avatar Aug 22 '22 14:08 CPerezz

We should decide on this maybe as we have a lot of opcodes implemented refering to this and would be nice to decide on it for the upcoming ones.

See for example: https://github.com/privacy-scaling-explorations/zkevm-specs/pull/241/files#

cc: @ChihChengLiang @han0110 @ed255 @kilic

I'm inclined to ignore this issue for now (so that it doesn't affect the unimplemented opcodes), and once all opcodes are implemented, revisit this as a possible optimization. So I would leave this as a low priority issue in the collection of small optimizations we can do in the future.

ed255 avatar Aug 22 '22 14:08 ed255

This issue became irrelevant with the word lo/hi refactor https://github.com/privacy-scaling-explorations/zkevm-specs/pull/390

ed255 avatar May 12 '23 11:05 ed255