checkethcall

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

README

check_eth_call Task

Description

The check_eth_call task verifies the response from an eth_call transaction on the Ethereum blockchain. This task is essential for validating contract interactions that do not require gas or change the state of the blockchain but need to be tested for expected outcomes.

Task Behavior
  • The task makes eth_call requests to check contract state.
  • By default, the task returns immediately when the expected result is matched.
  • Use continueOnPass: true to keep monitoring even after success.

Configuration Parameters

  • ethCallData:
    The data to be sent in the eth_call transaction, encoded as a hex string. This typically includes the function signature and arguments for contract interactions. Default: "0x".

  • expectResult:
    The expected result of the eth_call transaction, expressed as a hex string. This is the value that the call is expected to return under normal circumstances and makes the task succeed. Default: "".

  • ignoreResults:
    An array of results that, if returned from the eth_call, should be ignored. This allows the task to be flexible by acknowledging and skipping known but irrelevant results. Default: [].

  • callAddress:
    The contract address targeted by the eth_call. This should be the address of the contract whose methods are being invoked. Default: "0x0000000000000000000000000000000000000000".

  • blockNumber:
    Specifies the block number at which the state should be queried. A value of 0 typically indicates the latest block. Default: 0.

  • failOnMismatch:
    Determines whether the task should fail if the result of the eth_call does not match the expectResult and is not in the list of ignoreResults. If set to false, the task will not fail on a result mismatch. Default: false.

  • clientPattern:
    A regex pattern to select specific client endpoints for sending the eth_call. This allows targeting of appropriate nodes within the network. Default: "".

  • excludeClientPattern:
    A regex pattern to exclude certain clients from being used to make the eth_call, optimizing the selection of nodes based on the test scenario. Default: "".

  • continueOnPass:
    If set to true, the task continues monitoring even after the expected result is matched. This is useful for verifying that the contract state remains consistent over time. If false (default), the task exits immediately on success.

Outputs

  • callResult:
    The result of the eth_call transaction, returned as a hex string. This output provides direct feedback from the contract method being invoked.

Defaults

Default settings for the check_eth_call task:

- name: check_eth_call
  config:
    ethCallData: "0x"
    expectResult: ""
    ignoreResults: []
    callAddress: "0x0000000000000000000000000000000000000000"
    blockNumber: 0
    failOnMismatch: false
    clientPattern: ""
    excludeClientPattern: ""
    continueOnPass: false

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TaskName       = "check_eth_call"
	TaskDescriptor = &types.TaskDescriptor{
		Name:        TaskName,
		Description: "Checks the response of an eth_call transaction",
		Category:    "execution",
		Config:      DefaultConfig(),
		Outputs: []types.TaskOutputDefinition{
			{
				Name:        "callResult",
				Type:        "string",
				Description: "The result of the eth_call as a hex string.",
			},
		},
		NewTask: NewTask,
	}
)

Functions

func NewTask

func NewTask(ctx *types.TaskContext, options *types.TaskOptions) (types.Task, error)

Types

type Config

type Config struct {
	EthCallData    string   `yaml:"ethCallData" json:"ethCallData" desc:"Hex-encoded call data to send with eth_call."`
	ExpectResult   string   `yaml:"expectResult" json:"expectResult" desc:"Expected hex-encoded result from eth_call."`
	IgnoreResults  []string `yaml:"ignoreResults" json:"ignoreResults" desc:"List of hex-encoded results to ignore (not treat as failures)."`
	CallAddress    string   `yaml:"callAddress" json:"callAddress" desc:"Target contract address for eth_call."`
	BlockNumber    uint64   `yaml:"blockNumber" json:"blockNumber" desc:"Block number to execute eth_call at (0 for latest)."`
	FailOnMismatch bool     `yaml:"failOnMismatch" json:"failOnMismatch" desc:"If true, fail the task when eth_call result does not match expected."`

	ClientPattern        string `yaml:"clientPattern" json:"clientPattern" desc:"Regex pattern to select specific client endpoints for eth_call."`
	ExcludeClientPattern string `yaml:"excludeClientPattern" json:"excludeClientPattern" desc:"Regex pattern to exclude certain client endpoints."`
	ContinueOnPass       bool   `` /* 137-byte string literal not displayed */
}

func DefaultConfig

func DefaultConfig() Config

func (*Config) Validate

func (c *Config) Validate() error

type Task

type Task struct {
	// contains filtered or unexported fields
}

func (*Task) Config

func (t *Task) Config() interface{}

func (*Task) Execute

func (t *Task) Execute(ctx context.Context) error

func (*Task) LoadConfig

func (t *Task) LoadConfig() error

func (*Task) Timeout

func (t *Task) Timeout() time.Duration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL