-
Notifications
You must be signed in to change notification settings - Fork 32
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
Sinner: resolvers and updating db read functions #1514
Changes from all commits
1a5fadf
b0b3047
02dd707
0bc0194
9b159df
570f128
3ee3f7c
f1fc2e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,7 @@ type OriginSent struct { | |
// BlockNumber is the block number in which the tx occurred. | ||
BlockNumber uint64 `gorm:"column:block_number"` | ||
// TxHash is the hash of the tx. | ||
TxHash string `gorm:"column:tx_hash;primaryKey;index:idx_tx_hash_origin,priority:1,sort:desc"` | ||
TxHash string `gorm:"column:tx_hash;index:idx_tx_hash_origin,priority:1,sort:desc"` | ||
// TxIndex is the index of the tx in a block. | ||
TxIndex uint `gorm:"column:tx_index"` | ||
// Sender is the address of the sender of the tx. | ||
|
@@ -76,7 +76,7 @@ type OriginSent struct { | |
// MessageID is the keccaked message. | ||
MessageID string `gorm:"column:message_id"` | ||
// MessageHash is the message hash. | ||
MessageHash string `gorm:"column:message_hash"` | ||
MessageHash string `gorm:"column:message_hash;primaryKey"` | ||
nautsimon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// ChainID is the chain id. | ||
ChainID uint32 `gorm:"column:chain_id;primaryKey;index:idx_tx_hash_origin,priority:2,sort:desc"` | ||
// Destination is the destination chain id. | ||
|
@@ -114,11 +114,11 @@ type Executed struct { | |
// BlockNumber is the block number in which the tx occurred. | ||
BlockNumber uint64 `gorm:"column:block_number"` | ||
// TxHash is the hash of the tx. | ||
TxHash string `gorm:"column:tx_hash;primaryKey;index:idx_tx_hash_executed,priority:1,sort:desc"` | ||
TxHash string `gorm:"column:tx_hash;index:idx_tx_hash_executed,priority:1,sort:desc"` | ||
// TxIndex is the index of the tx in a block. | ||
TxIndex uint `gorm:"column:tx_index"` | ||
// MessageHash is the message hash. | ||
MessageHash string `gorm:"column:message_hash"` | ||
MessageHash string `gorm:"column:message_hash;primaryKey"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be a foreign key constraint to message table There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this for data integrity if deleting from the db? currently the messagestatus table is updated concurrently w/origin/destination table insert while indexing. An idea could be to do a has many relationship, but the idea of the message status table was to be a lite as possible on query side so it could be pinged a lot for quick updates. type MessageStatus struct {
MessageHash string `gorm:"column:message_hash;uniqueIndex:idx_message_hash_status"`
OriginTxHash string `gorm:"column:origin_txhash"`
DestinationTxHash string `gorm:"column:destination_txhash"`
OriginSentMessages []OriginSent `gorm:"foreignKey:MessageHash;references:MessageHash;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
ExecutedMessages []Executed `gorm:"foreignKey:MessageHash;references:MessageHash;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. has many would be the idea yeah, this will also speed up joins, etc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. destination tx hash is many to may |
||
// ChainID is the chain id. | ||
ChainID uint32 `gorm:"column:chain_id;primaryKey;index:idx_tx_hash_executed,priority:2,sort:desc"` | ||
// RemoteDomain is the destination. | ||
|
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.
The check for
cfg.HTTPPort == 0
is a good addition. It ensures that the server does not start without a valid port. However, it might be beneficial to also check if the port is within the valid range (1-65535). If the port is outside this range, it should also return an error.