Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

hardhat contract revert error investigation #6772

Description

@luu-alex

https://github.com/web3/web3.js/blob/4.x/packages/web3-eth-contract/test/integration/contract_methods.test.ts#L151
contract method revert for hardhat should return an error with revert but instead returns a contract execution with a receipt of undefined.

this is the error from event emitter
ContractExecutionError: Error happened while trying to execute a function inside a smart contract
at Function._isReverted (/Users/alexluu/4.x/web3.js/packages/web3-core/src/web3_request_manager.ts:432:48)
at Web3RequestManager._processJsonRpcResponse (/Users/alexluu/4.x/web3.js/packages/web3-core/src/web3_request_manager.ts:361:35)
at Web3RequestManager. (/Users/alexluu/4.x/web3.js/packages/web3-core/src/web3_request_manager.ts:206:16)
at Generator.next ()
at fulfilled (/Users/alexluu/4.x/web3.js/packages/web3-core/lib/commonjs/web3_request_manager.js:21:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
cause: [Eip838ExecutionError: Error: VM Exception while processing transaction: reverted with reason string 'REVERTED WITH REVERT'] {
cause: [Eip838ExecutionError: Error: VM Exception while processing transaction: reverted with reason string 'REVERTED WITH REVERT'] {
cause: undefined,
code: undefined,
receipt: undefined,
data: '0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000145245564552544544205749544820524556455254000000000000000000000000'
},
code: -32603,
receipt: undefined,
data: '0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000145245564552544544205749544820524556455254000000000000000000000000'
},
code: 310,
receipt: undefined
}

but only returns

Object {
+ "name": "ContractExecutionError",
+ "receipt": undefined,
}
check revert error constructor

Expected behavior

Actual behavior

Steps to reproduce the behavior

  1. [First step]
  2. [Second step]
  3. [and so on...]

Logs

Environment

Metadata

Metadata

Assignees

Labels

4.x4.0 relatedBugAddressing a bug

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions