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

Handle transferValueOnly events #101

Merged
merged 3 commits into from
Aug 26, 2024
Merged

Handle transferValueOnly events #101

merged 3 commits into from
Aug 26, 2024

Conversation

andreibancioiu
Copy link
Contributor

@andreibancioiu andreibancioiu commented Aug 23, 2024

@andreibancioiu andreibancioiu self-assigned this Aug 23, 2024
@andreibancioiu andreibancioiu marked this pull request as ready for review August 23, 2024 14:02
Comment on lines 62 to 63
numTopicsOfEventTransferValueOnlyBeforeSirius = 3
numTopicsOfEventTransferValueOnlyAfterSirius = 2
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +47 to +48
transactionEventDataExecuteOnDestContext = "ExecuteOnDestContext"
transactionEventDataAsyncCall = "AsyncCall"
Copy link
Contributor Author

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)
Copy link
Contributor Author

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).

Comment on lines +118 to +133
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
}
Copy link
Contributor Author

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).

@andreibancioiu andreibancioiu merged commit d296280 into feat/spica Aug 26, 2024
6 checks passed
@andreibancioiu andreibancioiu deleted the spica-23-1 branch August 26, 2024 08:05
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

Successfully merging this pull request may close these issues.

3 participants