Skip to content

Commit

Permalink
fixing silly types
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarstonConnell committed Sep 16, 2024
1 parent 7f5b3e1 commit 04bb5f1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ type NetworkConfig struct {
Name string `yaml:"name" mapstructure:"name"`
RPC string `yaml:"rpc" mapstructure:"rpc"`
Contract string `yaml:"contract" mapstructure:"contract"`
ChainID int64 `yaml:"chain_id" mapstructure:"chain_id"`
Finality int64 `yaml:"finality" mapstructure:"finality"`
ChainID uint64 `yaml:"chain_id" mapstructure:"chain_id"`
Finality uint64 `yaml:"finality" mapstructure:"finality"`
}

func DefaultConfig() Config {
Expand Down
4 changes: 2 additions & 2 deletions relay/abi.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func init() {
}
}

func handleLog(vLog *types.Log, w *wallet.Wallet, q *uploader.Queue, chainID int64, jackalContract string) {
func handleLog(vLog *types.Log, w *wallet.Wallet, q *uploader.Queue, chainID uint64, jackalContract string) {
event := struct {
Sender common.Address
Merkle string
Expand Down Expand Up @@ -172,7 +172,7 @@ func handleLog(vLog *types.Log, w *wallet.Wallet, q *uploader.Queue, chainID int
log.Println(res.TxHash)
}

func chainRep(id int64) string {
func chainRep(id uint64) string {
s := ChainIDS[id]
if len(s) == 0 {
return fmt.Sprintf("%d", id)
Expand Down
9 changes: 4 additions & 5 deletions relay/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func subscribeLogs(client *ethclient.Client, query ethereum.FilterQuery) (ethere
}

// waitForReceipt polls for the transaction receipt until it's available
func waitForReceipt(client *ethclient.Client, txHash common.Hash, chainId, finality int64, callBack func(receipt *types.Receipt)) error {
func waitForReceipt(client *ethclient.Client, txHash common.Hash, chainId, finality uint64, callBack func(receipt *types.Receipt)) error {
var errCount int64
for {
if errCount > 30 {
Expand All @@ -259,17 +259,16 @@ func waitForReceipt(client *ethclient.Client, txHash common.Hash, chainId, final
continue
}

latestBlock, err := client.BlockByNumber(context.Background(), nil)
latestBlock, err := client.BlockNumber(context.Background())
if err != nil {
log.Printf("cannot get current height | %s", err.Error())
errCount++
continue
}

latest := latestBlock.Number().Int64()
txBlock := receipt.BlockNumber.Int64()
txBlock := receipt.BlockNumber.Uint64()

blockDiff := latest - txBlock
blockDiff := latestBlock - txBlock
if blockDiff >= finality {
callBack(receipt)
return nil
Expand Down
2 changes: 1 addition & 1 deletion relay/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type App struct {
cfg config.Config
}

var ChainIDS = map[int64]string{
var ChainIDS = map[uint64]string{
1: "Ethereum",
8453: "Base",
137: "Polygon",
Expand Down

0 comments on commit 04bb5f1

Please sign in to comment.