Skip to content

Commit

Permalink
fix: backport changes from fep-type1 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal committed Dec 17, 2024
1 parent 5b09389 commit 8ed8b91
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 3 additions & 1 deletion aggoracle/chaingersender/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,12 @@ func (c *EVMChainGERSender) InjectGER(ctx context.Context, ger common.Hash) erro
ethtxtypes.MonitoredTxStatusSent:
continue
case ethtxtypes.MonitoredTxStatusFailed:
return fmt.Errorf("tx %s failed", id.Hex())
return fmt.Errorf("inject GER tx %s failed", id.Hex())
case ethtxtypes.MonitoredTxStatusMined,
ethtxtypes.MonitoredTxStatusSafe,
ethtxtypes.MonitoredTxStatusFinalized:
c.logger.Debugf("inject GER tx %s was successfully mined at block %d", id.Hex(), res.MinedAtBlockNumber)

return nil
default:
c.logger.Error("unexpected tx status:", res.Status)
Expand Down
2 changes: 2 additions & 0 deletions claimsponsor/evmclaimsponsor.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ func (c *EVMClaimSponsor) claimStatus(ctx context.Context, id string) (ClaimStat
case ethtxtypes.MonitoredTxStatusMined,
ethtxtypes.MonitoredTxStatusSafe,
ethtxtypes.MonitoredTxStatusFinalized:
log.Infof("claim tx with id %s mined at block %d", id, res.MinedAtBlockNumber)

return SuccessClaimStatus, nil
default:
return "", fmt.Errorf("unexpected tx status: %v", res.Status)
Expand Down
9 changes: 5 additions & 4 deletions tree/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (t *Tree) getRHTNode(tx db.Querier, nodeHash common.Hash) (*types.TreeNode,
node := &types.TreeNode{}
err := meddler.QueryRow(
tx, node,
fmt.Sprintf(`select * from %s where hash = $1`, t.rhtTable),
fmt.Sprintf(`SELECT * FROM %s WHERE hash = $1`, t.rhtTable),
nodeHash.String(),
)
if err != nil {
Expand Down Expand Up @@ -215,9 +215,9 @@ func (t *Tree) GetRootByIndex(ctx context.Context, index uint32) (types.Root, er

// GetRootByHash returns the root associated to the hash
func (t *Tree) GetRootByHash(ctx context.Context, hash common.Hash) (*types.Root, error) {
var root *types.Root
var root types.Root
if err := meddler.QueryRow(
t.db, root,
t.db, &root,
fmt.Sprintf(`SELECT * FROM %s WHERE hash = $1;`, t.rootTable),
hash.Hex(),
); err != nil {
Expand All @@ -226,7 +226,8 @@ func (t *Tree) GetRootByHash(ctx context.Context, hash common.Hash) (*types.Root
}
return nil, err
}
return root, nil

return &root, nil
}

func (t *Tree) GetLeaf(tx db.Querier, index uint32, root common.Hash) (common.Hash, error) {
Expand Down

0 comments on commit 8ed8b91

Please sign in to comment.