Skip to content

Commit

Permalink
fix(taiko-client): improve prover balance check based on 18092 (#18129)
Browse files Browse the repository at this point in the history
  • Loading branch information
YoGhurt111 authored Sep 18, 2024
1 parent d6d90d8 commit b6cd50b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/taiko-client/pkg/rpc/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,29 +85,29 @@ func CheckProverBalance(
return false, err
}

totalBalance := new(big.Int).Add(bondBalance, tokenBalance)
log.Info(
"Prover's wallet taiko token balance",
"bondBalance", utils.WeiToEther(bondBalance),
"tokenBalance", utils.WeiToEther(tokenBalance),
"totalBalance", utils.WeiToEther(totalBalance),
"address", prover.Hex(),
"bond", utils.WeiToEther(bond),
)

if bond.Cmp(allowance) > 0 {
if bond.Cmp(allowance) > 0 && bond.Cmp(bondBalance) > 0 {
log.Info(
"Assigned prover does not have required on-chain token allowance",
"allowance", utils.WeiToEther(allowance),
"bondBalance", utils.WeiToEther(bondBalance),
"bond", utils.WeiToEther(bond),
)
return false, nil
}

if bond.Cmp(totalBalance) > 0 {
if bond.Cmp(bondBalance) > 0 && bond.Cmp(tokenBalance) > 0 {
log.Info(
"Assigned prover does not have required on-chain token balance",
"totalBalance", utils.WeiToEther(totalBalance),
"bondBalance", utils.WeiToEther(bondBalance),
"tokenBalance", utils.WeiToEther(tokenBalance),
"bond", utils.WeiToEther(bond),
)
return false, nil
Expand Down

0 comments on commit b6cd50b

Please sign in to comment.