privacy-scaling-explorations/zkevm-circuits

Support prevrandao opcode

ChihChengLiang opened this issue ยท 16 comments

After the Merge, the DIFFICULTY opcode was renamed to PREVRANDAO

            difficulty: if eth_block.difficulty.is_zero() {
                eth_block
                    .mix_hash
                    .unwrap_or_default()
                    .to_fixed_bytes()
                    .into()
            } else {
                eth_block.difficulty
            },

another remainder is that we need to support prevrandao opcode (renamed from DIFFICULTY). I make this change https://github.com/scroll-tech/zkevm-circuits/blob/1ea9b5970ff873191de29e625687765f427326dd/bus-mapping/src/circuit_input_builder/block.rs#L119-L127 to be compatible with latest node/libs.

Originally posted by @lispc in #1362 (comment)

References

@ChihChengLiang is this open to take up?

Hi @ameya-deshmukh,
Thanks for your interest in contributing to this task.
Yes, the issue is open to take up. But it would be great if you could help update the spec first privacy-scaling-explorations/zkevm-specs#437.

Great, thank you!

Is this issue working in progress? Maybe I can help for it, we met this issue and added in our project. @ChihChengLiang @ameya-deshmukh

Hi @ameya-deshmukh, Can you give an update? It's okay if you are too busy and not able to work on this task.

Hi @ameya-deshmukh, Can you give an update? It's okay if you are too busy and not able to work on this task.

So, may I claim this?

Hey @dyxushuai would you like to work on it together? I wasn't able to get started on this.

Hey @dyxushuai would you like to work on it together? I wasn't able to get started on this.

Of course, I will begin to do this ASAP

Where can we communicate? We can split up the tasks.

difficulty: if eth_block.difficulty.is_zero() {
eth_block
.mix_hash
.unwrap_or_default()
.to_fixed_bytes()
.into()
} else {
eth_block.difficulty
},

I think this logic is good enough to fit the eip-4399 ๐Ÿถ, but we don't like Geth, we don't have flags for features or forks, so we can only keep forward compatibility

Hey @dyxushuai and @ameya-deshmukh, could you give an update? It's fine if both of you are busy and unable to work on this task.

Where can we communicate? We can split up the tasks.

Hey @dyxushuai and @ameya-deshmukh, could you give an update? It's fine if both of you are busy and unable to work on this task.

Sorry, I think @ameya-deshmukh didn't message me. So, I will give a PR in the next few days alone.

Sure! Sorry I couldn't devote time to this.

ed255 commented

It seems no one is currently working on this issue, so I left it unassigned (please let me know if this is not the case!)

It seems no one is currently working on this issue, so I left it unassigned (please let me know if this is not the case!)

Sorry, I just got back from a long vacation. (2 weeks)

@ed255 @KimiWu123 #1648 This is my implementation of prevrandao opcode. If you find any problems, please let me know, for now, I can respond ASAP.