Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
dca7e8a
exclude IDEs
blewater Nov 17, 2023
59fc6db
Enhance controller to handle Std Eth requests
blewater Nov 19, 2023
f8229b5
Handle special revert case
blewater Nov 19, 2023
3c141a3
Add RPC methods getBlock, getMaxPriorityFeeGasPrice
blewater Nov 20, 2023
76c6fd4
Remove getBlockByNumber
blewater Nov 21, 2023
ad83e1a
Optimize map initialization
blewater Nov 21, 2023
b011f97
Refactor with raw json
blewater Nov 21, 2023
34cf02c
bootstrap geth in unit tests
blewater Nov 23, 2023
d7d49ae
set initial account balances
blewater Nov 23, 2023
abca43f
Add dotenv mod
blewater Nov 23, 2023
7921070
Add signer key from .env
blewater Nov 24, 2023
dba36f9
Document e2e README.md finds
blewater Nov 24, 2023
8e173a9
Rename eth client for clarity.
blewater Nov 27, 2023
b8e6115
Add print utilities for userOp, ctx
blewater Nov 27, 2023
962212a
Add debug RPC method for Bundler state
blewater Nov 27, 2023
6b82831
Testing deploy to ECR.
Nov 27, 2023
124f495
feat: add conf solver URL, add solver http client
blewater Nov 29, 2023
d357f24
feat: add conf solver url to bundler
blewater Nov 29, 2023
c962c67
feat: Partial intents solving
blewater Nov 29, 2023
11fb431
feat: include intent, upg go, mods
blewater Nov 29, 2023
8039b66
feat: add get userOp deposits
blewater Nov 29, 2023
6013086
build: remove unused imports
blewater Nov 29, 2023
682cd71
feat: add flow to solve intent userOps
blewater Nov 30, 2023
394b23d
feat: Link Solver side effects to original batch
blewater Nov 30, 2023
1662a7e
fix: resp, url...
blewater Nov 30, 2023
7414a56
feat: Hardcode intent prefix till full integration
blewater Nov 30, 2023
8910e2f
chore!: Rename to model the intents deps
blewater Dec 1, 2023
43c3c85
feat: Add debugging getDeposits dump method
blewater Dec 1, 2023
dc9999e
Merge branch 'main' into proxy-ethnode
blewater Dec 1, 2023
6c46948
chore: Merge branch 'main' into intents
blewater Dec 1, 2023
5ad6ed4
fix: Downgrade deps to heal Bundler
blewater Dec 1, 2023
fcc859f
fix: Remove redundant call
blewater Dec 1, 2023
b45cf60
Adding deploy script.
Dec 4, 2023
5875d26
feat: Add solving intents when receiving userOps
blewater Dec 4, 2023
cb013f8
chore: Merge up to dec 5th changes
blewater Dec 5, 2023
89164b6
chore: Merge up to dec 5th changes, gh actions
blewater Dec 5, 2023
541ba6c
feat: Add queue, tests
blewater Dec 6, 2023
258235b
feat: Plug q for intents buffer
blewater Dec 6, 2023
c5f4b7b
feat: Add userOps send script, parse hex callData, json intent
blewater Dec 6, 2023
3869085
chore: Rename for clarity
blewater Dec 7, 2023
93c4fec
chore: Adjust limits, value for testing
blewater Dec 7, 2023
c56a8b0
feat: Add client Intents buffer implementation
blewater Dec 7, 2023
9ae3ff0
chore: Clarify flow
blewater Dec 7, 2023
c0f4adb
feat: Sign
blewater Dec 9, 2023
9e5b64e
chore: Remove previous Solver integration
blewater Dec 12, 2023
a00f858
chore: Remove intent detection at userOp object
blewater Dec 12, 2023
fb0e666
feat: Add intents solver module
blewater Dec 12, 2023
a2a9636
feat: add self-verifying signing functions
blewater Dec 13, 2023
f4c2e35
fix: Use reference userOp to use custom JSON marshaller
blewater Dec 13, 2023
29e72a9
chore: Remove obsolete changes
blewater Dec 13, 2023
84b4986
feat: Retrieve nonce and chainID from env node url
blewater Dec 13, 2023
cf33ce8
fix: Solver url default, value
blewater Dec 13, 2023
7bc0832
feat: Process Intent UserOps changes
blewater Dec 13, 2023
d83b63e
fix: comment
blewater Dec 13, 2023
4e9b965
feat: Refactor and add zero gas userOps
blewater Dec 14, 2023
c65e2da
feat: Support 0 gas userOps, integrate Solver solution
blewater Dec 14, 2023
f0a698a
chore: remove obsolete files
blewater Dec 15, 2023
e0afed5
feat: set zero gas userOps option default
blewater Dec 15, 2023
9423222
chore: Remove obsolete change
blewater Dec 15, 2023
f23ec22
fix: Clarify comments
blewater Dec 15, 2023
7dd6bbd
fix: Restore compatibility with conventional userOps
blewater Dec 15, 2023
81504e0
fix: Address comment
blewater Dec 15, 2023
a304ad0
latest up to Dec 10th (#5)
blewater Dec 18, 2023
bc6f060
Merge branch 'intents' into proxy-ethnode
blewater Dec 18, 2023
22544cc
Latest on Intents with latest from syncing Main (#7)
blewater Dec 18, 2023
f6bc075
fix: Remove loc side effect from merging
blewater Dec 18, 2023
4e4e57b
Merge branch 'main' into proxy-ethnode
blewater Dec 18, 2023
2210c9f
Merge remote-tracking branch 'origin/main' into proxy-ethnode
blewater Dec 19, 2023
5e8e6b5
chore: Change EoA owner
blewater Dec 22, 2023
8792bef
chore: Add v0.8 model
blewater Dec 23, 2023
f525940
chore: Comment in likely redundant signing
blewater Dec 29, 2023
3f744b4
fix: Comply with yellow paper V setting
blewater Dec 30, 2023
dd6994f
feat: upgrade model to v0.9 to support intent chain-id
blewater Jan 3, 2024
7b8cbbd
feat: Set chain-id in Intent
blewater Jan 3, 2024
62b475f
feat: Upgrade model dependency to Intent userOp spec
blewater Jan 23, 2024
3568010
refactor: Replace set with copy userOps solutions
blewater Jan 24, 2024
2fa1d2e
fix: Sync intent checks against latest model spec
blewater Jan 25, 2024
ae1b2c4
feat: Process handleOps error
blewater Jan 25, 2024
3efb308
feat: Upgrade model to 16
blewater Feb 2, 2024
e116aaa
Correcting workflow to use correct variables.
Feb 5, 2024
06db404
[ BDH-177 ] Upgrade to support Solver after the staking model upgrade…
blewater Feb 15, 2024
998b809
chore: Remove unused files (#11)
blewater Feb 15, 2024
96bdd98
Add solver URL.
Feb 16, 2024
21c52b9
fix: Add missing env variable (#12)
blewater Feb 16, 2024
2928c35
Seeksolverurl (#13)
blewater Feb 16, 2024
149b464
Creating new stack-bundler instance.
Feb 19, 2024
c3bcfa3
Removing new stack-bundler instance.
Feb 20, 2024
b3c9e47
feat!: Do not reprocess failed userOps (#14)
blewater Feb 21, 2024
1aba8a8
feat: Print trx hash
blewater Mar 15, 2024
8f67c52
fix: Change solver url
blewater Mar 15, 2024
117b515
Retry when Solver communication fails, printing enhancements (#15)
blewater Mar 15, 2024
a8450cc
feat: solver drop print enhancement (#16)
blewater Mar 15, 2024
40793ee
feat: eth_getUserOperationReceipt to report whether in mempool (#17)
blewater Mar 26, 2024
129e4cf
make sure to not update geth (#18)
adelowo Apr 4, 2024
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
66 changes: 66 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Deploy to ECR

on:

push:
branches: [ proxy-ethnode, test ]

jobs:

build:

name: Build Image
runs-on: ubuntu-latest

steps:

- name: Check out code
uses: actions/checkout@v2

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ vars.AWS_REPOSITORY }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
deploy:
name: Deploy Image and Env Variables
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy
uses: peterkimzz/aws-ssm-send-command@master
id: deploy
with:
aws-region: ${{ vars.AWS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
instance-ids: ${{ secrets.INSTANCE_ID }}
working-directory: /root/stackup-bundler
command: |
aws ecr get-login-password --region ${{ vars.AWS_REGION }} | docker login --username AWS --password-stdin ${{ vars.ECR_URL }}
yq w -i docker-compose.yaml 'services.stackup-bundler.image' ${{ vars.ECR_URL }}/${{ vars.AWS_REPOSITORY }}:${{ github.sha }}
yq w -i docker-compose.yaml 'services.stackup-bundler.environment[0]' "ERC4337_BUNDLER_ETH_CLIENT_URL=${{ vars.ERC4337_BUNDLER_ETH_CLIENT_URL }}"
yq w -i docker-compose.yaml 'services.stackup-bundler.environment[1]' "ERC4337_BUNDLER_PRIVATE_KEY=${{ secrets.ERC4337_BUNDLER_PRIVATE_KEY }}"
yq w -i docker-compose.yaml 'services.stackup-bundler.environment[2]' "ERC4337_BUNDLER_MAX_BATCH_GAS_LIMIT=${{ vars.ERC4337_BUNDLER_MAX_BATCH_GAS_LIMIT }}"
yq w -i docker-compose.yaml 'services.stackup-bundler.environment[3]' "ERC4337_BUNDLER_DEBUG_MODE=${{ vars.ERC4337_BUNDLER_DEBUG_MODE }}"
yq w -i docker-compose.yaml 'services.stackup-bundler.environment[4]' "SOLVER_URL=${{ vars.SOLVER_URL }}"
docker-compose up -d

# Catch SSM outputs
- name: Get the outputs from Deploy image
run: echo "The Command id is ${{ steps.deploy.outputs.command-id }}"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@
.DS_Store
tmp
.env

# Goland ide
.idea

# v code
launch.json
57 changes: 49 additions & 8 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ Below are instructions on how to run a series of E2E tests to check that everyth

The steps in the following section assumes that all these tools have been installed and ready to go.

- Node.JS >= 18
- [Geth](https://geth.ethereum.org/docs/getting-started/installing-geth)
- Node.JS = 18
- [Geth](tested with 1.13.5 https://geth.ethereum.org/docs/getting-started/installing-geth)

## Setting the environment

To reduce the impact of external factors, we'll run the E2E test using an isolated local instance of both geth and the bundler.

First, we'll need to run a local instance of geth with the following command:
First, in a new tab/pane run a local instance of geth with the following command:

```bash
geth \
Expand All @@ -34,19 +34,26 @@ geth \
--miner.gaslimit 12000000
```

In a separate process, navigate to the [eth-infinitism/account-abstraction](https://github.com/eth-infinitism/account-abstraction/) directory and run the following command to deploy the required contracts:
In a separate process,
- Clone [eth-infinitism/account-abstraction](https://github.com/eth-infinitism/account-abstraction/)
- Checkout the latest tag that is live on mainnet, currently v0.6.0
- ```yarn install```
- Run the following command to deploy the required contracts:

```bash
yarn deploy --network localhost
```

Next, navigate to the [stackup-wallet/contracts](https://github.com/stackup-wallet/contracts) directory and run the following command to deploy the supporting test contracts:
- Navigate to the [stackup-wallet/contracts](https://github.com/stackup-wallet/contracts) directory.
- ```yarn install```
- Run the following command to deploy the supporting test contracts:

```bash
yarn deploy:AllTest --network localhost
```

Lastly, run the bundler with the following config:
- In a new pane/tab `cd ../` to [github.com/blndgs/stackup-bundler](https://github.com/blndgs/stackup-bundler)
- Set the following environment variables:

```
ERC4337_BUNDLER_ETH_CLIENT_URL=http://localhost:8545
Expand All @@ -55,10 +62,44 @@ ERC4337_BUNDLER_MAX_BATCH_GAS_LIMIT=12000000
ERC4337_BUNDLER_DEBUG_MODE=true
```

Run the bundler with the following config:
`make dev-private-mode`

## Running the test suite

Assuming you have your environment properly setup, you can use the following commands to run the QA test suite.
- Navigate to stackup-wallet/e2e directory (`cd ./e2e`)
- ```yarn install```
- check the contents of the `config.json` file to ensure the `private key` matches the `ERC4337_BUNDLER_PRIVATE_KEY` environment variable set above.
- Use the following command to run the eth_infinitism test suite.

```bash
yarn run test
yarn run test # see note below if you get a sender_address error
```

** _Note: try the following step_
edit the `setup.ts` file and hardcode the `config.ts` contents into a config object. This is a temporary workaround until a solution for reading `config.ts`.

```typescript
import { fundIfRequired } from "./src/helpers";
// import config from "./config";

const config = {
// This is for testing only. DO NOT use in production.
// signingKey: '19b8ac9d574d2dcddc3b9f3ae29aec0bb1f13519c8eed4ff8ddcee642076d689',
signingKey:
"c6cbc5ffad570fdad0544d1b5358a36edeb98d163b6567912ac4754e144d4edb",
nodeUrl: "http://localhost:8545",
bundlerUrl: "http://localhost:4337",

// https://github.com/stackup-wallet/contracts/blob/main/contracts/test
testERC20Token: "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B",
testGas: "0xc2e76Ee793a194Dd930C18c4cDeC93E7C75d567C",
testAccount: "0x3dFD39F2c17625b301ae0EF72B411D1de5211325",
};

// no changes below this line
export default async function () {
// ...
```

try again with `yarn run test`
53 changes: 28 additions & 25 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ module github.com/stackup-wallet/stackup-bundler
go 1.20

require (
github.com/blndgs/model v0.18.1
github.com/deckarep/golang-set/v2 v2.3.0
github.com/dgraph-io/badger/v3 v3.2103.5
github.com/ethereum/go-ethereum v1.11.5
github.com/gin-contrib/cors v1.4.0
github.com/gin-gonic/gin v1.9.0
github.com/gin-gonic/gin v1.9.1
github.com/go-logr/logr v1.2.4
github.com/go-logr/zerologr v1.2.3
github.com/go-playground/validator/v10 v10.12.0
github.com/go-playground/validator/v10 v10.19.0
github.com/goccy/go-json v0.10.2
github.com/google/go-cmp v0.5.9
github.com/metachris/flashbotsrpc v0.6.0
github.com/mitchellh/mapstructure v1.5.0
github.com/pkg/errors v0.9.1
github.com/puzpuzpuz/xsync/v3 v3.0.1
github.com/rs/zerolog v1.29.0
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
Expand All @@ -30,73 +33,73 @@ require (
go.opentelemetry.io/otel/sdk/metric v0.39.0
go.opentelemetry.io/otel/trace v1.16.0
golang.org/x/sync v0.1.0
golang.org/x/text v0.9.0
golang.org/x/text v0.14.0
google.golang.org/grpc v1.55.0
)

require (
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect
github.com/bytedance/sonic v1.8.0 // indirect
github.com/bytedance/sonic v1.11.3 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.1.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/flatbuffers v1.12.1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/holiman/uint256 v1.2.0 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/leodido/go-urn v1.2.2 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.9 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
google.golang.org/protobuf v1.30.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading