vectors

package
v0.5.0-RC33 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 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

func GenerateGenesisActionsEtrog added in v0.5.0

func GenerateGenesisActionsEtrog(genesis []GenesisEntityEtrog) []*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 GenesisEntityEtrog added in v0.5.0

type GenesisEntityEtrog 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"`
}

GenesisEntityEtrog 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 L1InfoTree added in v0.5.0

type L1InfoTree struct {
	PreviousLeafValues []common.Hash `json:"previousLeafValues"`
	CurrentRoot        common.Hash   `json:"currentRoot"`
	NewLeafValue       common.Hash   `json:"newLeafValue"`
	NewRoot            common.Hash   `json:"newRoot"`
}

L1InfoTree holds the test vector for the merkle tree

type L1InfoTreeProof added in v0.5.0

type L1InfoTreeProof struct {
	Leaves []common.Hash `json:"leaves"`
	Index  uint          `json:"index"`
	Proof  []common.Hash `json:"proof"`
	Root   common.Hash   `json:"root"`
}

L1InfoTree holds the test vector for the merkle tree

type L1Infotree added in v0.5.0

type L1Infotree struct {
	SkipVerifyL1InfoRoot bool `json:"skipVerifyL1InfoRoot"`
}

L1InfoTree represents the state of the L1InfoTree

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 LeafEtrog added in v0.5.0

type LeafEtrog struct {
	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"`
}

LeafEtrog 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 StateTransitionTestCaseEtrog added in v0.5.0

type StateTransitionTestCaseEtrog struct {
	Description          string               `json:"Description"`
	Genesis              []GenesisEntityEtrog `json:"genesis"`
	ExpectedOldStateRoot string               `json:"expectedOldRoot"`
	ExpectedNewStateRoot string               `json:"expectedNewRoot"`
	ExpectedNewLeafs     map[string]LeafEtrog `json:"expectedNewLeafs"`
	Receipts             []TestReceipt        `json:"receipts"`
	GlobalExitRoot       string               `json:"globalExitRoot"`
	Txs                  []TxEtrog            `json:"txs"`
	OldAccInputHash      string               `json:"oldAccInputHash"`
	L1InfoRoot           string               `json:"l1InfoRoot"`
	TimestampLimit       string               `json:"timestampLimit"`
	L1InfoTree           L1Infotree           `json:"l1InfoTree"`
	BatchL2Data          string               `json:"batchL2Data"`
	BatchHashData        string               `json:"batchHashData"`
	ForkID               uint64               `json:"forkID"`
	SequencerAddress     string               `json:"sequencerAddress"`
}

StateTransitionTestCaseEtrog holds the metadata needed to run a state transition test

func LoadStateTransitionTestCasesEtrog added in v0.5.0

func LoadStateTransitionTestCasesEtrog(path string) ([]StateTransitionTestCaseEtrog, error)

LoadStateTransitionTestCasesEtrog loads the state-transition tests cases

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 TxEtrog added in v0.5.0

type TxEtrog struct {
	Type              uint       `json:"type"`
	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"`
	CustomRawTx       string     `json:"customRawTx"`
	Overwrite         Overwrite  `json:"overwrite"`
	EncodeInvalidData bool       `json:"encodeInvalidData"`
	Reason            string     `json:"reason"`
	IndexL1InfoTree   uint32     `json:"indexL1InfoTree"`
}

TxEtrog 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"`
	PolAmount     string      `json:"polAmount"`
	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