Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

latest p2p spec & one bundler - one chain #172

Merged
merged 23 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from 21 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: 19 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
browser: true,
es6: true,
node: true,
jest: true,
mocha: true,
},
globals: {
BigInt: true,
Expand Down Expand Up @@ -161,14 +161,25 @@ module.exports = {
},
{
files: ["**/test/**/*.test.ts"],
plugins: ["jest"],
plugins: ["mocha", "chai-expect"],
extends: ["plugin:mocha/recommended", "plugin:chai-expect/recommended"],
rules: {
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "error"
}
// We observed that having multiple top level "describe" save valuable indentation
// https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/docs/rules/max-top-level-suites.md
"mocha/max-top-level-suites": "off",
// We need to disable because we disabled "mocha/no-setup-in-describe" rule
// TODO: Move all setup code to before/beforeEach and then disable async describe
// https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/docs/rules/no-async-describe.md
"mocha/no-async-describe": "off",
// Use of arrow functions are very common
"mocha/no-mocha-arrows": "off",
// It's common to call function inside describe block
// https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/docs/rules/no-setup-in-describe.md
"mocha/no-setup-in-describe": "off",
// We use to split before in small isolated tasks
// https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/docs/rules/no-sibling-hooks.md
"mocha/no-sibling-hooks": "off",
},
},
{
files: ["**/types/**/*.ts"],
Expand Down
4 changes: 4 additions & 0 deletions .mocharc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extension: ["ts"]
colors: true
node-option:
- "loader=ts-node/esm"
102 changes: 44 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ Or follow the steps below:
4. edit `config.json`
5. (optional) run local geth-node from `test/geth-dev`
6. run `./skandha`
7. Skandha will run for all chains available in `config.json`
8. Networks will be available at `http://localhost:14337/{chainId}/` (e.g. for dev `http://localhost:14337/1337/`)
7. The bundler will be available on `http://localhost:14337/rpc/`

For a video tutorial on the above, you can [view this here.](https://www.youtube.com/watch?v=O0_lm7b0GXE)

Expand All @@ -70,66 +69,56 @@ For a video tutorial on the above, you can [view this here.](https://www.youtube
#### Simplest config.json
```yaml
{
"networks": {
"mumbai": {
"entryPoints": [
"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
],
"relayers": [
"0x{RELAYER-PRIVATE-KEY}"
],
"beneficiary": "0x{BENEFICIARY-ADDRESS}",
"rpcEndpoint": "https://polygon-mumbai.blockpi.network/v1/rpc/public"
}
}
"entryPoints": [
"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
],
"relayer": "0x{RELAYER-PRIVATE-KEY}",
"beneficiary": "0x{BENEFICIARY-ADDRESS}",
"rpcEndpoint": "https://polygon-mumbai.blockpi.network/v1/rpc/public"
}
```

#### config.json with a default value of each config parameter

```yaml
{
"networks": {
"dev": { # network Id (check packages/params/src/networks/<network>.ts)
"entryPoints": [ # supported entry points
"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
],
"relayers": [
"0x0101010101010101010101010101010101010101010101010101010101010101",
"test test test test test test test test test test test junk"
], # relayers private keys, can access from here or via environment variables (SKANDHA_MUMBAI_RELAYERS | SKANDHA_DEV_RELAYERS | etc.)
"beneficiary": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", # optional, fee collector, avaiable via env var (SKANDHA_MUMBAI_BENEFICIARY | etc) - if not set, relayer will be used
"rpcEndpoint": "http://localhost:8545", # rpc provider, also available via env variable (SKANDHA_MUMBAI_RPC | etc)
"minInclusionDenominator": 10, # optional, see EIP-4337
"throttlingSlack": 10, # optional, see EIP-4337
"banSlack": 50 # optional, see EIP-4337
"minStake": 10000000000, # optional, min stake of an entity (in wei)
"minUnstakeDelay": 0, # optional, min unstake delay of an entity
"minSignerBalance": 1, # optional, default is 0.1 ETH. If the relayer's balance drops lower than this, it will be selected as a fee collector
"multicall": "0xcA11bde05977b3631167028862bE2a173976CA11", # optional, multicall3 contract (see https://github.com/mds1/multicall#multicall3-contract-addresses)
"estimationStaticBuffer": 21000, # optional,adds certain amount of gas to callGasLimit on estimation
"validationGasLimit": 10e6, # optional,gas limit during simulateHandleOps and simulateValidation calls
"receiptLookupRange": 1024, # optional,limits the block range of getUserOperationByHash and getUserOperationReceipt
"etherscanApiKey": "", # optional,etherscan api is used to fetch gas prices
"conditionalTransactions": false, # optional,enable conditional transactions
"rpcEndpointSubmit": "", # optional,rpc endpoint that is used only during submission of a bundle
"gasPriceMarkup": 0, # optional,adds % markup on reported gas price via skandha_getGasPrice, 10000 = 100.00%, 500 = 5%
"enforceGasPrice": false, # optional,do not bundle userops with low gas prices
"enforceGasPriceThreshold": 1000, # optional,gas price threshold in bps. If set to 500, userops' gas price is allowed to be 5% lower than the network's gas price
"eip2930": false, # optional, enables eip-2930
"useropsTTL": 300, # optional, Userops time to live (in seconds)
"whitelistedEntities": { # optional, Entities that bypass stake and opcode validation (array of addresses)
"factory": [],
"paymaster": [],
"account": []
},
"bundleGasLimitMarkup": 25000, # optional, adds some amount of additional gas to a bundle tx
"relayingMode": "classic"; # optional, "flashbots" for Flashbots Builder API, "merkle" for Merkle.io, "kolibri" for kolibr.io, "echo" for Chainbound's Echo
"bundleInterval": 10000, # bundle creation interval
"bundleSize": 4, # optional, max size of a bundle, 4 userops by default
"pvgMarkup": 0 # optional, adds some gas on top of estimated PVG
}
}
"entryPoints": [ # supported entry points
"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
],
"relayers": [
"0x0101010101010101010101010101010101010101010101010101010101010101",
"test test test test test test test test test test test junk"
], # relayers private keys, can access from here or via environment variables (SKANDHA_MUMBAI_RELAYERS | SKANDHA_DEV_RELAYERS | etc.)
"beneficiary": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", # optional, fee collector, avaiable via env var (SKANDHA_MUMBAI_BENEFICIARY | etc) - if not set, relayer will be used
"rpcEndpoint": "http://localhost:8545", # rpc provider, also available via env variable (SKANDHA_MUMBAI_RPC | etc)
"minInclusionDenominator": 10, # optional, see EIP-4337
"throttlingSlack": 10, # optional, see EIP-4337
"banSlack": 50 # optional, see EIP-4337
"minStake": 10000000000, # optional, min stake of an entity (in wei)
"minUnstakeDelay": 0, # optional, min unstake delay of an entity
"minSignerBalance": 1, # optional, default is 0.1 ETH. If the relayer's balance drops lower than this, it will be selected as a fee collector
"multicall": "0xcA11bde05977b3631167028862bE2a173976CA11", # optional, multicall3 contract (see https://github.com/mds1/multicall#multicall3-contract-addresses)
"estimationStaticBuffer": 21000, # optional,adds certain amount of gas to callGasLimit on estimation
"validationGasLimit": 10e6, # optional,gas limit during simulateHandleOps and simulateValidation calls
"receiptLookupRange": 1024, # optional,limits the block range of getUserOperationByHash and getUserOperationReceipt
"etherscanApiKey": "", # optional,etherscan api is used to fetch gas prices
"conditionalTransactions": false, # optional,enable conditional transactions
"rpcEndpointSubmit": "", # optional,rpc endpoint that is used only during submission of a bundle
"gasPriceMarkup": 0, # optional,adds % markup on reported gas price via skandha_getGasPrice, 10000 = 100.00%, 500 = 5%
"enforceGasPrice": false, # optional,do not bundle userops with low gas prices
"enforceGasPriceThreshold": 1000, # optional,gas price threshold in bps. If set to 500, userops' gas price is allowed to be 5% lower than the network's gas price
"eip2930": false, # optional, enables eip-2930
"useropsTTL": 300, # optional, Userops time to live (in seconds)
"whitelistedEntities": { # optional, Entities that bypass stake and opcode validation (array of addresses)
"factory": [],
"paymaster": [],
"account": []
},
"bundleGasLimitMarkup": 25000, # optional, adds some amount of additional gas to a bundle tx
"relayingMode": "classic"; # optional, allows to switch to Flashbots Builder api if set to "flashbots", see packages/executor/src/interfaces.ts for more
"bundleInterval": 10000, # bundle creation interval
"bundleSize": 4, # optional, max size of a bundle, 4 userops by default
"pvgMarkup": 0 # optional, adds some gas on top of estimated PVG
}
```
## 💬 Contact
Expand All @@ -149,9 +138,6 @@ Licensed under the [MIT License](https://github.com/etherspot/skandha/blob/maste
- Mumbai | QmQfRyE9iVTBqZ17hPSP4tuMzaez83Y5wD874ymyRtj9VE | https://ipfs.io/ipfs/QmQfRyE9iVTBqZ17hPSP4tuMzaez83Y5wD874ymyRtj9VE?filename=mumbai_canonical_mempool.yaml
- Goerli | QmTmj4cizhWpEFCCqk5dP67yws7R2PPgCtb2bd2RgVPCbF | https://ipfs.io/ipfs/QmTmj4cizhWpEFCCqk5dP67yws7R2PPgCtb2bd2RgVPCbF?filename=goerli_canonical_mempool.yaml

> [!WARNING]
> This version of the bundler is not compatible with the latest p2p-spec. If you're looking to run a P2P-bundler, switch to this branch - https://github.com/etherspot/skandha/tree/version1-p2p

## 🔢 Statistics
![Alt](https://repobeats.axiom.co/api/embed/4d7ec3ece88b2461c5b1757574321f4f6540cdd5.svg "Skandha analytics image")

Expand Down
20 changes: 8 additions & 12 deletions config.json.default
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{
"networks": {
"dev": {
"entryPoints": [
"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
],
"relayers": [
"test test test test test test test test test test test junk",
"0x0101010101010101010101010101010101010101010101010101010101010101"
],
"rpcEndpoint": "http://localhost:8545"
}
}
"entryPoints": [
"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
],
"relayers": [
"test test test test test test test test test test test junk",
"0x0101010101010101010101010101010101010101010101010101010101010101"
],
"rpcEndpoint": "http://localhost:8545"
}
183 changes: 0 additions & 183 deletions jest.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "1.0.49-alpha",
"version": "1.5.3",
"stream": "true",
"command": {
"version": {
Expand Down
Loading
Loading