operations

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultInterval is a time interval
	DefaultInterval = 2 * time.Second

	// DefaultDeadline is a time interval
	DefaultDeadline = 2 * time.Minute

	// DefaultL1NetworkURL is the L1 node URL
	DefaultL1NetworkURL = "http://localhost:8545"

	// DefaultL2NetworkURL is the L2 node URL
	DefaultL2NetworkURL = "http://localhost:8123"

	// DefaultSequencerPrivateKey is the sequencer private key
	DefaultSequencerPrivateKey = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"

	// DefaultL2ChainID is the l2 chain id
	DefaultL2ChainID uint64 = 1001

	// DefaultL1ChainID is the l1 chain id
	DefaultL1ChainID uint64 = 1337

	// DefaultL1DataCommitteeContract is the l1 data committee contract address
	DefaultL1DataCommitteeContract = "0x68B1D87F95878fE05B998F19b66F4baba5De1aed"

	// DefaultTimeoutTxToBeMined is the timeout for blocks to be mined
	DefaultTimeoutTxToBeMined = 1 * time.Minute

	// DefaultL1CDKValidiumSmartContract is the l1 CDK validium contract address
	DefaultL1CDKValidiumSmartContract = "0x8dAF17A20c9DBA35f005b6324F493785D239719d"
)

Variables

View Source
var (
	// ErrTimeoutReached is thrown when the timeout is reached and
	// because the condition is not matched
	ErrTimeoutReached = fmt.Errorf("timeout has been reached")
)

Functions

func ApplyL2Txs

func ApplyL2Txs(ctx context.Context, txs []*ethTypes.Transaction, auth *bind.TransactOpts,
	client *ethclient.Client, confirmationLevel ConfirmationLevel) ([]*big.Int, error)

ApplyL2Txs sends the given L2 txs, waits for them to be consolidated and checks the final state.

func CollectDockerLogs added in v0.0.4

func CollectDockerLogs(dacIndices []int)

CollectDockerLogs retrieves the logs from Docker containers and writes them into the logger

func GetAuth

func GetAuth(privateKeyStr string, chainID uint64) (*bind.TransactOpts, error)

GetAuth configures and returns an auth object.

func NodeUpCondition

func NodeUpCondition(target string) (bool, error)

NodeUpCondition check if the container is up and running

func Poll

func Poll(interval, deadline time.Duration, condition ConditionFunc) error

Poll retries the given condition with the given interval until it succeeds or the given deadline expires.

func ReportContainerLogs added in v0.0.6

func ReportContainerLogs(name string, max int)

func RevertReason

func RevertReason(ctx context.Context, c ethClienter, tx *ethTypes.Transaction, blockNumber *big.Int) (string, error)

RevertReason returns the revert reason for a tx that has a receipt with failed status

func RunMakeTarget

func RunMakeTarget(target string) error

RunMakeTarget runs a Makefile target.

func Setup

func Setup() error

Setup creates all the required components and initializes them according to the manager config.

func ShowRunningDockerContainers added in v0.0.6

func ShowRunningDockerContainers()

func StartComponent

func StartComponent(component string, conditions ...ConditionFunc) error

StartComponent starts a docker-compose component.

func StartNetwork

func StartNetwork() error

StartNetwork starts the L1 network container

func StartNode

func StartNode() error

StartNode starts the node container

func StopComponent

func StopComponent(component string) error

StopComponent stops a docker-compose component.

func Teardown

func Teardown() error

Teardown stops all the components.

func WaitL2BlockToBeConsolidated

func WaitL2BlockToBeConsolidated(l2Block *big.Int, timeout time.Duration) error

WaitL2BlockToBeConsolidated waits until a L2 Block has been consolidated or the given timeout expires.

func WaitL2BlockToBeVirtualized

func WaitL2BlockToBeVirtualized(l2Block *big.Int, timeout time.Duration) error

WaitL2BlockToBeVirtualized waits until a L2 Block has been virtualized or the given timeout expires.

func WaitTxToBeMined

func WaitTxToBeMined(parentCtx context.Context, client ethClienter, tx *ethTypes.Transaction, timeout time.Duration) error

WaitTxToBeMined waits until a tx has been mined or the given timeout expires.

Types

type ConditionFunc

type ConditionFunc func() (done bool, err error)

ConditionFunc is a generic function

type ConfirmationLevel

type ConfirmationLevel int

ConfirmationLevel type used to describe the confirmation level of a transaction

const PoolConfirmationLevel ConfirmationLevel = 0

PoolConfirmationLevel indicates that transaction is added into the pool

const TrustedConfirmationLevel ConfirmationLevel = 1

TrustedConfirmationLevel indicates that transaction is added into the trusted state

const VerifiedConfirmationLevel ConfirmationLevel = 3

VerifiedConfirmationLevel indicates that transaction is added into the verified state

const VirtualConfirmationLevel ConfirmationLevel = 2

VirtualConfirmationLevel indicates that transaction is added into the virtual state

Jump to

Keyboard shortcuts

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