vectors

package
v0.0.3-RC32 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: AGPL-3.0, AGPL-3.0-or-later Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenesisAccount

type GenesisAccount struct {
	Address string    `json:"address"`
	PvtKey  string    `json:"pvtKey"`
	Balance argBigInt `json:"balance"`
	Nonce   string    `json:"nonce"`
}

GenesisAccount represents the state of an account when the network starts

type GenesisSmartContract

type GenesisSmartContract struct {
	Address string `json:"address"`
	Code    string `json:"bytecode"`
}

GenesisSmartContract represents the smart contract to init when the network starts

type Leaf

type Leaf struct {
	Balance argBigInt `json:"balance"`
	Nonce   string    `json:"nonce"`
}

Leaf represents the state of a leaf in the merkle tree

type Overwrite

type Overwrite struct {
	S string `json:"s"`
}

Overwrite is used by Protocol team for testing

type Receipt

type Receipt struct {
	TransactionHash    string `json:"transactionHash"`
	TransactionIndex   uint   `json:"transactionIndex"`
	BlockNumber        uint64 `json:"blockNumber"`
	From               string `json:"from"`
	To                 string `json:"to"`
	CumulativeGastUsed uint64 `json:"cumulativeGasUsed"`
	GasUsedForTx       uint64 `json:"gasUsedForTx"`
	ContractAddress    string `json:"contractAddress"`
	Logs               uint64 `json:"logs"`
	LogsBloom          uint64 `json:"logsBloom"`
	Status             uint64 `json:"status"`
	BlockHash          string `json:"blockHash"`
}

Receipt is the receipt used for receipts tests

type StateTransitionTestCase

type StateTransitionTestCase struct {
	ID                  uint   `json:"id"`
	Description         string `json:"description"`
	ChainIDSequencer    uint64 `json:"chainIdSequencer"`
	SequencerAddress    string `json:"sequencerAddress"`
	SequencerPrivateKey string `json:"sequencerPvtKey"`

	GenesisAccounts       []GenesisAccount       `json:"genesis"`
	GenesisSmartContracts []GenesisSmartContract `json:"genesisSC"`
	ExpectedOldRoot       string                 `json:"expectedOldRoot"`
	Txs                   []Tx                   `json:"txs"`
	ExpectedNewRoot       string                 `json:"expectedNewRoot"`
	ExpectedNewLeafs      map[string]Leaf        `json:"expectedNewLeafs"`
	Receipts              []TestReceipt          `json:"receipts"`
	GlobalExitRoot        string                 `json:"globalExitRoot"`
}

StateTransitionTestCase holds the metadata needed to run a state transition test

func LoadStateTransitionTestCases

func LoadStateTransitionTestCases(path string) ([]StateTransitionTestCase, error)

LoadStateTransitionTestCases loads the state-transition.json into a StateTransitionVector instance

type TestReceipt

type TestReceipt struct {
	TxID    uint    `json:"txId"`
	Receipt Receipt `json:"receipt"`
}

TestReceipt holds the metadata needed to run the receipt tests

type Tx

type Tx struct {
	ID                uint       `json:"id"`
	From              string     `json:"from"`
	To                string     `json:"to"`
	Nonce             uint64     `json:"nonce"`
	Value             *big.Float `json:"value"`
	GasLimit          uint64     `json:"gasLimit"`
	GasPrice          *big.Float `json:"gasPrice"`
	ChainID           uint64     `json:"chainId"`
	RawTx             string     `json:"rawTx"`
	Overwrite         Overwrite  `json:"overwrite"`
	EncodeInvalidData bool       `json:"encodeInvalidData"`
	Reason            string     `json:"reason"`
}

Tx represents a transactions that will be applied during the test

type TxEventsSendBatchTestCase

type TxEventsSendBatchTestCase struct {
	ID  uint `json:"id"`
	Txs []Tx `json:"txs"`

	BatchL2Data   string      `json:"batchL2Data"`
	BatchHashData common.Hash `json:"batchHashData"`
	MaticAmount   string      `json:"maticAmount"`
	FullCallData  string      `json:"fullCallData"`
}

TxEventsSendBatchTestCase holds the metadata needed to run a etherman test

func LoadTxEventsSendBatchTestCases

func LoadTxEventsSendBatchTestCases(path string) ([]TxEventsSendBatchTestCase, error)

LoadTxEventsSendBatchTestCases loads the calldata-test-vector.json

Jump to

Keyboard shortcuts

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