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

Mock paymaster #53

Merged
merged 3 commits into from
Jul 30, 2024
Merged

Mock paymaster #53

merged 3 commits into from
Jul 30, 2024

Conversation

tuler
Copy link
Member

@tuler tuler commented Jul 29, 2024

Proper packaging and versioning of mock paymaster, copied from https://github.com/pimlicolabs/mock-aa-environment/tree/main/mock-verifying-paymaster

The idea is to publish the package as @cartesi/mock-paymaster, with a npm bin, and then installing it inside the SDK in another PR.

@tuler tuler requested a review from endersonmaia July 29, 2024 20:53
Copy link

changeset-bot bot commented Jul 29, 2024

🦋 Changeset detected

Latest commit: a477ab6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cartesi/mock-verifying-paymaster Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@endersonmaia endersonmaia left a comment

Choose a reason for hiding this comment

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

How can I test.

I executed docker compose up but don't know what to expect.

If this compose will be part of the cartesi run, we could remove it from this package when we have it working integrated with the cli.

packages/mock-verifying-paymaster/package.json Outdated Show resolved Hide resolved
packages/mock-verifying-paymaster/src/index.ts Outdated Show resolved Hide resolved
@tuler
Copy link
Member Author

tuler commented Jul 30, 2024

The docker compose is a test one that runs the two services that the mock-paymaster connects to, the anvil and alto.

You can test by running the compose and then executing the pnpm run start with two env variables defined, the ANVIL_RPC and ALTO_RPC.

I tried to not make any change at all to the original source code. It's only a packaging and versioning addition to the original work.

@endersonmaia
Copy link
Contributor

I'm getting this:

ANVIL_RPC=http://localhost:8545 ALTO_RPC=http://0.0.0.0:4337 pnpm run start

> @cartesi/[email protected] start /home/endersonmaia/Development/cartesi/cli/packages/mock-verifying-paymaster
> ts-node src/index.ts

/home/endersonmaia/Development/cartesi/cli/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/index.ts:859
    return new TSError(diagnosticText, diagnosticCodes, diagnostics);
           ^
TSError: ⨯ Unable to compile TypeScript:
src/relay.ts:97:46 - error TS2737: BigInt literals are not available when targeting lower than ES2020.

97         userOperation.preVerificationGas === 1n ||
                                                ~~
src/relay.ts:98:48 - error TS2737: BigInt literals are not available when targeting lower than ES2020.

98         userOperation.verificationGasLimit === 1n ||
                                                  ~~
src/relay.ts:99:40 - error TS2737: BigInt literals are not available when targeting lower than ES2020.

99         userOperation.callGasLimit === 1n
                                          ~~
src/relay.ts:200:46 - error TS2737: BigInt literals are not available when targeting lower than ES2020.

200         userOperation.preVerificationGas === 1n ||
                                                 ~~
src/relay.ts:201:48 - error TS2737: BigInt literals are not available when targeting lower than ES2020.

201         userOperation.verificationGasLimit === 1n ||
                                                   ~~
src/relay.ts:202:40 - error TS2737: BigInt literals are not available when targeting lower than ES2020.

202         userOperation.callGasLimit === 1n
                                           ~~
src/relay.ts:331:54 - error TS2737: BigInt literals are not available when targeting lower than ES2020.

331                 paymasterVerificationGasLimit: toHex(50_000n),
                                                         ~~~~~~~
src/relay.ts:332:48 - error TS2737: BigInt literals are not available when targeting lower than ES2020.

332                 paymasterPostOpGasLimit: toHex(20_000n),
                                                   ~~~~~~~

    at createTSError (/home/endersonmaia/Development/cartesi/cli/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/index.ts:859:12)
    at reportTSError (/home/endersonmaia/Development/cartesi/cli/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/index.ts:863:19)
    at getOutput (/home/endersonmaia/Development/cartesi/cli/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/index.ts:1077:36)
    at Object.compile (/home/endersonmaia/Development/cartesi/cli/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/index.ts:1433:41)
    at Module.m._compile (/home/endersonmaia/Development/cartesi/cli/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/index.ts:1617:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.require.extensions.<computed> [as .ts] (/home/endersonmaia/Development/cartesi/cli/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19) {
  diagnosticCodes: [
    2737, 2737, 2737,
    2737, 2737, 2737,
    2737, 2737
  ]
}
 ELIFECYCLE  Command failed with exit code 1.

endersonmaia
endersonmaia previously approved these changes Jul 30, 2024
Copy link
Contributor

@endersonmaia endersonmaia left a comment

Choose a reason for hiding this comment

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

LGTM

Don't forget to squash the fixups.

@tuler tuler force-pushed the feature/paymaster branch from cbaaf49 to 40cfde2 Compare July 30, 2024 14:44
@tuler tuler merged commit c4214ec into main Jul 30, 2024
2 checks passed
@tuler tuler deleted the feature/paymaster branch July 30, 2024 18:00
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.

2 participants