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

Hide the versioned struct fields from the public API #4248

Conversation

Stukalov-A-M
Copy link
Contributor

Description

  • SignedTransaction:
    Payload is hidden by transparent API
    (method transaction() returns a SignedTransactionV1 struct, which fields are hidden by transparent API)

Linked issue

Benefits

Checklist

  • I've read CONTRIBUTING.md
  • I've used the standard signed-off commit format (or will squash just before merging)
  • All applicable CI checks pass (or I promised to make them pass later)
  • (optional) I've written unit tests for the code changes
  • I replied to all comments after code review, marking all implemented changes with thumbs up

…ersioned structs from the public API.

Signed-off-by: Stukalov-A-M <[email protected]>
…ersioned structs from the public API.

Signed-off-by: Stukalov-A-M <[email protected]>
…ersioned structs from the public API.

Signed-off-by: Stukalov-A-M <[email protected]>
…ersioned structs from the public API.

Signed-off-by: Stukalov-A-M <[email protected]>
@github-actions github-actions bot added the iroha2-dev The re-implementation of a BFT hyperledger in RUST label Jan 31, 2024
@@ -589,7 +589,7 @@ impl Client {
transaction: &SignedTransaction,
) -> Result<HashOf<TransactionPayload>> {
let (init_sender, init_receiver) = tokio::sync::oneshot::channel();
let hash = transaction.payload().hash();
let hash = transaction.transaction().payload.hash();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let hash = transaction.transaction().payload.hash();
let hash = transaction.hash();

should be like this

Comment on lines +262 to 268
/// Define the version of SignedTransaction
/// Created to provide access to the transaction payload only to internal libs
// TODO: Make a correct implementation
pub fn transaction(&self) -> &SignedTransactionV1 {
let SignedTransaction::V1(tx) = self;
&tx.payload
tx
}
Copy link
Contributor

Choose a reason for hiding this comment

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

remove this function or make it private or guard it with transparent_api macro. Client must not get a handle to SignedTransactionV1

@Stukalov-A-M Stukalov-A-M deleted the hide_struct_fields_from_public_api branch January 31, 2024 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iroha2-dev The re-implementation of a BFT hyperledger in RUST
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants