Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

In some function missed MessageSigned and MessagePredicate functionality #186

Merged
merged 5 commits into from
Sep 28, 2022

Conversation

xgreenx
Copy link
Contributor

@xgreenx xgreenx commented Sep 21, 2022

In the tests for FuelLabs/fuel-core#632, I found the handling of the MessageSigned and MessagePredicate inputs is missing in some methods.

@xgreenx xgreenx self-assigned this Sep 21, 2022
@@ -234,6 +235,8 @@ impl Input {
}
}

// TODO: Maybe we need to move `ResourceId` from `fuel-core` into `fuel-tx`(or `fuel-type`) and
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If not, I will remove this TODO, if yes, I will create an issue=)

Copy link
Contributor

Choose a reason for hiding this comment

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

That depends on whether or not the resource id is going to be an attribute of the transaction. If yes, then it should be moved here

@xgreenx xgreenx requested review from vlopes11, leviathanbeak and Voxelot and removed request for vlopes11 September 21, 2022 12:13
Copy link
Contributor

@vlopes11 vlopes11 left a comment

Choose a reason for hiding this comment

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

Couple of nits and suggestions

src/consts.rs Outdated
use fuel_types::{Bytes32, Salt};
use fuel_types::{AssetId, Bytes32, Salt};

pub const BASE_ASSET: AssetId = AssetId::zeroed();
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is becoming a public constant, then it should be added as associated constant of AssetId. ie AssetId::BASE_ASSET (or equivalent name)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -234,6 +235,8 @@ impl Input {
}
}

// TODO: Maybe we need to move `ResourceId` from `fuel-core` into `fuel-tx`(or `fuel-type`) and
Copy link
Contributor

Choose a reason for hiding this comment

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

That depends on whether or not the resource id is going to be an attribute of the transaction. If yes, then it should be moved here

@@ -25,7 +25,7 @@ impl InputRepr {
pub const fn owner_offset(&self) -> Option<usize> {
match self {
Self::Coin => Some(INPUT_COIN_OWNER_OFFSET),
Self::Message => None,
Self::Message => Some(INPUT_MESSAGE_RECIPIENT_OFFSET),
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't really an owner but a recipient. I don't recommend we mix things because we create a magic box effect (that we don't know what exactly is happening internally in the function, provided only its name)

src/checked_transaction.rs Outdated Show resolved Hide resolved
@@ -247,9 +250,10 @@ impl Input {
pub const fn input_owner(&self) -> Option<&Address> {
match self {
Self::CoinSigned { owner, .. } | Self::CoinPredicate { owner, .. } => Some(owner),
Self::MessageSigned { .. } | Self::MessagePredicate { .. } | Self::Contract { .. } => {
None
Self::MessageSigned { recipient, .. } | Self::MessagePredicate { recipient, .. } => {
Copy link
Member

@Voxelot Voxelot Sep 21, 2022

Choose a reason for hiding this comment

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

Same thing as Victor mentioned below, we shouldn't mix recipient and owner behind the same getter. It's annoying since they are basically the same thing, but it makes the public interface confusing if we have inconsistencies like this.

@xgreenx
Copy link
Contributor Author

xgreenx commented Sep 23, 2022

@Voxelot @vlopes11 Waiting for you=)

vlopes11
vlopes11 previously approved these changes Sep 27, 2022
@xgreenx xgreenx merged commit 9baacb0 into master Sep 28, 2022
@xgreenx xgreenx deleted the feature/missed-message-in-some-functions branch September 28, 2022 12:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants