Skip to content
Open
Show file tree
Hide file tree
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
27 changes: 22 additions & 5 deletions bundler/src/eth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,35 @@ func Simulate(ctx context.Context, op abi.UserOperation) error {

func HandleOps(ctx context.Context, ops []abi.UserOperation) (txHash string, err error) {
// Init contract
entrypoint, err := abi.NewEntryPoint(config.GetEntrypointContractAddress(), client)
contract := config.GetEntrypointContractAddress()
bundler := config.GetBundlerAddress()
entrypoint, err := abi.NewEntryPoint(contract, client)
if err != nil {
return "", err
}
transactOps, err := bind.NewKeyedTransactorWithChainID(config.GetBundler(), config.GetChainID())

// Simulate once to get gas usage
estimateTxOps, err := bind.NewKeyedTransactorWithChainID(config.GetBundler(), config.GetChainID())
if err != nil {
return "", xerrors.Errorf("Failed to create transactor for bundler: %w", err)
}
estimateTxOps.Context = ctx
estimateTxOps.NoSend = true
estimateTx, err := entrypoint.HandleOps(estimateTxOps, ops, bundler)
if err != nil {
return "", err
}

// Send it
txOps, err := bind.NewKeyedTransactorWithChainID(config.GetBundler(), config.GetChainID())
if err != nil {
return "", xerrors.Errorf("Failed to create transactor for bundler: %w", err)
}
transactOps.Context = ctx
transactOps.GasLimit *= 2 // FIXME: sometimes estimated gas is wrong.
txOps.Context = ctx
txOps.GasLimit = estimateTx.Gas() * 2
txOps.NoSend = false

tx, err := entrypoint.HandleOps(transactOps, ops, config.GetBundlerAddress())
tx, err := entrypoint.HandleOps(txOps, ops, bundler)
if err != nil {
return "", err
}
Expand Down
56 changes: 28 additions & 28 deletions bundler/src/go.mod
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
require (
github.com/aws/aws-lambda-go v1.23.0
github.com/aws/aws-lambda-go v1.37.0
github.com/aws/aws-sdk-go-v2 v1.17.4
github.com/ethereum/go-ethereum v1.10.26
github.com/stretchr/testify v1.7.2
github.com/stretchr/testify v1.8.0
)

require (
github.com/aws/aws-sdk-go-v2 v1.17.1 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.0 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.19 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.25 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.19 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.26 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.19 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.11.25 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.8 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.17.2 // indirect
github.com/aws/smithy-go v1.13.4 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.12 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.22 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.28 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.22 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.29 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.22 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.12.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.18.3 // indirect
github.com/aws/smithy-go v1.13.5 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rjeczalik/notify v0.9.1 // indirect
github.com/rjeczalik/notify v0.9.3 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

require (
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/aws/aws-sdk-go-v2/config v1.18.0
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.5
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/aws/aws-sdk-go-v2/config v1.18.12
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.18.3
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/sirupsen/logrus v1.9.0
github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/numcpus v0.6.0 // indirect
golang.org/x/crypto v0.6.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
)
Expand Down
Loading