validation

package module
v0.0.0-...-ca80c8f Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 29 Imported by: 6

README

validation

This directory contains the golang validation checks that chains run against. The validation_test.go file is the entry point of the tests. It runs a different set of tests for each class of chain (Frontier, Standard Candidate and Standard).

Documentation

Index

Constants

View Source
const DefaultMaxRetries = 3

Variables

View Source
var (
	ErrChainIdNotListed        = errors.New("chain ID is not listed at chainid.network")
	ErrLocalChainNameMismatch  = errors.New("local chain name does not match name from chainid.network")
	ErrChainIdDuplicated       = errors.New("chain ID is duplicated")
	ErrChainNameDuplicated     = errors.New("chain name duplicated")
	ErrChainPublicRpcNotListed = errors.New("chain public RPC not listed in chainid.network")
)

Functions

func CastCall

func CastCall(contractAddress superchain.Address, calldata string, args []string, rpcUrl string) ([]string, error)

func CheckGasLimit

func CheckGasLimit(chain *superchain.ChainConfig, l1Client *ethclient.Client, getGasLimitOverride *getGasLimitFunc) error

func GetBytecodeHash

func GetBytecodeHash(ctx context.Context, chainID uint64, contractName string, targetContractAddr common.Address, client *ethclient.Client, tag standard.Tag) (string, error)

GetBytecodeHash gets the hash of the bytecode of a contract

  • at a given address, if the contract is not a proxy contract
  • at the proxy implementation contract's address, if the contract is a proxy contract (we currently use the name suffix to determine whether the contract is a proxy or not)

func GetContractVersion

func GetContractVersion(ctx context.Context, addr common.Address, client *ethclient.Client) (string, error)

GetContractVersion will get the version of a contract at a given address, if it exposes a version() method.

func Retry

func Retry[S, T any](fn func(S) (T, error)) func(S) (T, error)

Types

type BytecodeAndImmutableReferences

type BytecodeAndImmutableReferences struct {
	Bytecode            []byte                          `json:"object"`
	ImmutableReferences map[string][]ImmutableReference `json:"immutableReferences"`
}

Define a struct to represent the structure of the JSON data

type ImmutableReference

type ImmutableReference struct {
	Start  int `json:"start"`
	Length int `json:"length"`
}

ImmutableReference to store the start/length of a contract's immutable references. Immutables are directly assigned values once or are initialized in a constructor. They are encoded in the contract bytecode, and the AST that is generated by the compiler has info about the offset & length within the bytecode.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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