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

CreationHeight should not be accepted if set Immutable Properties #211

Open
0xankit opened this issue Dec 20, 2022 · 2 comments
Open

CreationHeight should not be accepted if set Immutable Properties #211

0xankit opened this issue Dec 20, 2022 · 2 comments

Comments

@0xankit
Copy link
Contributor

0xankit commented Dec 20, 2022

It is possible to pass creationHeight as immutables.
CreationHeight should not be accepted if set Immutable Properties.

immutableMetaProperties := message.ImmutableMetaProperties.
Add(baseProperties.NewMetaProperty(constants.ExchangeRateProperty.GetKey(), baseData.NewDecData(message.TakerOwnableSplit.QuoTruncate(sdkTypes.SmallestDec()).QuoTruncate(message.MakerOwnableSplit)))).
Add(baseProperties.NewMetaProperty(constants.CreationHeightProperty.GetKey(), baseData.NewHeightData(baseTypes.NewHeight(context.BlockHeight())))).
Add(baseProperties.NewMetaProperty(constants.MakerOwnableIDProperty.GetKey(), baseData.NewIDData(message.MakerOwnableID))).
Add(baseProperties.NewMetaProperty(constants.TakerOwnableIDProperty.GetKey(), baseData.NewIDData(message.TakerOwnableID))).
Add(baseProperties.NewMetaProperty(constants.MakerIDProperty.GetKey(), baseData.NewIDData(message.FromID))).
Add(baseProperties.NewMetaProperty(constants.TakerIDProperty.GetKey(), baseData.NewIDData(message.TakerID)))
immutables := baseQualified.NewImmutables(baseLists.NewPropertyList(append(immutableMetaProperties.GetList(), message.ImmutableProperties.GetList()...)...))

Solution: CreationHeight should be picked from context everywhere, and in messages we should implement check if creationHeight set or not!

@0xankit 0xankit assigned deepanshutr and unassigned deepanshutr Dec 20, 2022
@0xankit
Copy link
Contributor Author

0xankit commented Dec 20, 2022

@deepanshutr

@deepanshutr
Copy link
Member

can use mutate method instead of add to avoid this issue

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

2 participants