rm canTransfer check along with nits

This commit is contained in:
Shawn 2023-12-21 03:45:47 -08:00
parent 205a1b31d6
commit 3e2ff2b186
3 changed files with 6 additions and 6 deletions

View file

@ -112,6 +112,9 @@ func (c *burn) RequiredGas(input []byte) uint64 {
return 100
}
// Note ctx.CanTransfer method obtains an incorrect balance w.r.t "burnFrom" address,
// specifically during estimateGas. The CanTransfer check was therefore removed,
// and the calling contract is responsible for checking balance.
func (c *burn) Run(input []byte, ctx *precompileContext) ([]byte, error) {
if ctx.caller != common.HexToAddress(whitelistCreate2Addr) {
@ -128,11 +131,6 @@ func (c *burn) Run(input []byte, ctx *precompileContext) ([]byte, error) {
return nil, fmt.Errorf("Error parsing transfer: unable to parse value from " + hexutil.Encode(input[32:64]))
}
if !ctx.CanTransfer(ctx.evm.StateDB, burnFrom, value) {
log.Error("Error parsing transfer, address: " + burnFrom.Hex() + " has insufficient balance. " +
value.String() + " needed " + ctx.evm.StateDB.GetBalance(burnFrom).String() + " available")
return nil, ErrInsufficientBalance
}
ctx.evm.StateDB.SubBalance(burnFrom, value)
return input, nil

View file

@ -38,4 +38,4 @@ mevcommitsettlement:
# Partial override sepolia config for custom rpc
sepolia:
rpcUrls:
- http: https://1rpc.io/sepolia
- http: https://eth-sepolia.g.alchemy.com/v2/a0wg_g1X-Wz4IeVA-0SS3PsQhbyQNjc_

View file

@ -2,6 +2,8 @@
set -x
set -e
# TODO: Stress test bridge back to sepolia, including not having enough balance on sidechain.
read -p "Has the whitelist contract been deployed, updated with hypERC20 addr, and have router addresss been pasted into this file? (y/n): " answer
if [ "$answer" = "y" ]; then
echo "Continuing with bridging process..."