Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpecID not updated when modify_spec_id #1095

Closed
publicqi opened this issue Feb 16, 2024 · 0 comments · Fixed by #1096
Closed

SpecID not updated when modify_spec_id #1095

publicqi opened this issue Feb 16, 2024 · 0 comments · Fixed by #1096

Comments

@publicqi
Copy link
Contributor

publicqi commented Feb 16, 2024

https://github.com/bluealloy/revm/blob/main/crates/revm/src/handler.rs#L185-L199

    pub fn modify_spec_id(&mut self, spec_id: SpecId) {
        if self.cfg.spec_id == spec_id {
            return;
        }

        let registers = core::mem::take(&mut self.registers);
        // register for optimism is added as a register, so we need to create mainnet handler here.
        let mut handler = Handler::mainnet_with_spec(spec_id);
        // apply all registers to default handeler and raw mainnet instruction table.
        for register in registers {
            handler.append_handler_register(register)
        }
        handler.cfg = self.cfg();
        *self = handler;
    }

Although the handler's behavior is updated, the cfg is still the old one with old SpecID.

@publicqi publicqi changed the title SpecID not updated when SpecID not updated when modify_spec_id Feb 16, 2024
publicqi added a commit to publicqi/revm that referenced this issue Feb 16, 2024
rakita pushed a commit that referenced this issue Feb 16, 2024
This was referenced Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant