Documentation ¶
Index ¶
- Constants
- Variables
- func AccountInfoToHash(account *AccountInfo, hasher *hash.Hash) []byte
- func ComputeCexAssetsCommitment(cexAssetsInfo []CexAssetInfo) []byte
- func ComputeUserAssetsCommitment(hasher *hash.Hash, assets []AccountAsset) []byte
- func ConvertAssetInfoToBytes(value any) []byte
- func ConvertFloatStrToUint64(f string, multiplier int64) (uint64, error)
- func GetMysqlSource(source string, secretId string) (string, error)
- func GetRedisLockByKey(conn *redis.Redis, keyLock string) (redisLock *redis.RedisLock)
- func GetSecretFromAws(secretId string) (string, error)
- func NewAccountTree(driver string, addr string) (accountTree bsmt.SparseMerkleTree, err error)
- func ParseUserDataSet(dirname string) ([]AccountInfo, []CexAssetInfo, error)
- func ReadUserDataFromCsvFile(name string) ([]AccountInfo, []CexAssetInfo, error)
- func SafeAdd(a uint64, b uint64) (c uint64)
- func SelectAssetValue(expectAssetIndex int, flag int, currentAssetPosition int, ...) (*big.Int, bool)
- func TryAcquireLock(redisLock *redis.RedisLock) (err error)
- func VerifyMerkleProof(root []byte, accountIndex uint32, proof [][]byte, node []byte) bool
- type AccountAsset
- type AccountInfo
- type BatchCreateUserWitness
- type CexAssetInfo
- type CreateUserOperation
Constants ¶
View Source
const ( BatchCreateUserOpsCounts = 864 AccountTreeDepth = 28 AssetCounts = 350 RedisLockKey = "prover_mutex_key" R1csBatchSize = 1000000 )
View Source
const ( LockExpiryTime = 10 // seconds RetryInterval = 500 * time.Millisecond MaxRetryTimes = 3 )
Variables ¶
View Source
var ( ZeroBigInt = new(big.Int).SetInt64(0) Uint64MaxValueBigInt, _ = new(big.Int).SetString("18446744073709551616", 10) Uint64MaxValueBigIntSquare, _ = new(big.Int).SetString("340282366920938463463374607431768211456", 10) Uint64MaxValueFr = new(fr.Element).SetBigInt(Uint64MaxValueBigInt) Uint64MaxValueFrSquare = new(fr.Element).SetBigInt(Uint64MaxValueBigIntSquare) AssetTypeForTwoDigits = map[string]bool{ "BTTC": true, "SHIB": true, "LUNC": true, "XEC": true, "WIN": true, "BIDR": true, "SPELL": true, "HOT": true, "DOGE": true, "PEPE": true, } )
View Source
var ( DbErrSqlOperation = errors.New("unknown sql operation error") DbErrNotFound = errors.New("sql: no rows in result set") GetRedisLockFailed = errors.New("get lock failed") )
View Source
var (
NilAccountHash []byte
)
Functions ¶
func AccountInfoToHash ¶
func AccountInfoToHash(account *AccountInfo, hasher *hash.Hash) []byte
func ComputeCexAssetsCommitment ¶
func ComputeCexAssetsCommitment(cexAssetsInfo []CexAssetInfo) []byte
func ComputeUserAssetsCommitment ¶
func ComputeUserAssetsCommitment(hasher *hash.Hash, assets []AccountAsset) []byte
func ConvertAssetInfoToBytes ¶
func ConvertFloatStrToUint64 ¶
func GetMysqlSource ¶ added in v1.0.2
user name can't include ":"
func GetRedisLockByKey ¶
func GetSecretFromAws ¶
func NewAccountTree ¶
func NewAccountTree(driver string, addr string) (accountTree bsmt.SparseMerkleTree, err error)
func ParseUserDataSet ¶
func ParseUserDataSet(dirname string) ([]AccountInfo, []CexAssetInfo, error)
func ReadUserDataFromCsvFile ¶
func ReadUserDataFromCsvFile(name string) ([]AccountInfo, []CexAssetInfo, error)
func SelectAssetValue ¶
func TryAcquireLock ¶
Types ¶
type AccountAsset ¶
type AccountInfo ¶
type BatchCreateUserWitness ¶
type BatchCreateUserWitness struct { BatchCommitment []byte BeforeAccountTreeRoot []byte AfterAccountTreeRoot []byte BeforeCEXAssetsCommitment []byte AfterCEXAssetsCommitment []byte BeforeCexAssets []CexAssetInfo CreateUserOps []CreateUserOperation }
func DecodeBatchWitness ¶
func DecodeBatchWitness(data string) *BatchCreateUserWitness
type CexAssetInfo ¶
type CexAssetInfo struct { TotalEquity uint64 TotalDebt uint64 BasePrice uint64 Symbol string Index uint32 }
func RecoverAfterCexAssets ¶
func RecoverAfterCexAssets(witness *BatchCreateUserWitness) []CexAssetInfo
type CreateUserOperation ¶
type CreateUserOperation struct { BeforeAccountTreeRoot []byte AfterAccountTreeRoot []byte Assets []AccountAsset AccountIndex uint32 AccountIdHash []byte AccountProof [AccountTreeDepth][]byte }
Click to show internal directories.
Click to hide internal directories.