Skip to content

Commit

Permalink
fix(chains): 🐛 Fix Monad 'sender not eoa' error
Browse files Browse the repository at this point in the history
Monad throws 'sender not eoa' when calling `eth_estimateGas` with the EP address as the sender. Removed the sender completely and added support for custom contract addresses to support monad
  • Loading branch information
TheDivic committed Jan 30, 2025
1 parent 16d9cff commit ddae8ff
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 18 deletions.
2 changes: 1 addition & 1 deletion config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"MNT": 1.21
},
"excludeFromTests": [
1115, 1116, 81, 2442, 3799, 920637907288165, 42170, 5611, 10200, 5001, 10143
1115, 1116, 81, 2442, 3799, 920637907288165, 42170, 5611, 10200, 5001
],
"includeInTests": [],
"skipSecondSimulation": [1101, 666666666, 196]
Expand Down
2 changes: 1 addition & 1 deletion config/test-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
"rpcUrl": "https://sonic-blaze.g.alchemy.com/v2/${ALCHEMY_KEY}"
},
"10143": {
"rpcUrl": "https://monad-testnet.g.alchemy.com/v2/${ALCHEMY_KEY}"
"rpcUrl": "https://testnet-rpc2.monad.xyz/${MONAD_XYZ_KEY}"
}
},
"includeInTests": [],
Expand Down
13 changes: 5 additions & 8 deletions src/chains/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1413,14 +1413,11 @@ export const supportedChains: Record<string, SupportedChain> = {
smartAccountsV2: false,
nexus: true
},
paymasters: {
v070: {
[DEFAULT_ENTRYPOINT_V7_SPONSORSHIP_PAYMASTER_ADDRESS]: {
type: "sponsorship",
dummyPaymasterData: DEFAULT_EP_V7_SPONSORSHIP_DUMMY_PAYMASTER_DATA,
postOpGasLimit: 50000n
}
}
paymasters: {},
contracts: {
bootStrapAddress: "0x7052eE73e9e9cA6884eb2146cA5c020492E5bB9D",
factoryAddress: "0xF8524aB72c688069DfFa8B1Cbb6005929B5Aff58",
validatorAddress: "0xEbc7f5Cff2cABcFdfD65a37A9342240b39A73fcd",
}
}
}
7 changes: 6 additions & 1 deletion src/chains/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ export const SupportedChainSchema = z.object({
})
)
.optional()
})
}),
contracts: z.object({
bootStrapAddress: z.string(),
factoryAddress: z.string(),
validatorAddress: z.string()
}).optional()
})

export type SupportedChain = z.infer<typeof SupportedChainSchema>
16 changes: 11 additions & 5 deletions src/entrypoint/v0.7.0/EntryPointV7Simulations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ describe("e2e", () => {

beforeAll(async () => {
nexusClient = await createNexusClient({
validatorAddress: "0x0000002D6DB27c52E3C11c1Cf24072004AC75cBa",
factoryAddress: "0x00000024115AA990F0bAE0B6b0D5B8F68b684cd6",
bootStrapAddress: testChain.contracts?.bootStrapAddress as Hex | undefined,
validatorAddress: testChain.contracts?.validatorAddress as Hex | undefined,
factoryAddress: testChain.contracts?.factoryAddress as Hex | undefined,
signer: account,
chain: getCustomChain(testChain.name, testChain.chainId, rpcUrl, ""),
transport,
Expand Down Expand Up @@ -154,9 +155,14 @@ describe("e2e", () => {
describe.runIf(sponsorshipPaymaster)(
"given a sponsorship paymaster",
() => {
const paymaster = sponsorshipPaymaster![0] as Address
const paymasterData = sponsorshipPaymaster![1]
.dummyPaymasterData as Hex
let paymaster: Address;
let paymasterData: Hex;

beforeAll(() => {
paymaster = sponsorshipPaymaster![0] as Address
paymasterData = sponsorshipPaymaster![1]
.dummyPaymasterData as Hex
})

describe.runIf(testChain.stateOverrideSupport.stateDiff)(
"If we can override the paymaster deposit on the entrypoint",
Expand Down
1 change: 0 additions & 1 deletion src/gas-estimator/evm/EVMGasEstimator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ export class EVMGasEstimator implements GasEstimator {
// use the actual user operation to estimate the preVerificationGas, because it depends on maxFeePerGas
this.estimatePreVerificationGas(userOperation, baseFeePerGas),
this.rpcClient.estimateGas({
account: options.entryPointAddress,
to: userOperation.sender,
data: userOperation.callData
})
Expand Down
4 changes: 3 additions & 1 deletion src/gas-estimator/tests/e2e/estimateUserOperationGas.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
extractChain,
formatEther,
parseEther,
toHex,
zeroAddress
} from "viem"
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"
Expand Down Expand Up @@ -581,6 +580,9 @@ describe("e2e", () => {

nexusClient = await createNexusClient({
signer: account,
bootStrapAddress: testChain.contracts?.bootStrapAddress as Hex | undefined,
factoryAddress: testChain.contracts?.factoryAddress as Hex | undefined,
validatorAddress: testChain.contracts?.validatorAddress as Hex | undefined,
chain,
transport,
bundlerTransport: transport
Expand Down

0 comments on commit ddae8ff

Please sign in to comment.