-
Notifications
You must be signed in to change notification settings - Fork 60
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
feat: multiple executors #138
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c579956
feat: multiple relayers
0xSulpiride 6b6a8e9
chore(release): 1.0.30-alpha
0xSulpiride a004da7
update readme
0xSulpiride bcd71af
update default config
0xSulpiride 6224c33
fix getUserOpByHash
0xSulpiride b8d4d01
fix tests & update readme
0xSulpiride File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "cli", | ||
"version": "1.0.29-alpha", | ||
"version": "1.0.30-alpha", | ||
"description": "> TODO: description", | ||
"author": "zincoshine <[email protected]>", | ||
"homepage": "https://https://github.com/etherspot/skandha#readme", | ||
|
@@ -38,15 +38,15 @@ | |
"@libp2p/peer-id-factory": "2.0.1", | ||
"@libp2p/prometheus-metrics": "1.1.3", | ||
"@multiformats/multiaddr": "12.1.3", | ||
"api": "^1.0.29-alpha", | ||
"db": "^1.0.29-alpha", | ||
"executor": "^1.0.29-alpha", | ||
"api": "^1.0.30-alpha", | ||
"db": "^1.0.30-alpha", | ||
"executor": "^1.0.30-alpha", | ||
"find-up": "5.0.0", | ||
"got": "12.5.3", | ||
"js-yaml": "4.1.0", | ||
"monitoring": "^1.0.29-alpha", | ||
"node": "^1.0.29-alpha", | ||
"types": "^1.0.29-alpha", | ||
"monitoring": "^1.0.30-alpha", | ||
"node": "^1.0.30-alpha", | ||
"types": "^1.0.30-alpha", | ||
"yargs": "17.6.2" | ||
}, | ||
"devDependencies": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,26 +39,28 @@ export class Config { | |
return endpoint ? new providers.JsonRpcProvider(endpoint) : null; | ||
} | ||
|
||
getRelayer(network: string): Wallet | providers.JsonRpcSigner | null { | ||
getRelayers(network: string): Wallet[] | providers.JsonRpcSigner[] | null { | ||
const config = this.getNetworkConfig(network); | ||
if (!config) return null; | ||
|
||
// fetch from env variables first | ||
const privKey = config.relayer; | ||
const provider = this.getNetworkProvider(network); | ||
if (!provider) { | ||
throw new Error("no provider"); | ||
} | ||
|
||
if (this.testingMode) { | ||
return provider.getSigner(); | ||
return [provider.getSigner()]; | ||
} | ||
|
||
if (privKey.startsWith("0x")) { | ||
return new Wallet(privKey, provider); | ||
const wallets = []; | ||
for (const privKey of config.relayers) { | ||
if (privKey.startsWith("0x")) { | ||
wallets.push(new Wallet(privKey, provider)); | ||
} else { | ||
wallets.push(Wallet.fromMnemonic(privKey).connect(provider)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean we can also use a mnemonic? If so we need to document that in README.md There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, we can use mnemonics. Added it in README |
||
} | ||
} | ||
|
||
return Wallet.fromMnemonic(privKey).connect(provider); | ||
return wallets; | ||
} | ||
|
||
getBeneficiary(network: string): string | null { | ||
|
@@ -158,11 +160,19 @@ export class Config { | |
conf.entryPoints, | ||
true | ||
) as string[]; | ||
conf.relayer = fromEnvVar(network, "RELAYER", conf.relayer) as string; | ||
|
||
conf.relayer = fromEnvVar(network, "RELAYER", conf.relayer) as string; // deprecated | ||
conf.relayers = fromEnvVar( | ||
network, | ||
"RELAYERS", | ||
conf.relayers ?? [conf.relayer], // fallback to `relayer` if `relayers` not found | ||
true | ||
) as string[]; | ||
|
||
conf.beneficiary = fromEnvVar( | ||
network, | ||
"BENEFICIARY", | ||
conf.beneficiary | ||
conf.beneficiary || bundlerDefaultConfigs.beneficiary | ||
) as string; | ||
conf.rpcEndpoint = fromEnvVar(network, "RPC", conf.rpcEndpoint) as string; | ||
|
||
|
@@ -322,6 +332,7 @@ export class Config { | |
} | ||
|
||
const bundlerDefaultConfigs: BundlerConfig = { | ||
beneficiary: "", | ||
minInclusionDenominator: 10, | ||
throttlingSlack: 10, | ||
banSlack: 50, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we consider an option of using a seed phrase and specify the list of relayers as well?