Skip to content

Commit

Permalink
indexer: update format string for uuid.UUID (#9772)
Browse files Browse the repository at this point in the history
* indexer: update format string for uuid.UUID

The relayEvent variable is of type uuid.UUID, but it's being formatted as an
integer (%d). This will cause a runtime error. Use %s to format the UUID as a
string.

* indexer: constraint l2_block_headers.timestamp > 0

* indexer: doc bigint.Clamp assumption
  • Loading branch information
keroro520 authored and 0xfuturistic committed Apr 1, 2024
1 parent 69b1c97 commit c80691e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion indexer/bigint/bigint.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var (
)

// Clamp returns a new big.Int for `end` to which `end - start` <= size.
// @note (start, end) is an inclusive range
// @note (start, end) is an inclusive range. This function assumes that `start` is not greater than `end`.
func Clamp(start, end *big.Int, size uint64) *big.Int {
temp := new(big.Int)
count := temp.Sub(end, start).Uint64() + 1
Expand Down
2 changes: 1 addition & 1 deletion indexer/database/bridge_messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (db bridgeMessagesDB) MarkRelayedL1BridgeMessage(messageHash common.Hash, r
if message.RelayedMessageEventGUID != nil && message.RelayedMessageEventGUID.ID() == relayEvent.ID() {
return nil
} else if message.RelayedMessageEventGUID != nil {
return fmt.Errorf("relayed message %s re-relayed with a different event %d", messageHash, relayEvent)
return fmt.Errorf("relayed message %s re-relayed with a different event %s", messageHash, relayEvent)
}

message.RelayedMessageEventGUID = &relayEvent
Expand Down
2 changes: 1 addition & 1 deletion indexer/migrations/20230523_create_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ CREATE TABLE IF NOT EXISTS l2_block_headers (
hash VARCHAR PRIMARY KEY,
parent_hash VARCHAR NOT NULL UNIQUE,
number UINT256 NOT NULL UNIQUE,
timestamp INTEGER NOT NULL,
timestamp INTEGER NOT NULL CHECK (timestamp > 0),

-- Raw Data
rlp_bytes VARCHAR NOT NULL
Expand Down

0 comments on commit c80691e

Please sign in to comment.