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

AA-381: Create a "pull bundle" block building mode and a 'getRip7560Bundle' method #214

Merged
merged 28 commits into from
Aug 5, 2024

Conversation

forshtat
Copy link
Contributor

No description provided.

@forshtat forshtat changed the title Create 'useRip7560Mode' and 'gethDevMode' configuration parameters AA-381: Create a "pull bundle" block building mode and a 'getRip7560Bundle' method Jul 25, 2024
@forshtat forshtat marked this pull request as ready for review July 28, 2024 14:18
}

// TODO: deduplicate!
async handleRpcPrivate (reqItem: any): Promise<any> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this private/public distinction then - They just sit on different ports, but there are no restrictions on who can call the "private" api. Are we only planning to block requests on the "devops" side and not in code?
if so, shouldn't we just name it "blockBuilderRpcHandler" and "clientRpcHandler" since there is not private/public distinction in code? we basically rely on the cloud configuration to make sense of these names

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can rename it but I think in the future we may end up creating other use cases for an API that is only available "internally".
I think as long as it is trivial to prevent access to the "private" API with i.e. basic docker configuration there is no point in writing any access control code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why modify all existing support: we're adding a new express and handler for the (single) private API.

@@ -1,6 +1,7 @@
{
"gasFactor": "1",
"port": "3000",
"publicApiPort": "3000",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd leave it as "port", and add a new "privateApiPort"

}

// TODO: deduplicate!
async handleRpcPrivate (reqItem: any): Promise<any> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why modify all existing support: we're adding a new express and handler for the (single) private API.

@@ -193,7 +198,11 @@ export class BundleManager {
}
}

async createBundle (): Promise<[OperationBase[], StorageMap]> {
async createBundle (
minBaseFee: BigNumberish,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe make param optional, and missing param means "unlimited"
e.g.

baseFee = minBaseFee==null ? 0 : BigNumber.from(minBaseFee)
maxSize = maxBundleSize==null ? MAXINT : BigNumber.from(maxBundleSize).toNumber()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All params are now optional, but '0' still means 'no limit', right?

@@ -290,6 +309,20 @@ export class BundleManager {
}
mergeStorageMap(storageMap, validationResult.storageMap)

const userOpGas =
BigNumber
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this value is useful. I thnk we should add it to "entry"

packages/bundler/src/runBundler.ts Outdated Show resolved Hide resolved
@@ -94,4 +125,15 @@ export class BundleManagerRIP7560 extends BundleManager implements IBundleManage
async getPaymasterBalance (paymaster: string): Promise<BigNumber> {
return await this.provider.getBalance(paymaster)
}

private computeBundleHash (userOps: OperationBase[]): string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a hash for a new entity that doesn't go on-chain. is it not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not? What should we use as a bundle identifier instead? I think we need a way to identify a bundler, as I currently use eth_getRip7560BundleStatus to check if it was included, I think.

.option('--config <string>', 'path to config file', CONFIG_FILE_NAME)
.option('--auto', 'automatic bundling (bypass config.autoBundleMempoolSize)', false)
.option('--unsafe', 'UNSAFE mode: no storage or opcode checks (safe mode requires geth)')
.option('--debugRpc', 'enable debug rpc methods (auto-enabled for test node')
.option('--conditionalRpc', 'Use eth_sendRawTransactionConditional RPC)')
.option('--show-stack-traces', 'Show stack traces.')
.option('--createMnemonic <file>', 'create the mnemonic file')
.option('--useRip7560Mode', 'Use this bundler for RIP-7560 node instead of ERC-4337 (experimental).')
.option('--useRip7560Mode <string>', 'Use this bundler for RIP-7560 node instead of ERC-4337 (experimental).')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our bundler already have "--dev" mode.
the userRip7560Mode should stay as boolean. push mode should be triggered by "--dev"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

@forshtat
Copy link
Contributor Author

forshtat commented Aug 5, 2024

@drortirosh I also created an issue to migrate to some official jsonrpc library:
https://opengsn.atlassian.net/browse/AA-410

async sendBundle (userOps: OperationBase[], _beneficiary: string, _storageMap: StorageMap): Promise<any> {
if (this.useRip7560Mode === 'PULL') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does it silently return ? either do something, or (more likely) return an error, since sendBundle is not allowed in pull mode.

}

async _preflightCheck (): Promise<void> {
if (this.config.useRip7560Mode) {
if (this.config.rip7560) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably check the geth node supports eip7560...

forshtat and others added 4 commits August 5, 2024 14:56
@drortirosh drortirosh merged commit 151c133 into main Aug 5, 2024
4 checks passed
@drortirosh drortirosh deleted the AA-381-create-getRip7560Bundle-api branch August 5, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants