-
Notifications
You must be signed in to change notification settings - Fork 226
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-213: Standalone ValidationManager package #153
Conversation
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity ^0.8.15; | ||
|
||
contract GetCodeHashes { |
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.
Maybe CodeHashGetter
?
import { checkUserOpRulesViolations } from '@account-abstraction/validation-manager' | ||
|
||
const userOperation: UserOperation = createUserOp() | ||
checkUserOpRulesViolations(provider, userOperation, entryPoint) |
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.
Maybe just validateRulesViolations(UserOperation)
?
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.
- the parameters are required.
- methods should have the verb-subject in their names, so its good idea to have UserOp there.
- the librarian is validation-manager, so it makes sense to name it "validate" and not "check"
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.
- the parameters are required.
- methods should have the verb-subject in their names, so its good idea to have UserOp there.
- the librarian is validation-manager, so it makes sense to name it "validate" and not "check"
The rules themselves are actually called "validation rules" so I don't want to ever have to say "validate validation rules", so I called the function 'check'.
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.
generally very good refactor.
Just the "abi", which was "externalized" for no reason.
import { ReputationManager } from './ReputationManager' | ||
import Debug from 'debug' | ||
import { ReferencedCodeHashes, StakeInfo, UserOperation, ValidationErrors } from './Types' | ||
import { UserOperation } from './Types' |
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.
maybe UserOperation should be moved to "utils" too ?
export interface StorageMap { | ||
[address: string]: string | SlotMap | ||
} | ||
export const abi = Object.values([ |
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.
- don't export generic "abi" from a package.
- specifically, this one is used when decoding callstack during trace - it should be declared there, not passed through a chain of methods and packages.
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.
But this includes ABIs that are only relevant to our project, won't other users want to supply their own ABIs?
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.
The test ABIs are not needed, only the "public" ones. They were added for debugging-purposes only, and really can be removed.
import { UserOperationEventEvent } from '@account-abstraction/contracts/dist/types/EntryPoint' | ||
import { UserOperationReceipt } from '../src/RpcTypes' | ||
import { ExecutionManager } from '../src/modules/ExecutionManager' | ||
import { BundlerReputationParams, ReputationManager } from '../src/modules/ReputationManager' | ||
import { MempoolManager } from '../src/modules/MempoolManager' | ||
import { ValidationManager } from '../src/modules/ValidationManager' | ||
import { ValidationManager } from '../../validation-manager/src/ValidationManager' |
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.
@account-abstraction/validation-manager
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.
Tests are executed with ts-node
which ignores all scopes and just goes with the flow. Most of the files in tests are imported chaotically. I can fix that if needed.
import { checkRulesViolations } from '@account-abstraction/validation-manager' | ||
|
||
const userOperation: UserOperation = createUserOp() | ||
checkRulesViolations(provider, userOperation, entryPoint) |
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.
await?
import { EntryPoint__factory } from '@account-abstraction/contracts' | ||
import { parseEther } from 'ethers/lib/utils' | ||
import { Signer } from 'ethers' | ||
import { BundlerConfig } from '../BundlerConfig' | ||
import { EventsManager } from './EventsManager' | ||
import { getNetworkProvider } from '../Config' | ||
import { abi } from './Types' |
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.
this abi is a set of ABIs used to simplify decoding of call stacks. it is not a global parameter.
@@ -0,0 +1,20 @@ | |||
{ |
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.
why we need 2 tsconfig files?
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.
I am not sure but this is needed for yarn workspaces. Removing these used to break the project in the past, did not try since.
*/ | ||
function parseCallStack (tracerResults: BundlerCollectorReturn): CallEntry[] { |
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.
this is a local parser. no need to "externalize" the abi . Maybe remove unneeded (test) contracts, and add IAccount instead
…extract-rules-validator-package
No description provided.