# Functions
ApplyIncomingReceipt will add amount into ToAddress in the receipt.
ApplyMessage computes the new state by applying the given message against the old state within the environment.
ApplyStakingMessage computes the new state for staking message.
ApplyStakingTransaction attempts to apply a staking transaction to the given state database and uses the input parameters for its environment.
ApplyTransaction attempts to apply a transaction to the given state database and uses the input parameters for its environment.
CalcGasLimit computes the gas limit of the next block after parent.
calculate the gas for migration; no checks done here similar to other functions the checks are handled by staking_verifier.go, ex, if you try to delegate to an address who is not a validator - you will be charged all gas passed in two steps - 22k initially when gas is calculated - remainder when the tx inevitably is a no-op i have followed the same logic here, this only produces an error if can't read from db.
CanTransfer checks whether there are enough funds in the address' account to make a transfer.
No description provided by the author
HandleStakeMsgFn returns a function which accepts (1) the chain state database (2) the processed staking parameters the function can then be called through the EVM context.
No description provided by the author
No description provided by the author
EncodeGenesisConfig converts json file into binary format for genesis block.
GenerateChain creates a chain of n blocks.
GetGenesisSpec for a given shard.
GetHashFn returns a GetHashFunc which retrieves header hashes by number.
GetInitialFunds for a given shard.
GetVRFFn returns a GetVRFFn which retrieves header vrf by number.
IsEpochBlock returns whether this block is the first block of an epoch.
IsValidator determines whether it is a validator address or not.
NewBlockChain returns a fully initialised block chain using information available in the database.
NewBlockValidator returns a new block validator which is safe for re-use.
NewChainIndexer creates a new chain indexer to do background processing on chain segments of a given size after certain number of confirmations passed.
NewCxPool creates a new CxPool.
NewEVMContext creates a new context for use in the EVM.
NewGenesisSpec creates a new genesis spec for the given network type and shard ID.
NewHeaderChain creates a new HeaderChain structure.
NewStateProcessor initialises a new StateProcessor.
NewStateTransition initialises and returns a new state transition object.
NewTxPool creates a new transaction pool to gather, sort and filter inbound transactions from the network.
SetReceiptsData computes all the non-consensus fields of the receipts.
StakingToMessage returns the staking transaction as a core.Message.
StringToBigInt converts a string to BigInt.
Transfer subtracts amount from sender and adds amount to recipient using the given Db.
No description provided by the author
VerifyAndCollectRewardsFromDelegation verifies and collects rewards from the given delegation slice using the stateDB.
VerifyAndCreateValidatorFromMsg verifies the create validator message using the stateDB, epoch, & blocknumber and returns the validatorWrapper created in the process.
VerifyAndDelegateFromMsg verifies the delegate message using the stateDB and returns the balance to be deducted by the delegator as well as the validatorWrapper with the delegation applied to it.
VerifyAndEditValidatorFromMsg verifies the edit validator message using the stateDB, chainContext and returns the edited validatorWrapper.
VerifyAndMigrateFromMsg verifies and transfers all delegations of msg.From to msg.To.
VerifyAndUndelegateFromMsg verifies the undelegate validator message using the stateDB & chainContext and returns the edited validatorWrapper with the undelegation applied to it.
# Constants
BabylonGenesisToken is the initial total number of FEE in the genesis block for babylon.
BlockChainVersion ensures that an incompatible database forces a resync from scratch.
Constants for WriteStatus.
ContractDeployerInitFund is the initial fund for the contract deployer account in testnet/devnet.
CxPoolSize is the maximum size of the pool.
GenesisEpoch is the number of the genesis epoch.
GenesisONEToken is the initial total number of FEE in the genesis block for asadal.
InitFreeFund is the initial fund for permissioned accounts for testnet/devnet/.
Constants for WriteStatus.
Constants for WriteStatus.
Constants for TxStatus.
Constants for TxStatus.
Constants for TxStatus.
Constants for TxStatus.
# Variables
BabylonGenesisFund is the initial total number of FEE (in atto) in the genesis block for babylon.
DefaultTxPoolConfig contains the default configurations for the transaction pool.
ErrBlacklistedHash is returned if a block to import is on the blacklist.
ErrBlacklistFrom is returned if a transaction's from/source address is blacklisted.
ErrBlacklistTo is returned if a transaction's to/destination address is blacklisted.
ErrGasLimit is returned if a transaction's requested gas limit exceeds the maximum allowance of the current block.
ErrGasLimitReached is returned by the gas pool if the amount of gas required by a transaction is higher than what's left in the block.
ErrInsufficientFunds is returned if the total cost of executing a transaction is higher than the balance of the user's account.
ErrIntrinsicGas is returned if the transaction is specified to use less gas than required to start the invocation.
ErrInvalidMsgForStakingDirective is returned if a staking message does not match the related directive.
ErrInvalidSender is returned if the transaction contains an invalid signature.
ErrInvalidShard is returned if the transaction is for the wrong shard.
ErrKnownBlock is returned when a block to import is already known locally.
ErrKnownTransaction is returned if a transaction that is already in the pool attempting to be added to the pool.
ErrNegativeValue is a sanity error to ensure noone is able to specify a transaction with a negative value.
ErrNoGenesis is the error when there is no genesis.
ErrNonceTooHigh is returned if the nonce of a transaction is higher than the next one expected based on the local chain.
ErrNonceTooLow is returned if the nonce of a transaction is lower than the one present in the local chain.
ErrOversizedData is returned if the input data of a transaction is greater than some meaningful limit a user might use.
ErrReplaceUnderpriced is returned if a transaction is attempted to be replaced with a different one without the required price bump.
ErrShardStateNotMatch is returned if the calculated shardState hash not equal that in the block header.
ErrUnderpriced is returned if a transaction's gas price is below the minimum configured for the transaction pool.
GenesisFund is the initial total number of FEE (in atto) in the genesis block for asadal.
# Structs
BadBlock ..
BlockChain represents the canonical chain given a database with a genesis block.
BlockGen creates blocks for testing.
BlockValidator is responsible for validating block headers, uncles and processed state.
CacheConfig contains the configuration values for the trie caching/pruning that's resident in a blockchain.
ChainEvent is the struct of chain event.
ChainHeadEvent is the struct of chain head event.
ChainIndexer does a post-processing job for equally sized sections of the canonical chain (like BlooomBits and CHT structures).
ChainSideEvent is chain side event.
CxEntry represents the egress receipt's blockHash and ToShardID.
CxPool is to hold a pool of block outgoing receipts to be resend in next round broadcast When a user/client doesn't find the destination shard get the money from cross shard tx it can send RPC call along with txID to allow the any validator to add the corresponding block's receipts to be resent.
ExecutionResult is the return value from a transaction committed to the DB.
Genesis specifies the header fields, state of a genesis block.
GenesisAccount is an account in the state of the genesis block.
GenesisItem represents one genesis block transaction.
GenesisMismatchError is raised when trying to overwrite an existing genesis block with an incompatible one.
HeaderChain implements the basic block header chain logic that is shared by core.BlockChain and light.LightChain.
NewMinedBlockEvent is posted when a block has been imported.
NewTxsEvent is posted when a batch of transactions enter the transaction pool.
PendingLogsEvent is posted pre mining and notifies of pending logs.
this structure is cached, and each individual element is returned.
RemovedLogsEvent is posted when a reorg happens.
StateProcessor is a basic Processor, which takes care of transitioning state from one point to another.
StateTransition is the State Transitioning Model which is described as follows:
A state transition is a change made when a transaction is applied to the current world state
The state transitioning model does all the necessary work to work out a valid new state root.
TxPool contains all currently known transactions.
TxPoolConfig are the configuration parameters of the transaction pool.
# Interfaces
ChainContext supports retrieving headers and consensus parameters from the current blockchain to be used during transaction processing.
ChainIndexerBackend defines the methods needed to process chain segments in the background and write the segment results into the database.
ChainIndexerChain interface is used for connecting the indexer to a blockchain.
Message represents a message sent to a contract.
Processor is an interface for processing blocks using a given initial state.
Validator is an interface which defines the standard for block validation.
# Type aliases
DeleteCallback is a callback function that is called by SetHead before each header is deleted.
GasPool tracks the amount of gas available during execution of the transactions in a block.
GenesisAlloc specifies the initial state that is part of the genesis block.
TxStatus is the current status of a transaction as seen by the pool.
WhCallback is a callback function for inserting individual headers.
WriteStatus status of write.