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

Index Messaging Contracts with Explorer #255

Closed
wants to merge 12 commits into from

Conversation

nautsimon
Copy link
Contributor

Description
Add indexing for message contracts (MessageBusUpgradeable.sol) to explorer.

Additional context
Messaging!

@github-actions github-actions bot added the go Pull requests that update Go code label Oct 14, 2022
@codecov
Copy link

codecov bot commented Oct 14, 2022

Codecov Report

Attention: Patch coverage is 76.71642% with 78 lines in your changes are missing coverage. Please review.

Project coverage is 35.13068%. Comparing base (63c2f51) to head (44057ba).
Report is 1874 commits behind head on master.

Files Patch % Lines
services/explorer/consumer/parser.go 60.22727% 27 Missing and 8 partials ⚠️
services/explorer/contracts/message/topics.go 62.96296% 8 Missing and 2 partials ⚠️
services/explorer/contracts/message/sendreceive.go 94.87179% 6 Missing ⚠️
services/explorer/contracts/message/helpers.go 54.54545% 4 Missing and 1 partial ⚠️
.../explorer/contracts/message/testmessage/helpers.go 54.54545% 4 Missing and 1 partial ⚠️
services/explorer/db/mocks/consumer_db.go 0.00000% 4 Missing ⚠️
services/explorer/db/sql/writer.go 72.72727% 2 Missing and 1 partial ⚠️
...ces/explorer/contracts/message/message.metadata.go 66.66667% 1 Missing and 1 partial ⚠️
...tracts/message/testmessage/testmessage.metadata.go 66.66667% 1 Missing and 1 partial ⚠️
services/explorer/testutil/contracttype.go 0.00000% 2 Missing ⚠️
... and 2 more
Additional details and impacted files
@@                 Coverage Diff                 @@
##              master        #255         +/-   ##
===================================================
+ Coverage   34.68253%   35.13068%   +0.44814%     
===================================================
  Files            372         379          +7     
  Lines          38492       38798        +306     
  Branches          84          84                 
===================================================
+ Hits           13350       13630        +280     
- Misses         23449       23462         +13     
- Partials        1693        1706         +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@trajan0x trajan0x left a comment

Choose a reason for hiding this comment

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

Looks good overall

services/explorer/consumer/backfill/chain.go Outdated Show resolved Hide resolved
services/explorer/consumer/backfill/chain_test.go Outdated Show resolved Hide resolved
services/explorer/consumer/parser.go Outdated Show resolved Hide resolved
SourceChainID *big.Int `gorm:"column:source_chain_id;type:UInt256"`

// Status is the status of the event.
Status sql.NullString `gorm:"column:status"`
Copy link
Contributor

Choose a reason for hiding this comment

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

What are your thoughts on making this an enum? You can see us doing that here:

res, err := synapseCommon.EnumScan(src)

Copy link
Contributor Author

@nautsimon nautsimon Oct 14, 2022

Choose a reason for hiding this comment

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

i was considering it, but i thought it would reduce the data conversions down the line if it was just a string like when doing SQL queries. might be wrong about it though.

// TxHash is the transaction hash of the event
TxHash string `gorm:"column:tx_hash"`
// EventType is the type of the event
EventType uint8 `gorm:"column:event_type"`
Copy link
Contributor

Choose a reason for hiding this comment

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

See neum comment below

services/explorer/db/sql/model.go Show resolved Hide resolved
services/explorer/db/sql/writer.go Outdated Show resolved Hide resolved
} else {
case c.messageAddress:
eventParser = c.messageParser
default:
if c.swapParsers[log.Address] == nil {
logger.Warnf("no parser found for contract %s", log.Address.Hex())
return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

should this err?

@nautsimon nautsimon closed this Nov 13, 2022
@nautsimon nautsimon deleted the feat/explorer-messaging-indexing branch November 13, 2022 10:56
@trajan0x trajan0x restored the feat/explorer-messaging-indexing branch February 28, 2024 04:25
@trajan0x trajan0x reopened this Feb 28, 2024
@trajan0x trajan0x closed this Feb 28, 2024
@trajan0x trajan0x deleted the feat/explorer-messaging-indexing branch February 28, 2024 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code size/l
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants