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

Prevent memory impl to access private fields + add missing pub/accessors #80

Merged

Conversation

nanocryk
Copy link
Contributor

When trying to migrate frontier to the latest version, it seems impossible to implement the SubstrateStackMetadata because it cannot access private field StackSubstateMetadata.accessed.

This PR contains 2 changes :

  • Fix visibility issues (accessor + pub Accessed)
  • MemoryStackSubstate was "cheating" by accessing private fields of SubstrateStackMetadata since it is declared in a submodule. To make it "fair" (= make sure other implementations can access the same fields), I moved executor::stack::state into executor::memory, and moved the trait StackState which seemed to be in the wrong place.

@sorpaas
Copy link
Member

sorpaas commented Nov 1, 2021

Can you re-export necessary structs from memory instead? Putting memory under stack is because memory is "memory-only stack executor".

@nanocryk
Copy link
Contributor Author

nanocryk commented Nov 2, 2021

Not sure to understand which re-export you want me to change. Could you make a suggestion on a specific line ?

I moved memory outside of stack to better distinguish the stack executor itself from the memory-only (replaceable) implementation, and also to ensure it is indeed replaceable by preventing it to access private field.

If you want to keep memory under stack, I can move the stack executor itself into its own submodule to still prevent private field accesses. Do you a specific name in mind for such submodule ?

@sorpaas
Copy link
Member

sorpaas commented Nov 2, 2021

If you want to keep memory under stack, I can move the stack executor itself into its own submodule to still prevent private field accesses.

Yeah please do! Given that the name will probably not be exported I think the name of it doesn't matter much. My worst suggestion is to just name it impl, but if you have better names please use it!

@sorpaas sorpaas merged commit 43a595a into rust-ethereum:master Nov 3, 2021
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