executor

package
v1.67.3 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//KeyPrefixStateDB state db key必须前缀
	KeyPrefixStateDB = "mavl-zksync-"
	//KeyPrefixLocalDB local db的key必须前缀
	KeyPrefixLocalDB = "LODB-zksync"
)

Variables

This section is empty.

Functions

func AddNewLeaf

func AddNewLeaf(statedb dbm.KV, localdb dbm.KV, info *TreeUpdateInfo, ethAddress string, tokenId uint64, amount string, chain33Addr string) ([]*types.KeyValue, []*types.KeyValue, error)

func CalLeafProof

func CalLeafProof(statedb dbm.KV, leaf *zt.Leaf, info *TreeUpdateInfo) (*zt.MerkleTreeProof, error)

func CalTokenProof

func CalTokenProof(statedb dbm.KV, leaf *zt.Leaf, token *zt.TokenBalance, info *TreeUpdateInfo) (*zt.MerkleTreeProof, error)

func GetAccountIdPrimaryKey

func GetAccountIdPrimaryKey(accountId uint64) []byte

func GetAccountTreeKey

func GetAccountTreeKey() []byte

func GetAllRoots

func GetAllRoots(db dbm.KV, endIndex uint64, info *TreeUpdateInfo) ([]*zt.RootInfo, error)

func GetChain33EthPrimaryKey

func GetChain33EthPrimaryKey(chain33Addr string, ethAddr string) []byte

func GetLeafByAccountId

func GetLeafByAccountId(db dbm.KV, accountId uint64, info *TreeUpdateInfo) (*zt.Leaf, error)

func GetLeafByChain33Address

func GetLeafByChain33Address(db dbm.KV, chain33Addr string) ([]*zt.Leaf, error)

func GetLeafByChain33AndEthAddress

func GetLeafByChain33AndEthAddress(db dbm.KV, chain33Addr, ethAddress string, info *TreeUpdateInfo) (*zt.Leaf, error)

func GetLeafByEthAddress

func GetLeafByEthAddress(db dbm.KV, ethAddress string) ([]*zt.Leaf, error)

func GetLeavesByStartAndEndIndex

func GetLeavesByStartAndEndIndex(db dbm.KV, startIndex uint64, endIndex uint64, info *TreeUpdateInfo) ([]*zt.Leaf, error)

func GetLocalChain33EthPrimaryKey

func GetLocalChain33EthPrimaryKey(chain33Addr string, ethAddr string) []byte

func GetName

func GetName() string

GetName get driver name

func GetRootByStartIndex

func GetRootByStartIndex(db dbm.KV, index uint64, info *TreeUpdateInfo) (*zt.RootInfo, error)

func GetRootIndexPrimaryKey

func GetRootIndexPrimaryKey(rootIndex uint64) []byte

func GetTokenByAccountIdAndTokenId

func GetTokenByAccountIdAndTokenId(db dbm.KV, accountId uint64, tokenId uint64, info *TreeUpdateInfo) (*zt.TokenBalance, error)

func GetTokenByAccountIdAndTokenIdInDB

func GetTokenByAccountIdAndTokenIdInDB(db dbm.KV, accountId uint64, tokenId uint64) (*zt.TokenBalance, error)

func GetTokenPrimaryKey

func GetTokenPrimaryKey(accountId uint64, tokenId uint64) []byte

func Init

func Init(name string, cfg *types.Chain33Config, sub []byte)

Init register dapp

func InitExecType

func InitExecType()

InitExecType Init Exec Type

func NewAccountTree

func NewAccountTree(localdb dbm.KV) ([]*types.KeyValue, []*types.KeyValue)

NewAccountTree 生成账户树,同时生成1号账户

func NewAccountTreeTable

func NewAccountTreeTable(kvdb db.KV) *table.Table

NewAccountTreeTable ...

func NewCommitProofTable

func NewCommitProofTable(kvdb db.KV) *table.Table

NewCommitProofTable ...

func NewHistoryAccountTreeTable

func NewHistoryAccountTreeTable(kvdb db.KV) *table.Table

NewHistoryAccountTreeTable ...

func NewZksync

func NewZksync() drivers.Driver

NewExchange ...

func NewZksyncInfoTable

func NewZksyncInfoTable(kvdb db.KV) *table.Table

NewZksyncInfoTable ...

func UpdateLeaf

func UpdateLeaf(statedb dbm.KV, localdb dbm.KV, info *TreeUpdateInfo, accountId uint64, tokenId uint64, amount string, option int32) ([]*types.KeyValue, []*types.KeyValue, error)

UpdateLeaf 更新叶子结点:1、如果在当前树的叶子中,直接更新 2、如果在归档的树中,需要找到归档的root,重新生成root

func UpdatePubKey

func UpdatePubKey(statedb dbm.KV, localdb dbm.KV, info *TreeUpdateInfo, pubKey *zt.ZkPubKey, accountId uint64) ([]*types.KeyValue, []*types.KeyValue, error)

Types

type AccountTreeRow

type AccountTreeRow struct {
	*zt.Leaf
}

AccountTreeRow table meta 结构

func NewAccountTreeRow

func NewAccountTreeRow() *AccountTreeRow

func (*AccountTreeRow) CreateRow

func (r *AccountTreeRow) CreateRow() *table.Row

CreateRow 新建数据行

func (*AccountTreeRow) Get

func (r *AccountTreeRow) Get(key string) ([]byte, error)

Get 按照indexName 查询 indexValue

func (*AccountTreeRow) SetPayload

func (r *AccountTreeRow) SetPayload(data types.Message) error

SetPayload 设置数据

type Action

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

Action action struct

func NewAction

func NewAction(z *zksync, tx *types.Transaction, index int) *Action

NewAction ...

func (*Action) ContractToTree

func (a *Action) ContractToTree(payload *zt.ZkContractToTree) (*types.Receipt, error)

func (*Action) Deposit

func (a *Action) Deposit(payload *zt.ZkDeposit) (*types.Receipt, error)

func (*Action) ForceExit

func (a *Action) ForceExit(payload *zt.ZkForceExit) (*types.Receipt, error)

func (*Action) FullExit

func (a *Action) FullExit(payload *zt.ZkFullExit) (*types.Receipt, error)

func (*Action) GetIndex

func (a *Action) GetIndex() int64

GetIndex get index

func (*Action) MakeFeeLog

func (a *Action) MakeFeeLog(amount string, info *TreeUpdateInfo, tokenId uint64, sign *zt.ZkSignature) (*types.Receipt, error)

func (*Action) SetPubKey

func (a *Action) SetPubKey(payload *zt.ZkSetPubKey) (*types.Receipt, error)

func (*Action) Transfer

func (a *Action) Transfer(payload *zt.ZkTransfer) (*types.Receipt, error)

func (*Action) TransferToNew

func (a *Action) TransferToNew(payload *zt.ZkTransferToNew) (*types.Receipt, error)

func (*Action) TreeToContract

func (a *Action) TreeToContract(payload *zt.ZkTreeToContract) (*types.Receipt, error)

func (*Action) UpdateContractAccount

func (a *Action) UpdateContractAccount(addr string, amount string, tokenId uint64, option int32) ([]*types.KeyValue, error)

func (*Action) Withdraw

func (a *Action) Withdraw(payload *zt.ZkWithdraw) (*types.Receipt, error)

type CommitProofRow

type CommitProofRow struct {
	*zt.ZkCommitProof
}

CommitProofRow table meta 结构

func NewCommitProofRow

func NewCommitProofRow() *CommitProofRow

func (*CommitProofRow) CreateRow

func (r *CommitProofRow) CreateRow() *table.Row

CreateRow 新建数据行

func (*CommitProofRow) Get

func (r *CommitProofRow) Get(key string) ([]byte, error)

Get 按照indexName 查询 indexValue

func (*CommitProofRow) SetPayload

func (r *CommitProofRow) SetPayload(data types.Message) error

SetPayload 设置数据

type HistoryAccountTreeRow

type HistoryAccountTreeRow struct {
	*zt.HistoryLeaf
}

HistoryAccountTreeRow table meta 结构

func NewHistoryAccountTreeRow

func NewHistoryAccountTreeRow() *HistoryAccountTreeRow

func (*HistoryAccountTreeRow) CreateRow

func (r *HistoryAccountTreeRow) CreateRow() *table.Row

CreateRow 新建数据行

func (*HistoryAccountTreeRow) Get

func (r *HistoryAccountTreeRow) Get(key string) ([]byte, error)

Get 按照indexName 查询 indexValue

func (*HistoryAccountTreeRow) SetPayload

func (r *HistoryAccountTreeRow) SetPayload(data types.Message) error

SetPayload 设置数据

type TreeUpdateInfo

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

TreeUpdateInfo 更新信息,用于查询

type ZksyncInfoRow

type ZksyncInfoRow struct {
	*zt.OperationInfo
}

AccountTreeRow table meta 结构

func NewZksyncInfoRow

func NewZksyncInfoRow() *ZksyncInfoRow

func (*ZksyncInfoRow) CreateRow

func (r *ZksyncInfoRow) CreateRow() *table.Row

CreateRow 新建数据行

func (*ZksyncInfoRow) Get

func (r *ZksyncInfoRow) Get(key string) ([]byte, error)

Get 按照indexName 查询 indexValue

func (*ZksyncInfoRow) SetPayload

func (r *ZksyncInfoRow) SetPayload(data types.Message) error

SetPayload 设置数据

Jump to

Keyboard shortcuts

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