testnet
GitHub

RevertWithData

type RevertWithData struct { Data []byte }

A specific error type used to return raw ABI-encoded data to the EVM during a revert. Use this when a precompile needs to throw a custom Solidity error (e.g., error MyError(uint256 code)) instead of a generic string error.

Parameters

Name Type Required Description
Data []byte The ABI-encoded error data (4-byte selector + arguments).

Returns

Type: error

Implements the Go error interface.

Examples

Returning a custom error

// Assuming 'packedData' contains the ABI encoded error
return nil, &common.RevertWithData{Data: packedData}
ESC
Type to search