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

Make input for Accout::sign_execution publicly constructable #538

Open
Angel-Petrov opened this issue Jan 26, 2024 · 3 comments
Open

Make input for Accout::sign_execution publicly constructable #538

Angel-Petrov opened this issue Jan 26, 2024 · 3 comments

Comments

@Angel-Petrov
Copy link

Currently the only way to sign a execution is through Account::sign_execution which takes in a RawExecution, however this type has no way to be made by users of the library making it so the only way to use this API is for internal purposes and through the unsafe mem::transmute.

The simplest solution to this would be to make a RawExecution::new associated function or to make the method Execution::to_raw which would return a Option<RawExecution> (though this forces uses to have to add a unwrap if they know the Execution has a nonce and a max_fee)

@tdelabro
Copy link
Contributor

tdelabro commented Feb 5, 2024

@xJonathanLEI do you have an opinion on this?

@xJonathanLEI
Copy link
Owner

Hi sorry for the delay. I think it makes sense to allow construction of this type. I just want a bit more context on cases where this is useful. Care to elaborate?

@Angel-Petrov
Copy link
Author

Angel-Petrov commented Feb 26, 2024

@xJonathanLEI Thanks for the reply! The use case that initially caused this PR to be made was for when a load testing framework required that its own http request functions be used to get benchmarking metrics, meaning we have to prepare the requests ourselves as well. This code is currently what we have to do, which is not ideal since any version upgrades might break the code and it is generally not very idiomatic.

It is also very confusing to users of the library to have public methods they could use that have parameters that they cannot construct, ideally it would be a private method if that is the case or the type would be made publicly constructable.

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

No branches or pull requests

3 participants