Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
Replace all bytes in signature with 01 to reduce variability in PVG e…
Browse files Browse the repository at this point in the history
…stimate (#154)
  • Loading branch information
hazim-j authored Apr 26, 2023
1 parent b14d8bb commit 66c4fe0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package client

import (
"bytes"
"errors"
"math/big"

Expand Down Expand Up @@ -177,13 +178,15 @@ func (i *Client) EstimateUserOperationGas(op map[string]any, ep string) (*gas.Ga
}
data["verificationGasLimit"] = hexutil.EncodeBig(big.NewInt(int64(vg)))
data["callGasLimit"] = hexutil.EncodeBig(big.NewInt(int64(cg)))
data["signature"] = hexutil.Encode(bytes.Repeat([]byte{1}, len(userOp.Signature)))
userOp, err = userop.New(data)
if err != nil {
l.Error(err, "eth_estimateUserOperationGas error")
return nil, err
}

// Return gas values with a PVG calculation that takes into account updated gas limits.
// Return gas values with a PVG calculation that takes into account updated gas limits and a signature
// with no zero bytes.
l.Info("eth_estimateUserOperationGas ok")
return &gas.GasEstimates{
PreVerificationGas: gas.NewDefaultOverhead().CalcPreVerificationGas(userOp),
Expand Down

0 comments on commit 66c4fe0

Please sign in to comment.