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

Move transaction listening to status-go #4953

Merged
merged 1 commit into from
May 16, 2024

Conversation

endulab
Copy link
Contributor

@endulab endulab commented Mar 20, 2024

Use EventWatcher to catch wallet events.
Handling all community tokens wallet events in communitytokens service (database and messenger operations).
Adding new signal to nim: CommunityTokenTransactionSignal, which is emitted everytime when the event is received.

Issue #4351

@status-im-auto
Copy link
Member

status-im-auto commented Mar 20, 2024

Jenkins Builds

Click to see older builds (32)
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ c15ce9e #1 2024-03-20 11:50:41 ~2 min tests 📄log
✔️ c15ce9e #1 2024-03-20 11:51:09 ~3 min linux 📦zip
✔️ c15ce9e #1 2024-03-20 11:53:00 ~5 min ios 📦zip
✔️ c15ce9e #1 2024-03-20 11:53:50 ~5 min android 📦aar
✖️ 3f9325e #2 2024-04-11 13:19:44 ~1 min tests 📄log
✔️ 3f9325e #2 2024-04-11 13:23:05 ~4 min linux 📦zip
✔️ 3f9325e #2 2024-04-11 13:23:41 ~5 min ios 📦zip
✔️ 3f9325e #2 2024-04-11 13:24:15 ~5 min android 📦aar
✖️ 6372de1 #3 2024-04-11 13:30:25 ~1 min tests 📄log
✔️ 6372de1 #3 2024-04-11 13:31:21 ~2 min android 📦aar
✔️ 6372de1 #3 2024-04-11 13:31:36 ~2 min linux 📦zip
✔️ 6372de1 #3 2024-04-11 13:33:10 ~3 min ios 📦zip
✖️ fe9b825 #4 2024-04-15 12:16:58 ~1 min tests 📄log
✔️ fe9b825 #4 2024-04-15 12:19:07 ~3 min ios 📦zip
✔️ fe9b825 #4 2024-04-15 12:19:35 ~4 min linux 📦zip
✔️ fe9b825 #4 2024-04-15 12:21:06 ~5 min android 📦aar
✖️ 615d2cc #5 2024-04-18 10:19:05 ~2 min tests 📄log
✔️ 615d2cc #5 2024-04-18 10:20:39 ~3 min linux 📦zip
✔️ 615d2cc #5 2024-04-18 10:20:47 ~4 min ios 📦zip
✔️ 615d2cc #5 2024-04-18 10:22:10 ~5 min android 📦aar
✔️ 1a52367 #6 2024-04-18 10:45:46 ~1 min android 📦aar
✔️ 1a52367 #6 2024-04-18 10:46:12 ~2 min linux 📦zip
✔️ 1a52367 #6 2024-04-18 10:49:23 ~5 min ios 📦zip
✖️ 1a52367 #6 2024-04-18 10:50:02 ~5 min tests 📄log
✖️ 5d139ac #7 2024-04-18 12:53:04 ~1 min tests 📄log
✔️ 5d139ac #7 2024-04-18 12:55:39 ~3 min linux 📦zip
✔️ 5d139ac #7 2024-04-18 12:57:25 ~5 min ios 📦zip
✔️ 5d139ac #7 2024-04-18 12:57:52 ~6 min android 📦aar
✔️ 2e94b07 #8 2024-04-18 13:32:50 ~2 min linux 📦zip
✔️ 2e94b07 #8 2024-04-18 13:32:51 ~2 min android 📦aar
✔️ 2e94b07 #8 2024-04-18 13:33:54 ~3 min ios 📦zip
✔️ 2e94b07 #8 2024-04-18 14:20:41 ~50 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 565f8d1 #9 2024-04-25 20:05:36 ~4 min linux 📦zip
✔️ 565f8d1 #9 2024-04-25 20:06:28 ~5 min ios 📦zip
✔️ 565f8d1 #9 2024-04-25 20:07:01 ~6 min android 📦aar
✔️ 565f8d1 #9 2024-04-25 20:43:16 ~42 min tests 📄log
✔️ 98b7a47 #10 2024-05-06 13:46:05 ~4 min linux 📦zip
✔️ 98b7a47 #10 2024-05-06 13:46:56 ~4 min android 📦aar
✔️ 98b7a47 #10 2024-05-06 13:48:14 ~6 min ios 📦zip
✔️ 98b7a47 #10 2024-05-06 14:24:16 ~42 min tests 📄log

@endulab endulab force-pushed the 4351-community-token-refactoring branch from c15ce9e to 3f9325e Compare April 11, 2024 13:18
@endulab endulab marked this pull request as ready for review April 11, 2024 13:22
return nil
}

func (s *Service) handleWalletEvent(event walletevent.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.

This is the main change in the pr.
Here all events are handled and signal is emitted.

@endulab endulab force-pushed the 4351-community-token-refactoring branch from 3f9325e to 6372de1 Compare April 11, 2024 13:29
EventCommunityTokenTransactionStatusChanged = "communityToken.communityTokenTransactionStatusChanged"
)

type CommunityTokenTransactionSignal struct {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is signal send to nim.

@jrainville
Copy link
Member

Is this still WIP? That's still the title 😆

@endulab endulab changed the title WIP Move transaction listening to status-go Apr 12, 2024
Copy link
Member

@jrainville jrainville left a comment

Choose a reason for hiding this comment

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

LGTM. Just small questions

@@ -64,3 +66,27 @@ func (db *Database) GetCommunityERC20Metadata() ([]*token.CommunityToken, error)
}
return result, rows.Err()
}

// duplicated in persistence
Copy link
Member

Choose a reason for hiding this comment

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

What does this comment mean?

GetAssetContractData(chainID uint64, contractAddress string) (*AssetContractData, error)
SafeGetSignerPubKey(ctx context.Context, chainID uint64, communityID string) (string, error)
DeploymentSignatureDigest(chainID uint64, addressFrom string, communityID string) ([]byte, error)
// TODO db operations should be moved to communitytokensdatabase
Copy link
Member

Choose a reason for hiding this comment

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

Is this TODO still valid?

return nil
}

func (s *Service) handleWalletEvent(event walletevent.Event) {
if event.Type == transactions.EventPendingTransactionStatusChanged {
Copy link
Member

Choose a reason for hiding this comment

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

Since we only handle EventPendingTransactionStatusChanged here, you can reverse the condition and early exit for better readability.

@endulab endulab force-pushed the 4351-community-token-refactoring branch from 6372de1 to fe9b825 Compare April 15, 2024 12:15
transactions.DeployCommunityToken,
transactions.AutoDelete,
transactions.Keep,
Copy link
Contributor

@dlipicar dlipicar Apr 16, 2024

Choose a reason for hiding this comment

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

If you change this from Autodelete to Keep, you're in charge of calling Delete to manually remove the entry from the pending_txs table after it fails/succeeds and you do whatever you need with it. I have not seen that though, is it missing or did I miss it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is deleted in communitytokens service after handling event.

@endulab endulab force-pushed the 4351-community-token-refactoring branch 4 times, most recently from 5d139ac to 2e94b07 Compare April 18, 2024 13:29
@endulab endulab force-pushed the 4351-community-token-refactoring branch from 2e94b07 to 565f8d1 Compare April 25, 2024 20:00
Use EventWatcher to catch wallet events.
Handling all community tokens wallet events in communitytokens service (database and messenger operations).
Adding new signal to nim: CommunityTokenTransactionSignal, which is emitted everytime when the event is received.

Issue #4351
@endulab endulab force-pushed the 4351-community-token-refactoring branch from 565f8d1 to 98b7a47 Compare May 6, 2024 13:41
@endulab endulab merged commit 5744502 into develop May 16, 2024
6 of 7 checks passed
@endulab endulab deleted the 4351-community-token-refactoring branch May 16, 2024 14:18
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.

[Community tokens] Move transaction listening to status-go - improvement
4 participants