Skip to content
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

fix(taiko-client): improve prover balance check based on 18092 #18129

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading