-
Notifications
You must be signed in to change notification settings - Fork 0
Bugfix for Hash/Secret lock transactions with Delegated Harvesters (task#5pm2hb) #241
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
base: develop
Are you sure you want to change the base?
Conversation
… Added version in LockInfo entry and notifications. Upgraded version of Hashlock and secret lock to support version 2
…version attribute.
resources/supported-entities.json
Outdated
@@ -38,7 +38,7 @@ | |||
{ | |||
"name": "Hash_Lock", | |||
"type": "16712", | |||
"supportedVersions": [1] | |||
"supportedVersions": [1, 2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's support only version 2=)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made changes b3267d5
sub.notify(HashLockDurationNotification<1>(transaction.Duration)); | ||
sub.notify(HashLockMosaicNotification<1>(transaction.Mosaic)); | ||
sub.notify(BalanceDebitNotification<1>(transaction.Signer, transaction.Mosaic.MosaicId, transaction.Mosaic.Amount)); | ||
sub.notify(HashLockNotification<1>(transaction.Signer, transaction.Mosaic, transaction.Duration, transaction.Hash)); | ||
sub.notify(HashLockNotification<1>(transaction.Signer, transaction.Mosaic, transaction.Duration, transaction.Hash, transaction.EntityVersion())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you that this solution is more beauty, but I'm not sure that we need to do changes related to transaction's version by different way.
I think will be better do it by ugly way with the same handlers but for another version of notification.
Because this variant allow us to have the same steps when we are doing any change like this(like tempalte how to do changes related to versioning=) ).
But if @otsybizov agree with beauty variant, then I agree too=)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with adding version field to notification structure. But I don't agree with the changes in the lock info serializer. You could use the 2nd version of the serializer rather than changing the 1st version. Having 2 different serializers for the lock entry version 2 is error-prone solution, potentially someone can use invalid serializer and damage the cache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@otsybizov thank you for your feedback, I have a question.
just to confirm your suggestion, instead of changing verison 1 of LockInfo serialzer, we will use the second version instead defined here ?
struct LockInfoSerializer<TLockInfo, TLockInfoSerializer, 2> { |
does this mean I will change hashlock info serialzer to use this as well? change this line
struct HashLockInfoSerializer : public LockInfoSerializer<HashLockInfo, HashLockInfoExtendedDataSerializer, 1> {}; |
how will the first version entry be handled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, as we have two versions of hash/secret lock info, this becomes more complicated. In both plugins you need to first read the version and then call appropriate serializer when loading entries from cache. And similarly, depending on the entry version, call appropriate serializer when saving data to cache. I'd suggest to add a new LockInfoSerializer template scecialization (version 3) that does that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes pushed here b3267d5
… Added version in LockInfo entry and notifications. Upgraded version of Hashlock and secret lock to support version 2
change notes:
Also adding new version of notification means adding new observer for notification which only differs in setting the version of the cache entry, it will be a redundant observer because both old and new observer will have to set version anyway.
Also, Version information is already stored in cache anyway, we just need a variable in the chain that handles it.