-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from etherspot/arbitrum
Fix issue with the tracer on arbitrum
- Loading branch information
Showing
18 changed files
with
142 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "root", | ||
"private": true, | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"engines": { | ||
"node": ">=18.0.0" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "cli", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "> TODO: description", | ||
"author": "zincoshine <[email protected]>", | ||
"homepage": "https://https://github.com/etherspot/skandha#readme", | ||
|
@@ -31,13 +31,13 @@ | |
"url": "https://https://github.com/etherspot/skandha/issues" | ||
}, | ||
"dependencies": { | ||
"api": "^0.0.8", | ||
"db": "^0.0.8", | ||
"executor": "^0.0.8", | ||
"api": "^0.0.9", | ||
"db": "^0.0.9", | ||
"executor": "^0.0.9", | ||
"find-up": "5.0.0", | ||
"got": "12.5.3", | ||
"js-yaml": "4.1.0", | ||
"types": "^0.0.8", | ||
"types": "^0.0.9", | ||
"yargs": "17.6.2" | ||
}, | ||
"devDependencies": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ export const chainsWithoutEIP1559: NetworkName[] = [ | |
"fuseSparknet", | ||
"bsc", | ||
"bscTest", | ||
"polygonzkevm", | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { NodeInterface__factory } from "@arbitrum/sdk/dist/lib/abi/factories/NodeInterface__factory"; | ||
import { NODE_INTERFACE_ADDRESS } from "@arbitrum/sdk/dist/lib/dataEntities/constants"; | ||
import { UserOperationStruct } from "types/lib/executor/contracts/EntryPoint"; | ||
import { BigNumber, BigNumberish, ethers } from "ethers"; | ||
import { EntryPoint__factory } from "types/lib/executor/contracts"; | ||
import { IPVGEstimator, IPVGEstimatorWrapper } from "../types/IPVGEstimator"; | ||
|
||
export const estimateArbitrumPVG: IPVGEstimatorWrapper = ( | ||
provider | ||
): IPVGEstimator => { | ||
const nodeInterface = NodeInterface__factory.connect( | ||
NODE_INTERFACE_ADDRESS, | ||
provider | ||
); | ||
const dummyWallet = ethers.Wallet.createRandom(); | ||
return async ( | ||
entryPointAddr: string, | ||
userOp: UserOperationStruct, | ||
initial: BigNumberish | ||
): Promise<BigNumber> => { | ||
const entryPoint = EntryPoint__factory.connect(entryPointAddr, provider); | ||
const handleOpsData = entryPoint.interface.encodeFunctionData("handleOps", [ | ||
[userOp], | ||
dummyWallet.address, | ||
]); | ||
|
||
const contractCreation = BigNumber.from(userOp.nonce).eq(0); | ||
try { | ||
const gasEstimateComponents = | ||
await nodeInterface.callStatic.gasEstimateL1Component( | ||
entryPoint.address, | ||
contractCreation, | ||
handleOpsData | ||
); | ||
const l1GasEstimated = gasEstimateComponents.gasEstimateForL1; | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const baseFee = gasEstimateComponents.baseFee; | ||
return l1GasEstimated.add(initial); | ||
} catch (err) { | ||
// eslint-disable-next-line no-console | ||
console.error("Error while estimating arbitrum PVG", err); | ||
return BigNumber.from(initial); | ||
} | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { BigNumber, BigNumberish, providers } from "ethers"; | ||
import { UserOperationStruct } from "types/lib/executor/contracts/EntryPoint"; | ||
|
||
export type IPVGEstimatorWrapper = ( | ||
provider: providers.StaticJsonRpcProvider | ||
) => IPVGEstimator; | ||
|
||
export type IPVGEstimator = ( | ||
entryPointAddr: string, | ||
userOp: UserOperationStruct, | ||
initial: BigNumberish // initial amount of gas. It will be added to the estimated gas | ||
) => Promise<BigNumber>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.