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

Ability to provide alternative implementation of host functions #2948

Closed
xlc opened this issue Oct 31, 2022 · 3 comments
Closed

Ability to provide alternative implementation of host functions #2948

xlc opened this issue Oct 31, 2022 · 3 comments

Comments

@xlc
Copy link
Contributor

xlc commented Oct 31, 2022

required by AcalaNetwork/chopsticks#13

I will start with some refactoring on host.rs, abstract the host handling code into a trait, move the current implementation to a struct, and then make it customizable.

@tomaka
Copy link
Contributor

tomaka commented Oct 31, 2022

abstract the host handling code into a trait

There are two traits in the entire source code right now, and it's because I had no other choice. If you open a PR that adds trait definitions, I'll likely refuse it. I don't want smoldot to turn into Substrate with its hundreds of incomprehensible abstractions.

If you explain what you would like to achieve, I can provide a code design for it.
If you just want to disable signatures verification, a simple force_signatures_verifications_success: bool field in host::Config suffices.

@xlc
Copy link
Contributor Author

xlc commented Oct 31, 2022

Ideally I want user to be able to override host functions but I am ok to have this less generic at this stage.

So I will add a config mock_signature_verification_host_functions, when true, it will return true if the signature is valid OR if the signature is equal to a magic value. This will be safe to leave enabled for a test client that it will still reject most of the invalid signatures.

This was referenced Oct 31, 2022
@xlc
Copy link
Contributor Author

xlc commented Nov 1, 2022

closed by #2955

@xlc xlc closed this as completed Nov 1, 2022
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.

2 participants