Documentation
¶
Index ¶
- Constants
- func ProtocolAddr() address.Address
- type Protocol
- func (p *Protocol) CreateGenesisStates(ctx context.Context, sm protocol.StateManager) error
- func (p *Protocol) CreatePreStates(ctx context.Context, sm protocol.StateManager) error
- func (p *Protocol) ForceRegister(r *protocol.Registry) error
- func (p *Protocol) Handle(ctx context.Context, elp action.Envelope, sm protocol.StateManager) (*action.Receipt, error)
- func (p *Protocol) Name() string
- func (p *Protocol) ReadState(context.Context, protocol.StateReader, []byte, ...[]byte) ([]byte, uint64, error)
- func (p *Protocol) Register(r *protocol.Registry) error
- func (p *Protocol) Validate(ctx context.Context, elp action.Envelope, sr protocol.StateReader) error
Constants ¶
const TransferSizeLimit = 32 * 1024
TransferSizeLimit is the maximum size of transfer allowed
Variables ¶
This section is empty.
Functions ¶
func ProtocolAddr ¶
ProtocolAddr returns the address generated from protocol id
Types ¶
type Protocol ¶
type Protocol struct {
// contains filtered or unexported fields
}
Protocol defines the protocol of handling account
func FindProtocol ¶
FindProtocol finds the registered protocol from registry
func NewProtocol ¶
func NewProtocol(depositGas protocol.DepositGas) *Protocol
NewProtocol instantiates the protocol of account
func (*Protocol) CreateGenesisStates ¶
CreateGenesisStates initializes the protocol by setting the initial balances to some addresses
func (*Protocol) CreatePreStates ¶ added in v2.5.0
CreatePreStates credits the testnet balance grant scheduled at this height, if there is one, before any action in the block executes. See genesis.TestnetGrants; it is refused on mainnet.
Writes go through the state manager rather than straight at the trie, so they reach the Erigon secondary store too. There is no transaction log, since nothing spends -- indexers deriving balances from transfer logs alone will not see the credit.
A grant can only be scheduled at a height that has not happened yet, which on any live chain is past Okhotsk, so a recipient that does not exist yet is created with the default zero-nonce account type. No LegacyNonceAccountTypeOption here, unlike the paths that also replay pre-Okhotsk history.
func (*Protocol) ForceRegister ¶
ForceRegister registers the protocol with a unique ID and force replacing the previous protocol if it exists
func (*Protocol) Handle ¶
func (p *Protocol) Handle(ctx context.Context, elp action.Envelope, sm protocol.StateManager) (*action.Receipt, error)
Handle handles an account
func (*Protocol) ReadState ¶
func (p *Protocol) ReadState(context.Context, protocol.StateReader, []byte, ...[]byte) ([]byte, uint64, error)
ReadState read the state on blockchain via protocol