prove

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

README

How UT works in this package

We need mock data to run the testcase under this package, the mock data is a snapshot of postgres after running the integration test.

We just create a snapshot of postgres container and push it on github as a docker image and reuse it.

How to create mock data docker images

After you have run the integration test, while the postgres container is not deleted:

docker commit -m 'add zkbnb mock data' postgres zkbnb-ut-postgres docker tag zkbnb-ut-postgres ghcr.io/bnb-chain/zkbnb/zkbnb-ut-postgres:latest docker push ghcr.io/bnb-chain/zkbnb/zkbnb-ut-postgres:latest

Note: you need login the docker registry before pushing.

export CR_PAT={your github token}
echo $CR_PAT | docker login ghcr.io -u {your user name}  --password-stdin

Documentation

Index

Constants

View Source
const (
	NbAccountAssetsPerAccount = ctypes.NbAccountAssetsPerAccount
	NbAccountsPerTx           = ctypes.NbAccountsPerTx

	AssetMerkleLevels   = circuit.AssetMerkleLevels
	NftMerkleLevels     = circuit.NftMerkleLevels
	AccountMerkleLevels = circuit.AccountMerkleLevels

	LastAccountIndex   = circuit.LastAccountIndex
	LastAccountAssetId = circuit.LastAccountAssetId
	LastNftIndex       = circuit.LastNftIndex
)

Variables

This section is empty.

Functions

func GenerateProof

func GenerateProof(
	r1cs frontend.CompiledConstraintSystem,
	provingKey groth16.ProvingKey,
	verifyingKey groth16.VerifyingKey,
	cBlock *circuit.Block,
) (proof groth16.Proof, err error)

func LoadProvingKey

func LoadProvingKey(filepath string) (pk groth16.ProvingKey, err error)

func LoadVerifyingKey

func LoadVerifyingKey(filepath string) (verifyingKey groth16.VerifyingKey, err error)

func SetFixedAccountArray

func SetFixedAccountArray(proof [][]byte) (res [AccountMerkleLevels][]byte, err error)

func SetFixedAccountAssetArray

func SetFixedAccountAssetArray(proof [][]byte) (res [AssetMerkleLevels][]byte, err error)

func SetFixedNftArray

func SetFixedNftArray(proof [][]byte) (res [NftMerkleLevels][]byte, err error)

Types

type AccountWitnessInfo

type AccountWitnessInfo struct {
	AccountInfo            *account.Account
	AccountAssets          []*types.AccountAsset
	AssetsRelatedTxDetails []*tx.TxDetail
}

type FormattedProof

type FormattedProof struct {
	A      [2]*big.Int
	B      [2][2]*big.Int
	C      [2]*big.Int
	Inputs [3]*big.Int
}

func FormatProof

func FormatProof(oProof groth16.Proof, oldRoot, newRoot, commitment []byte) (proof *FormattedProof, err error)

type GasWitness added in v0.0.4

type GasWitness = circuit.Gas

type NftWitnessInfo

type NftWitnessInfo struct {
	NftInfo            *types.NftInfo
	NftRelatedTxDetail *tx.TxDetail
}

type TxWitness

type TxWitness = circuit.Tx

type WitnessHelper

type WitnessHelper struct {
	// contains filtered or unexported fields
}

func NewWitnessHelper

func NewWitnessHelper(treeCtx *tree.Context, accountTree, nftTree bsmt.SparseMerkleTree,
	assetTrees *tree.AssetTreeCache, accountModel account.AccountModel, accountHistoryModel account.AccountHistoryModel) *WitnessHelper

func (*WitnessHelper) ConstructGasWitness added in v0.0.4

func (w *WitnessHelper) ConstructGasWitness(block *block.Block) (cryptoGas *GasWitness, err error)

func (*WitnessHelper) ConstructTxWitness

func (w *WitnessHelper) ConstructTxWitness(oTx *tx.Tx, finalityBlockNr uint64,
) (cryptoTx *TxWitness, err error)

func (*WitnessHelper) ResetCache added in v0.0.4

func (w *WitnessHelper) ResetCache(height int64) error

Jump to

Keyboard shortcuts

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