Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
cherry-yl-sh committed May 13, 2024
1 parent 2007438 commit 6f7afa8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 23 deletions.
17 changes: 0 additions & 17 deletions common/user_op/user_operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,23 +267,6 @@ type UserOpInput struct {
ComputeGasOnly bool
}

func packUserOpV6ForUserOpHash(userOp *UserOperationV06) (string, []byte, error) {
//TODO disgusting logic
encoded, err := userOpV06PackArg.Pack(userOp.Sender, userOp.Nonce, userOp.InitCode, userOp.CallData, userOp.CallGasLimit, userOp.VerificationGasLimit, userOp.PreVerificationGas, userOp.MaxFeePerGas, userOp.MaxPriorityFeePerGas, global_const.DummyPaymasterDataByte, userOp.Sender)
if err != nil {
return "", nil, err
}
//https://github.com/jayden-sudo/SoulWalletCore/blob/dc76bdb9a156d4f99ef41109c59ab99106c193ac/contracts/utils/CalldataPack.sol#L51-L65
hexString := hex.EncodeToString(encoded)
//1. get From 63*10+ 1 ~64*10
hexString = hexString[64:]
//hexLen := len(hexString)
subIndex := GetIndex(hexString)
hexString = hexString[:subIndex]
//fmt.Printf("subIndex: %d\n", subIndex)
return hexString, encoded, nil
}

func (userOp *UserOpInput) PackUserOpForMock(version global_const.EntrypointVersion) (string, []byte, error) {
if version == global_const.EntrypointV07 {
gasFee := utils.PackIntTo32Bytes(userOp.MaxPriorityFeePerGas, userOp.MaxFeePerGas)
Expand Down
7 changes: 4 additions & 3 deletions gas_executor/pre_vertification_gas.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func ArbitrumPreVerificationGasFunc() PreVerificationGasFunc {
if err != nil {
return nil, err
}
big.NewInt(0).Add(base, big.NewInt(int64(estimateOutPut.GasEstimateForL1)))
return big.NewInt(0), nil

return big.NewInt(0).Add(base, big.NewInt(int64(estimateOutPut.GasEstimateForL1))), nil
}
}
func DefaultPreVerificationGasFunc() PreVerificationGasFunc {
Expand Down Expand Up @@ -116,7 +116,8 @@ func getBasicPreVerificationGas(op *user_op.UserOpInput, strategy *model.Strateg
callDataConst += global_const.GasOverHand.NonZeroByte
}
}
floatRes := math.Round(callDataConst + global_const.GasOverHand.Fixed/global_const.GasOverHand.BundleSize + global_const.GasOverHand.PerUserOp + global_const.GasOverHand.PerUserOpWord*lengthInWord)
floatRes := math.Round(callDataConst + global_const.GasOverHand.Fixed/global_const.GasOverHand.BundleSize +
global_const.GasOverHand.PerUserOp + global_const.GasOverHand.PerUserOpWord*lengthInWord)
floatVal := new(big.Float).SetFloat64(floatRes)
result := new(big.Int)
floatVal.Int(result)
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/NethermindEth/starknet.go v0.7.0
github.com/appleboy/gin-jwt/v2 v2.9.2
github.com/deckarep/golang-set/v2 v2.6.0
github.com/ethereum/go-ethereum v1.13.14
github.com/ethereum/go-ethereum v1.14.3
github.com/gin-contrib/cors v1.7.1
github.com/gin-gonic/gin v1.9.1
github.com/go-playground/validator/v10 v10.19.0
Expand Down Expand Up @@ -57,10 +57,10 @@ require (
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect; indirect(force degrade)
github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect; indirect(force degrade)
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect; indirect (force degrade)
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect; indirect (force degrade)
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 h1:d28BXYi+wUp
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs=
github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA=
github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc=
github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI=
github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -70,8 +72,12 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnN
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0=
github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY=
github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA=
github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/ethereum/go-ethereum v1.13.14 h1:EwiY3FZP94derMCIam1iW4HFVrSgIcpsu0HwTQtm6CQ=
github.com/ethereum/go-ethereum v1.13.14/go.mod h1:TN8ZiHrdJwSe8Cb6x+p0hs5CxhJZPbqB7hHkaUXcmIU=
github.com/ethereum/go-ethereum v1.14.3 h1:5zvnAqLtnCZrU9uod1JCvHWJbPMURzYFHfc2eHz4PHA=
github.com/ethereum/go-ethereum v1.14.3/go.mod h1:1STrq471D0BQbCX9He0hUj4bHxX2k6mt5nOQJhDNOJ8=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
Expand Down

0 comments on commit 6f7afa8

Please sign in to comment.