Skip to content

Commit

Permalink
Merge branch 'main' into retry-logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mouseless0x authored Oct 14, 2024
2 parents 179fb4e + 6f9eb33 commit 3a8dc79
Show file tree
Hide file tree
Showing 63 changed files with 3,060 additions and 1,466 deletions.
2 changes: 1 addition & 1 deletion config.localhost.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"executor-private-keys": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80,0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d,0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a,0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6",
"utility-private-key": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
"entrypoints": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789,0x0000000071727De22E5E9d8BAf0edAc6f37da032",
"entrypoint-simulation-contract": "0x74cb5e4ee81b86e70f9045036a1c5477de69ee87",
"deploy-simulations-contract": true,
"enable-debug-endpoints": true,
"safe-mode": false,
"mempool-max-parallel-ops": 5,
Expand Down
1 change: 1 addition & 0 deletions contracts/lib/account-abstraction
Submodule account-abstraction added at abff2a
1 change: 1 addition & 0 deletions contracts/lib/forge-std
Submodule forge-std added at f73c73
1 change: 1 addition & 0 deletions contracts/lib/openzeppelin-contracts
Submodule openzeppelin-contracts added at fd81a9
2 changes: 1 addition & 1 deletion scripts/config.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"executor-private-keys": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
"utility-private-key": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
"entrypoints": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789,0x0000000071727De22E5E9d8BAf0edAc6f37da032",
"entrypoint-simulation-contract": "0xAE6035bEE0802C969265C8A3193CE8878c99A66A",
"entrypoint-simulation-contract": "0xBbe8A301FbDb2a4CD58c4A37c262ecef8f889c47",
"enable-debug-endpoints": true,
"expiration-check": false,
"safe-mode": false,
Expand Down
4 changes: 2 additions & 2 deletions scripts/localDeployer/constants.ts

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions scripts/localDeployer/index.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
import {
http,
createTestClient,
createWalletClient,
createPublicClient,
type Address,
type Hex
type Hex,
createPublicClient,
createTestClient,
createWalletClient
} from "viem"
import { mnemonicToAccount } from "viem/accounts"
import { foundry } from "viem/chains"
import {
MULTICALL3_BYTECODE,
BICONOMY_ACCOUNT_V2_LOGIC_CREATECALL,
BICONOMY_DEFAULT_FALLBACK_HANDLER_CREATECALL,
BICONOMY_ECDSA_OWNERSHIP_REGISTRY_MOUDULE_CREATECALL,
BICONOMY_FACTORY_CREATECALL,
BICONOMY_SINGLETON_FACTORY_BYTECODE,
ENTRY_POINT_SIMULATIONS_CREATECALL,
ENTRY_POINT_V06_CREATECALL,
ENTRY_POINT_V07_CREATECALL,
KERNEL_ACCOUNT_V2_2_LOGIC_CREATECALL,
KERNEL_ECDSA_VALIDATOR_CREATECALL,
KERNEL_FACTORY_CREATECALL,
MULTICALL3_BYTECODE,
SAFE_MULTI_SEND_CALL_ONLY_CREATECALL,
SAFE_MULTI_SEND_CREATECALL,
SAFE_V06_MODULE_CREATECALL,
SAFE_V07_MODULE_SETUP_CREATECALL,
SAFE_PROXY_FACTORY_CREATECALL,
SAFE_SINGLETON_CREATECALL,
SAFE_SINGLETON_FACTORY_BYTECODE,
SIMPLE_ACCOUNT_FACTORY_V06_CREATECALL,
SIMPLE_ACCOUNT_FACTORY_V07_CREATECALL,
SAFE_V06_MODULE_CREATECALL,
SAFE_V06_MODULE_SETUP_CREATECALL,
SAFE_V07_MODULE_CREATECALL,
BICONOMY_SINGLETON_FACTORY_BYTECODE,
BICONOMY_ECDSA_OWNERSHIP_REGISTRY_MOUDULE_CREATECALL,
BICONOMY_ACCOUNT_V2_LOGIC_CREATECALL,
BICONOMY_FACTORY_CREATECALL,
KERNEL_ACCOUNT_V2_2_LOGIC_CREATECALL,
KERNEL_ECDSA_VALIDATOR_CREATECALL,
KERNEL_FACTORY_CREATECALL,
BICONOMY_DEFAULT_FALLBACK_HANDLER_CREATECALL,
SAFE_MULTI_SEND_CALL_ONLY_CREATECALL
SAFE_V07_MODULE_SETUP_CREATECALL,
SIMPLE_ACCOUNT_FACTORY_V06_CREATECALL,
SIMPLE_ACCOUNT_FACTORY_V07_CREATECALL
} from "./constants"

const DETERMINISTIC_DEPLOYER = "0x4e59b44847b379578588920ca78fbf26c0b4956c"
Expand Down Expand Up @@ -301,7 +301,7 @@ const main = async () => {
"0x988C135a1049Ce61730724afD342fb7C56CD2776",
"0x0000000071727De22E5E9d8BAf0edAc6f37da032",
"0x91E60e0613810449d098b0b5Ec8b51A0FE8c8985",
"0xAE6035bEE0802C969265C8A3193CE8878c99A66A",
"0xBbe8A301FbDb2a4CD58c4A37c262ecef8f889c47",
"0x2dd68b007B46fBe91B9A7c3EDa5A7a1063cB5b47",
"0x75cf11467937ce3F2f357CE24ffc3DBF8fD5c226",
"0x8EcD4ec46D4D2a6B64fE960B3D64e8B94B2234eb",
Expand Down
6 changes: 6 additions & 0 deletions src/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @pimlico/alto

## 0.0.7

### Patch Changes

- 8588fbd30e111228d5d9422f538b0633357166d7: Improved calldata gas estimations for v0.7 userOperations

## 0.0.6

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions src/cli/config/bundler.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
type ApiVersion,
addressSchema,
bundlerRequestSchema,
commaSeperatedAddressPattern,
hexData32Schema,
bundlerRequestSchema
hexData32Schema
} from "@alto/types"
import type { Hex } from "viem"
import { type Account, privateKeyToAccount } from "viem/accounts"
Expand Down
68 changes: 61 additions & 7 deletions src/cli/customTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ import {
type HttpTransportConfig,
RpcRequestError,
UrlRequiredError,
createTransport
createTransport,
toFunctionSelector,
getAbiItem,
isHex,
slice,
Hex
} from "viem"
import { rpc } from "viem/utils"
import { formatAbiItem, rpc } from "viem/utils"
import { EntryPointV06Abi } from "../types/contracts"

export type RpcRequest = {
jsonrpc?: "2.0" | undefined
Expand All @@ -15,6 +21,33 @@ export type RpcRequest = {
id?: number | undefined
}

const EXECUTION_RESULT_SELECTOR = toFunctionSelector(
formatAbiItem(
getAbiItem({
abi: EntryPointV06Abi,
name: "ExecutionResult"
})
)
)

const VALIDATION_RESULT_SELECTOR = toFunctionSelector(
formatAbiItem(
getAbiItem({
abi: EntryPointV06Abi,
name: "ValidationResult"
})
)
)

const FAILED_OP_SELECTOR = toFunctionSelector(
formatAbiItem(
getAbiItem({
abi: EntryPointV06Abi,
name: "FailedOp"
})
)
)

export function customTransport(
/** URL of the JSON-RPC API. Defaults to the chain's public RPC URL. */
url_: string,
Expand Down Expand Up @@ -54,24 +87,45 @@ export function customTransport(

const [{ error, result }] = await fn(body)
if (error) {
logger.error(
let loggerFn = logger.error.bind(logger)

if (isHex(error?.data) && error?.data?.length > 10) {
const errorSelector = slice(error?.data, 0, 4)

if (
[
EXECUTION_RESULT_SELECTOR,
VALIDATION_RESULT_SELECTOR,
FAILED_OP_SELECTOR
].includes(errorSelector as Hex)
) {
loggerFn = logger.info.bind(logger)
}
}

loggerFn(
{
error,
err: error,
body
},
"Received error response"
"received error response"
)

throw new RpcRequestError({
body,
error: {
...error,
// 24 Aug 2024, etherlink throws -32003 error code for eth_call
code: (method === 'eth_call' && error.code === -32003) ? 3 : error.code,
code:
method === "eth_call" &&
error.code === -32003
? 3
: error.code
},
url: url
})
}
logger.info({ body, result }, "Received response")
logger.info({ body, result }, "received response")
return result
},
retryCount,
Expand Down
49 changes: 49 additions & 0 deletions src/cli/deploySimulationsContract.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { PimlicoEntryPointSimulationsDeployBytecode } from "@alto/types"
import {
type Chain,
createWalletClient,
type Hex,
http,
type PublicClient,
type Transport
} from "viem"
import type { CamelCasedProperties } from "./parseArgs"
import type { IOptions } from "@alto/cli"

export const deploySimulationsContract = async ({
args,
publicClient
}: {
args: CamelCasedProperties<IOptions>
publicClient: PublicClient<Transport, Chain>
}): Promise<Hex> => {
const utilityPrivateKey = args.utilityPrivateKey
if (!utilityPrivateKey) {
throw new Error(
"Cannot deploy entryPoint simulations without utility-private-key"
)
}

const walletClient = createWalletClient({
transport: http(args.rpcUrl),
account: utilityPrivateKey
})

const deployHash = await walletClient.deployContract({
chain: publicClient.chain,
abi: [],
bytecode: PimlicoEntryPointSimulationsDeployBytecode
})

const receipt = await publicClient.getTransactionReceipt({
hash: deployHash
})

const simulationsContract = receipt.contractAddress

if (simulationsContract === null || simulationsContract === undefined) {
throw new Error("Failed to deploy simulationsContract")
}

return simulationsContract
}
Loading

0 comments on commit 3a8dc79

Please sign in to comment.