txfilter

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const EpochBlocks = int64(200)
View Source
const ThresholdUnit = 1000

it means the lowest bond balance must equal or larger than the 1/1000 of totalBalance

View Source
const UnbondWaitEpochs = 3

Variables

View Source
var (
	SendToLock   = common.HexToAddress("0x7777777777777777777777777777777777777777")
	SendToUnlock = common.HexToAddress("0x8888888888888888888888888888888888888888")

	ErrPosTableNotCreate = errors.New("PosTable has not created yet")
	ErrPosTableNotInit   = errors.New("PosTable has not init yet")

	UpgradeHeight int64
)
View Source
var (
	SendToMint  = common.HexToAddress("0x1111111111111111111111111111111111111111")
	SendToAuth  = common.HexToAddress("0x2222222222222222222222222222222222222222")
	SendToRelay = common.HexToAddress("0x3333333333333333333333333333333333333333")

	ErrAuthTableNotCreate = errors.New("AuthTable has not created yet")
)
View Source
var (
	PPChainAdmin common.Address
	Bigguy       common.Address
)

Functions

func DoAuthHandle added in v1.4.5

func DoAuthHandle(from common.Address, txDataBytes []byte, height int64) (err error)

func DoBetHandle added in v1.4.5

func DoBetHandle(from common.Address, to *common.Address, balance *big.Int, txDataBytes []byte, height int64) (isBetTx bool, err error)

func IsAuthBlocked added in v1.4.5

func IsAuthBlocked(from common.Address, txDataBytes []byte, height int64) (err error)

func IsAuthTx added in v1.4.5

func IsAuthTx(to common.Address) bool

func IsBetBlocked added in v1.4.5

func IsBetBlocked(from common.Address, to *common.Address, balance *big.Int, txDataBytes []byte, height int64) (err error)

func IsBetTx

func IsBetTx(to common.Address) bool

func IsLockTx

func IsLockTx(to common.Address) bool

func IsMintBlocked added in v1.4.5

func IsMintBlocked(from common.Address) (err error)

func IsMintTx added in v1.4.5

func IsMintTx(to common.Address) bool

func IsRelayTx added in v1.4.5

func IsRelayTx(to common.Address) bool

func IsUnlockTx

func IsUnlockTx(to common.Address) bool

Types

type AuthData added in v1.4.5

type AuthData struct {
	PermittedAddress   common.Address `json:"permitted_address"`
	StartBlockHeight   int64          `json:"start_block_height"`
	EndBlockHeight     int64          `json:"end_block_height"`
	OperationType      string         `json:"operation_type"`
	ApprovedTxDataHash []byte         `json:"approved_tx_data_hash"`
}

func UnMarshalAuthTxData added in v1.4.5

func UnMarshalAuthTxData(jsonByte []byte) (AuthData, error)

type AuthItem added in v1.4.5

type AuthItem struct {
	ApprovedTxDataHash []byte `json:"approved_tx_data_hash"`
	PermitHeight       int64  `json:"auth_height"`
	StartHeight        int64  `json:"start_height"`
	EndHeight          int64  `json:"end_height"`
}

type AuthTable added in v1.4.5

type AuthTable struct {
	AuthItemMap map[common.Address]*AuthItem `json:"auth_item_map"`
}

TODO: merge this map into PosTable

var (
	EthAuthTable *AuthTable
)

func CreateAuthTable added in v1.4.5

func CreateAuthTable() *AuthTable

func NewAuthTable added in v1.4.5

func NewAuthTable() *AuthTable

func (*AuthTable) DeleteAuthItem added in v1.4.5

func (permitTable *AuthTable) DeleteAuthItem(permittedAddr common.Address) error

func (*AuthTable) InsertAuthItem added in v1.4.5

func (permitTable *AuthTable) InsertAuthItem(permittedAddr common.Address, pi *AuthItem) error

type PosItem

type PosItem struct {
	Height           int64            `json:"height"`
	Slots            int64            `json:"slots"`
	PubKey           abciTypes.PubKey `json:"pubKey"`
	TmAddress        string           `json:"tm_address"`
	BlsKeyString     string           `json:"bls_key_string"`
	Beneficiary      common.Address   `json:"beneficiary"`
	BeneficiaryBonus *big.Int         `json:"beneficiary_bonus"` //currently not used
}

func NewPosItem

func NewPosItem(height int64, slots int64, pubKey abciTypes.PubKey, tmAddress string, blsKeyString string, beneficiary common.Address) *PosItem

func (*PosItem) Copy

func (pi *PosItem) Copy() *PosItem

type PosItemSortedQueue

type PosItemSortedQueue []*PosItemWithSigner

func NewPosItemSortedQueue

func NewPosItemSortedQueue() *PosItemSortedQueue

func (*PosItemSortedQueue) Copy

func (*PosItemSortedQueue) Len

func (pq *PosItemSortedQueue) Len() int

func (*PosItemSortedQueue) Less

func (pq *PosItemSortedQueue) Less(i, j int) bool

func (*PosItemSortedQueue) Pop

func (pq *PosItemSortedQueue) Pop() interface{}

func (*PosItemSortedQueue) Push

func (pq *PosItemSortedQueue) Push(x interface{})

func (*PosItemSortedQueue) Swap

func (pq *PosItemSortedQueue) Swap(i, j int)

type PosItemWithSigner

type PosItemWithSigner struct {
	Height int64
	Signer common.Address
	Slots  int64
	// contains filtered or unexported fields
}

=============================================================================

func (*PosItemWithSigner) Copy

type PosTable

type PosTable struct {
	Mtx             sync.RWMutex                          `json:"-"`
	InitFlag        bool                                  `json:"-"`
	PosItemMap      map[common.Address]*PosItem           `json:"pos_item_map"`
	SortedPosItems  *PosItemSortedQueue                   `json:"-"`
	PosItemIndexMap map[common.Address]*PosItemWithSigner `json:"-"`
	TotalSlots      int64                                 `json:"-"`
	SortedSigners   []common.Address                      `json:"-"`

	UnbondPosItemMap      map[common.Address]*PosItem           `json:"unbond_pos_item_map"`
	SortedUnbondPosItems  *UnbondPosItemSortedQueue             `json:"-"`
	UnbondPosItemIndexMap map[common.Address]*PosItemWithSigner `json:"-"`
	SortedUnbondSigners   []common.Address                      `json:"-"`

	TmAddressToSignerMap    map[string]common.Address `json:"-"`
	BlsKeyStringToSignerMap map[string]common.Address `json:"-"`
	Threshold               *big.Int                  `json:"threshold"` // threshold value of PosTable
	ChangedFlagThisBlock    bool                      `json:"-"`
}
var (
	EthPosTable *PosTable
)

func CreatePosTable

func CreatePosTable() *PosTable

func NewPosTable

func NewPosTable() *PosTable

func (*PosTable) CanRemovePosItem

func (posTable *PosTable) CanRemovePosItem() error

func (*PosTable) Copy

func (posTable *PosTable) Copy() *PosTable

func (*PosTable) ExportSortedSigners

func (posTable *PosTable) ExportSortedSigners()

func (*PosTable) InitStruct

func (posTable *PosTable) InitStruct()

func (*PosTable) InsertPosItem added in v1.4.5

func (posTable *PosTable) InsertPosItem(signer common.Address, pi *PosItem) error

func (*PosTable) RemovePosItem

func (posTable *PosTable) RemovePosItem(signer common.Address, height int64, slash bool) error

func (*PosTable) SelectItemByHeightValue

func (posTable *PosTable) SelectItemByHeightValue(random int64) (common.Address, PosItem)

func (*PosTable) SelectItemBySeedValue

func (posTable *PosTable) SelectItemBySeedValue(vrf []byte, len int) (common.Address, PosItem)

func (*PosTable) SetThreshold

func (posTable *PosTable) SetThreshold(threshold *big.Int)

func (*PosTable) String

func (posTable *PosTable) String() string

func (*PosTable) TopKSigners

func (posTable *PosTable) TopKSigners(k int) []common.Address

func (*PosTable) TryRemoveUnbondPosItems

func (posTable *PosTable) TryRemoveUnbondPosItems(currentHeight int64, sortedUnbondSigners []common.Address) int

func (*PosTable) UpdatePosItem added in v1.4.5

func (posTable *PosTable) UpdatePosItem(signer common.Address, newSlots int64) error

type TxData

type TxData struct {
	PubKey       abciTypes.PubKey `json:"pub_key"`
	Beneficiary  string           `json:"beneficiary"`
	BlsKeyString string           `json:"bls_key_string"`
}

func UnMarshalTxData

func UnMarshalTxData(jsonByte []byte) (*TxData, error)

type UnbondPosItemSortedQueue

type UnbondPosItemSortedQueue []*PosItemWithSigner

func NewUnbondPosItemSortedQueue

func NewUnbondPosItemSortedQueue() *UnbondPosItemSortedQueue

func (*UnbondPosItemSortedQueue) Copy

func (*UnbondPosItemSortedQueue) Len

func (pq *UnbondPosItemSortedQueue) Len() int

func (*UnbondPosItemSortedQueue) Less

func (pq *UnbondPosItemSortedQueue) Less(i, j int) bool

func (*UnbondPosItemSortedQueue) Pop

func (pq *UnbondPosItemSortedQueue) Pop() interface{}

func (*UnbondPosItemSortedQueue) Push

func (pq *UnbondPosItemSortedQueue) Push(x interface{})

func (*UnbondPosItemSortedQueue) Swap

func (pq *UnbondPosItemSortedQueue) Swap(i, j int)

Jump to

Keyboard shortcuts

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