-
Notifications
You must be signed in to change notification settings - Fork 2
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
Handle transferValueOnly events #101
Conversation
server/services/constants.go
Outdated
numTopicsOfEventTransferValueOnlyBeforeSirius = 3 | ||
numTopicsOfEventTransferValueOnlyAfterSirius = 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.
transactionEventDataExecuteOnDestContext = "ExecuteOnDestContext" | ||
transactionEventDataAsyncCall = "AsyncCall" |
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.
Validated empirically. For other kinds of event.Data
, the balance-changing operation is already captured in a SCR, thus, for those, we discard the "transferValueOnly" events.
|
||
for _, event := range rawEvents { | ||
if isBeforeSirius { | ||
typedEvent, err := controller.decideEffectiveEventTransferValueOnlyBeforeSirius(event) |
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.
Logic for "before Sirius" was kept as it was (even though it has only been validated for non-contract addresses).
if string(event.Data) != transactionEventDataExecuteOnDestContext && string(event.Data) != transactionEventDataAsyncCall { | ||
// Ineffective event, since the balance change is already captured by a SCR. | ||
return nil, nil | ||
} | ||
|
||
sender := event.Address | ||
senderPubKey, err := controller.provider.ConvertAddressToPubKey(sender) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
isIntrashard := controller.provider.ComputeShardIdOfPubKey(senderPubKey) == controller.provider.ComputeShardIdOfPubKey(receiverPubKey) | ||
if !isIntrashard { | ||
// Ineffective event, since the balance change is already captured by a SCR. | ||
return nil, nil | ||
} |
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.
Conditions only in the "after Sirius" logic (as far as we know, for now).
(even though its correctness has only been validated on non-contract accounts)- no handling of such events: https://github.com/multiversx/mx-chain-rosetta/blob/v0.4.4/server/services/transactionsTransformer.go#L325.transferValueOnly
.