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

feat : Check config hash and ProgramInfoChanged event #18

Merged
merged 5 commits into from
Mar 8, 2024

Conversation

thomas192
Copy link
Contributor

Hello first PR ever here, not sure if I needed to make a test (similar PRs haven't seemed to do it).
I implemented the ProgramInfoChanged event also related to issue #5 and discussed in PR #13

This was referenced Feb 22, 2024
@thomas192 thomas192 changed the title feat : Implemented check config hash and ProgramInfoChanged event feat : Check config hash and ProgramInfoChanged event Feb 27, 2024
Copy link
Contributor

@b-j-roberts b-j-roberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, welcome! If you can rebase / resolve conflicts ( I merged the other ProgramInfo PR ), then add the config hash functionality ( set, get, events, ... ) from the Solidity side that would be a good next step.

I think we also want to have a config hash check in updateState like here https://github.com/starkware-libs/cairo-lang/blob/ab6d079f0265f903630aac9287e93d9e7cfb6fcf/src/starkware/starknet/solidity/Starknet.sol#L209 as part of this issue.

@thomas192 thomas192 force-pushed the check_config_hash branch from 0ade202 to eab2dad Compare March 8, 2024 05:15
@thomas192
Copy link
Contributor Author

Hey, I resolved conflicts.

To make sure I understand your request, a getter and setter for the config hash specifically is needed in addition to the get_program_info() and set_program_info() methods of the config component ?

When it comes to the config hash check i think the following snippet from the appchain update_state() method does the trick:

            let (_, current_config_hash): (felt252, felt252) = self.config.program_info.read();
            assert(
                program_output_struct.config_hash == current_config_hash,
                errors::SNOS_INVALID_CONFIG_HASH
            );

Let me know :)

@b-j-roberts
Copy link
Contributor

To make sure I understand your request, a getter and setter for the config hash specifically is needed in addition to the get_program_info() and set_program_info() methods of the config component ?

Maybe just the program_info is fine for now, so no worries.

When it comes to the config hash check i think the following snippet from the appchain update_state() method does the trick:

            let (_, current_config_hash): (felt252, felt252) = self.config.program_info.read();
            assert(
                program_output_struct.config_hash == current_config_hash,
                errors::SNOS_INVALID_CONFIG_HASH
            );

👍

@b-j-roberts b-j-roberts merged commit 96a742d into keep-starknet-strange:main Mar 8, 2024
3 checks passed
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 this pull request may close these issues.

2 participants