vectors

package
v0.3.5-RC9 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: AGPL-3.0, AGPL-3.0-or-later Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateGenesisActions added in v0.0.990

func GenerateGenesisActions(genesis []GenesisEntity) []*state.GenesisAction

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 GenesisEntity added in v0.0.990

type GenesisEntity struct {
	Address         string            `json:"address"`
	PvtKey          *string           `json:"pvtKey"`
	Balance         argBigInt         `json:"balance"`
	Nonce           string            `json:"nonce"`
	Storage         map[string]string `json:"storage"`
	IsSmartContract bool              `json:"isSmartContract"`
	Bytecode        *string           `json:"bytecode"`
}

GenesisEntity represents the state of an account or smart contract 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 LeafV2 added in v0.0.990

type LeafV2 struct {
	Address         string            `json:"address"`
	Balance         argBigInt         `json:"balance"`
	Nonce           string            `json:"nonce"`
	Storage         map[string]string `json:"storage"`
	IsSmartContract bool              `json:"isSmartContract"`
	Bytecode        string            `json:"bytecode"`
	HashBytecode    string            `json:"hashBytecode"`
	BytecodeLength  int               `json:"bytecodeLength"`
}

LeafV2 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 StateTransitionTestCaseV2 added in v0.0.990

type StateTransitionTestCaseV2 struct {
	Description          string          `json:"Description"`
	Genesis              []GenesisEntity `json:"genesis"`
	ExpectedOldStateRoot string          `json:"expectedOldStateRoot"`
	ExpectedNewStateRoot string          `json:"expectedNewStateRoot"`
	ExpectedNewLeafs     []LeafV2        `json:"expectedNewLeafs"`
	Receipts             []TestReceipt   `json:"receipts"`
	GlobalExitRoot       string          `json:"globalExitRoot"`
	BatchL2Data          string          `json:"batchL2Data"`
}

StateTransitionTestCaseV2 holds the metadata needed to run a state transition test

func LoadStateTransitionTestCaseV2 added in v0.0.990

func LoadStateTransitionTestCaseV2(path string) (StateTransitionTestCaseV2, error)

LoadStateTransitionTestCaseV2 loads the state-transition JSON file into a StateTransitionTestCaseV2 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