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

feat: new userOp structure for EPv0.7 #677

Merged
merged 8 commits into from
Sep 11, 2024

Conversation

veljkovranic
Copy link
Contributor

@veljkovranic veljkovranic commented Aug 26, 2024

📖 Context

Type of change

  • Non-breaking change (backwards compatible)

Why are we doing this?

ERC-4337 got a new update with EntryPoint v0.7, which affected the UserOps structure.

The new object doesn't contain initCode and paymasterAndData fields (as in used to up to EPv0.6),
and it introduced new fields: factor, factoryData, paymaster, paymasterVerificationGasLimit, paymasterPostOpGasLimit, and paymasterData.

All this can be found at https://eips.ethereum.org/EIPS/eip-4337#useroperation

Related issues:
link to issue

What did we do?

  • We changed interface of several client-facing endpoints (only v3 version)
  • Changed the underlying structure that is stored in the Mongo
  • Added a new queue type for new object (as well as its appropriate consumers and producers)
  • Fix the old tests

How Has This Been Tested?

👀 How do I review this?

  • To test this you first need to checkout this branch and run the Nexus SDK against v3 set of endpoints

Instructions for calling new set of endpoints are here:

git clone https://github.com/bcnmy/biconomy-client-sdk.git
git checkout feat/nexus-pm

setup

E2E_PRIVATE_KEY_ONE=
E2E_PRIVATE_KEY_TWO=
BUNDLER_URL=
PAYMASTER_URL=
CHAIN_ID=
E2E_BICO_PAYMASTER_KEY_AMOY=_sTfkyAEp.552504b5-9093-4d4b-94dd-701f85a267ea
E2E_BICO_PAYMASTER_KEY_BASE=1SiNJ1OW7.e15b6f41-5ed4-493a-af6f-b3b40c17f856

in .env

bun install
bun run build
bun run scripts/send:userOp.ts

@veljkovranic veljkovranic changed the title Feature/new user op WIP - Feature/new user op Aug 26, 2024
@veljkovranic veljkovranic requested review from TheDivic, arcticfloyd1984, ronnypanford and nishant-1391 and removed request for TheDivic August 27, 2024 14:37
@veljkovranic veljkovranic marked this pull request as ready for review August 27, 2024 14:38
@veljkovranic veljkovranic changed the title WIP - Feature/new user op feat: new userOp structure for EPv0.7 Aug 27, 2024
@TheDivic
Copy link
Collaborator

TheDivic commented Sep 4, 2024

@veljkovranic please add instructions how do I run the Nexus SDK and test the new v7 endpoints.

$match: {
$and: [
{ "metaData.dappAPIKey": bundlerApiKey },
{ creationTime: { $gte: startTime } },
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you check if we have Mongo indexes on these fields?

It's also a good opportunity to setup a connection to our MongoDB and browse the data if you didn't do it so far.
@TakGN can give you instructions how to connect to the prod database.

src/common/maps/index.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@TheDivic TheDivic left a comment

Choose a reason for hiding this comment

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

Overall this is a lot of work an a great job.
I left some less important "style" related comments that you can optionally take into account.

Only two things that worry me:

  • The relayer manager issue I mentioned
  • I need instructions how to test this locally with Nexus

src/common/db/mongo/Mongo.ts Show resolved Hide resolved
src/common/entrypoint-v7/PackedUserOperation.ts Outdated Show resolved Hide resolved
src/common/entrypoint-v7/PackedUserOperation.ts Outdated Show resolved Hide resolved
src/common/maps/index.ts Outdated Show resolved Hide resolved
src/common/queue/BundlerTransactionQueueV3.ts Outdated Show resolved Hide resolved
src/common/service-manager/index.ts Outdated Show resolved Hide resolved
src/common/service-manager/index.ts Outdated Show resolved Hide resolved
@veljkovranic veljkovranic changed the base branch from feature/entrypoint-v7-api to master September 11, 2024 10:40
@veljkovranic veljkovranic changed the base branch from master to feature/entrypoint-v7-api September 11, 2024 10:41
if (!userOp.paymasterAndData) {
userOp.paymasterAndData = "0x";
}
// // for userOp completeness
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we commenting this out instead of deleting?

@@ -19,12 +19,6 @@
59144, 421614, 11155111, 1115, 3441005, 84532, 168587773, 80085, 534351,
56400, 11155420, 80002
],
"nonRM2SupportedNetworks": [
Copy link
Collaborator

Choose a reason for hiding this comment

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

@veljkovranic I think that we can safely delete the whole statis-config.json file, it was used in the past and was left in the codebase just for reference.

log.info(
`No user op found for transactionId: ${transactionId} on chainId: ${this.chainId}`,
);
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This code is a bit unreadable and looks like a 🎄 but it's not that important, we can leave it for later.

Copy link
Collaborator

@TheDivic TheDivic left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the good comments in code and docstrings! 🏆

@veljkovranic veljkovranic merged commit a0a0ad1 into feature/entrypoint-v7-api Sep 11, 2024
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.

Support the new (unpacked) UserOperation type on the API Implement the PackedUserOperation
3 participants