Documentation ¶
Index ¶
- Constants
- func AssignAddress(dstValue reflect.Value, srcValue *common.Address) error
- func AssignBool(dstValue reflect.Value, srcValue bool) error
- func AssignBytes(dstValue reflect.Value, srcValue []byte) error
- func AssignDict(dstValue reflect.Value, srcValue map[string]interface{}) error
- func AssignHexInt(dstValue reflect.Value, srcValue *common.HexInt) error
- func AssignList(dstValue reflect.Value, srcValue []interface{}) error
- func AssignParameter(dstValue reflect.Value, value interface{}) error
- func AssignString(dstValue reflect.Value, srcValue string) error
- func CheckMethod(obj SystemScore, methodInfo *scoreapi.Info) error
- func CheckStruct(t reflect.Type, fields []scoreapi.Field) error
- func CheckType(t reflect.Type, mt scoreapi.DataType, fields []scoreapi.Field) error
- func DeployAndInstallSystemSCORE(cc CallContext, contentID string, owner, to module.Address, param []byte, ...) error
- func GetMaxStepLimit(cc CallContext, name string) *big.Int
- func GetRevision(cc CallContext) int
- func GetStepCost(cc CallContext, name string) *big.Int
- func GetStepCosts(cc CallContext) map[string]any
- func GetStepPrice(cc CallContext) *big.Int
- func GetTimestampThreshold(cc CallContext) int64
- func Invoke(score SystemScore, method string, paramObj *codec.TypedObj) (status error, result *codec.TypedObj, steps *big.Int)
- func IsCallableDataType(dt *string) bool
- func NewContext(wc state.WorldContext, cm ContractManager, eem eeproxy.Manager, ...) *context
- func NewFrame(p *callFrame, h ContractHandler, l *big.Int, ro bool, logger *trace.Logger) *callFrame
- func RegisterSystemScore(id string, m *SystemScoreModule)
- func RoundLimitFactorToRound(validator int, factor int64) int64
- func SetMaxStepLimit(cc CallContext, name string, cost *big.Int) (bool, error)
- func SetRevision(cc CallContext, revision int, ignoreSame bool) (int, error)
- func SetStepCost(cc CallContext, name string, cost *big.Int, prune bool) (bool, error)
- func SetStepPrice(cc CallContext, price *big.Int) (bool, error)
- func SetTimestampThreshold(cc CallContext, value int64) (bool, error)
- type AcceptHandler
- type AsyncContractHandler
- type CallContext
- type CallHandler
- func (h *CallHandler) AllowExtra()
- func (h *CallHandler) ArrayDBContains(prefix, value []byte, limit int64) (bool, int, int, error)
- func (h *CallHandler) DeleteValue(key []byte) ([]byte, error)
- func (h *CallHandler) Dispose()
- func (h *CallHandler) DoExecuteAsync(cc CallContext, ch eeproxy.CallContext, store containerdb.BytesStoreState) (err error)
- func (h *CallHandler) EEType() state.EEType
- func (h *CallHandler) ExecuteAsync(cc CallContext) (err error)
- func (h *CallHandler) GetBalance(addr module.Address) *big.Int
- func (h *CallHandler) GetInfo() *codec.TypedObj
- func (h *CallHandler) GetMethodName() string
- func (h *CallHandler) GetObjGraph(flags bool) (int, []byte, []byte, error)
- func (h *CallHandler) GetValue(key []byte) ([]byte, error)
- func (h *CallHandler) OnAPI(status error, info *scoreapi.Info)
- func (h *CallHandler) OnCall(from, to module.Address, value, limit *big.Int, dataType string, ...)
- func (h *CallHandler) OnEvent(addr module.Address, indexed, data [][]byte) error
- func (h *CallHandler) OnResult(status error, flag int, steps *big.Int, result *codec.TypedObj)
- func (h *CallHandler) OnSetFeeProportion(portion int)
- func (h *CallHandler) Prepare(ctx Context) (state.WorldContext, error)
- func (h *CallHandler) SendResult(status error, steps *big.Int, result *codec.TypedObj) error
- func (h *CallHandler) SetCode(code []byte) error
- func (h *CallHandler) SetObjGraph(flags bool, nextHash int, objGraph []byte) error
- func (h *CallHandler) SetValue(key []byte, value []byte) ([]byte, error)
- func (h *CallHandler) TLogDone(status error, steps *big.Int, result *codec.TypedObj)
- func (h *CallHandler) TLogStart()
- type CommonHandler
- func (h *CommonHandler) ApplyCallSteps(cc CallContext) error
- func (h *CommonHandler) ApplyStepsForInterCall(cc CallContext) error
- func (h *CommonHandler) Logger() log.Logger
- func (h *CommonHandler) Prepare(ctx Context) (state.WorldContext, error)
- func (h *CommonHandler) SetTraceLogger(logger *trace.Logger)
- func (h *CommonHandler) TraceLogger() *trace.Logger
- type ContentBytes
- type Context
- type ContractHandler
- type ContractManager
- type ContractStore
- type CustomLogs
- type DSContext
- type DSContextHistory
- type DSContextHistoryDB
- type DSRHandler
- type DataCallJSON
- type DeployData
- type DeployHandler
- type DepositHandler
- type DepositJSON
- type DoubleSignReport
- type FeePayer
- type FeePayerInfo
- func (p *FeePayerInfo) Apply(p2 FeePayerInfo, steps *big.Int)
- func (p *FeePayerInfo) ClearLogs()
- func (p *FeePayerInfo) GetLogs(r txresult.Receipt) bool
- func (p *FeePayerInfo) PaySteps(ctx CallContext, steps *big.Int) (*big.Int, error)
- func (p *FeePayerInfo) SetFeeProportion(payer module.Address, portion int) error
- type Patch
- type ResultFlag
- type SyncContractHandler
- type SystemScore
- type SystemScoreModule
- type TransferAndCallHandler
- type TransferHandler
Constants ¶
View Source
const ( CTypeNone = iota CTypeTransfer CTypeDeploy CTypeCall CTypePatch CTypeDeposit )
View Source
const ( FileSizeLimit = 1 * 1024 * 1024 ContentSizeLimit = 2 * 1024 * 1024 )
View Source
const ( DataTypeCall = "call" DataTypeMessage = "message" DataTypeDeploy = "deploy" DataTypeDeposit = "deposit" DataTypePatch = "patch" DataTypeDSR = "dsr" // for double sign report(DSR) )
View Source
const ( DepositActionAdd = "add" DepositActionWithdraw = "withdraw" )
View Source
const ( PreparingContractError = iota + errors.CodeService + 200 NoAvailableProxy )
View Source
const ( EventRevisionSet = "RevisionSet(int)" EventStepPriceSet = "StepPriceSet(int)" EventStepCostSet = "StepCostSet(str,int)" EventMaxStepLimitSet = "MaxStepLimitSet(str,int)" EventTimestampThresholdSet = "TimestampThresholdSet(int)" )
View Source
const (
CID_CHAIN = ""
)
View Source
const DSContextHistoryLimit = 20
View Source
const (
FUNC_PREFIX = "Ex_"
)
View Source
const HandleDoubleSignReport = "handleDoubleSignReport"
HandleDoubleSignReport has name of method of chain SCORE to handle double sign report. Its signature looks like "handleDoubleSignReport(type:str,height:int,signer:Address)".
View Source
const (
InterCallLimit = 1024
)
View Source
const (
PropInitialSnapshot = "transition.initialSnapshot"
)
Variables ¶
This section is empty.
Functions ¶
func AssignAddress ¶ added in v0.9.8
func AssignDict ¶ added in v0.9.8
func AssignHexInt ¶ added in v0.9.8
func AssignList ¶ added in v0.9.8
func AssignParameter ¶ added in v0.9.8
func AssignString ¶ added in v0.9.8
func CheckMethod ¶
func CheckMethod(obj SystemScore, methodInfo *scoreapi.Info) error
func DeployAndInstallSystemSCORE ¶ added in v0.9.1
func GetMaxStepLimit ¶ added in v1.4.0
func GetMaxStepLimit(cc CallContext, name string) *big.Int
GetMaxStepLimit returns MaxStepLimit for specified operation
func GetRevision ¶ added in v1.4.0
func GetRevision(cc CallContext) int
func GetStepCost ¶ added in v1.4.0
func GetStepCost(cc CallContext, name string) *big.Int
func GetStepCosts ¶ added in v1.4.0
func GetStepCosts(cc CallContext) map[string]any
func GetStepPrice ¶ added in v1.4.0
func GetStepPrice(cc CallContext) *big.Int
func GetTimestampThreshold ¶ added in v1.4.0
func GetTimestampThreshold(cc CallContext) int64
func IsCallableDataType ¶ added in v0.9.8
func NewContext ¶
func NewContext( wc state.WorldContext, cm ContractManager, eem eeproxy.Manager, chain module.Chain, log log.Logger, ti *module.TraceInfo, eep eeproxy.RequestPriority, ) *context
func RegisterSystemScore ¶ added in v0.9.1
func RegisterSystemScore(id string, m *SystemScoreModule)
func RoundLimitFactorToRound ¶
func SetMaxStepLimit ¶ added in v1.4.0
func SetRevision ¶ added in v1.4.0
func SetRevision(cc CallContext, revision int, ignoreSame bool) (int, error)
SetRevision set revision value in system storage. then returns old value on success. If a new revision is smaller than the current, then it returns InvalidParameterError If the revision is changed, then it emits proper events Otherwise, it returns old revision value.
func SetStepCost ¶ added in v1.4.0
func SetStepPrice ¶ added in v1.4.0
func SetStepPrice(cc CallContext, price *big.Int) (bool, error)
func SetTimestampThreshold ¶ added in v1.4.0
func SetTimestampThreshold(cc CallContext, value int64) (bool, error)
Types ¶
type AcceptHandler ¶
type AcceptHandler struct { *CommonHandler // contains filtered or unexported fields }
func NewAcceptHandler ¶ added in v0.9.1
func NewAcceptHandler(ch *CommonHandler, txHash []byte, auditTxHash []byte) *AcceptHandler
func (*AcceptHandler) ExecuteSync ¶
func (h *AcceptHandler) ExecuteSync(cc CallContext) (err error, obj *codec.TypedObj, addr module.Address)
func (*AcceptHandler) Prepare ¶
func (h *AcceptHandler) Prepare(ctx Context) (state.WorldContext, error)
It's never called
type AsyncContractHandler ¶
type AsyncContractHandler interface { ContractHandler ExecuteAsync(cc CallContext) error SendResult(status error, steps *big.Int, result *codec.TypedObj) error Dispose() EEType() state.EEType eeproxy.CallContext }
type CallContext ¶
type CallContext interface { Context ReadOnlyMode() bool Call(handler ContractHandler, limit *big.Int) (error, *big.Int, *codec.TypedObj, module.Address) OnResult(status error, flags ResultFlag, stepUsed *big.Int, result *codec.TypedObj, addr module.Address) OnCall(handler ContractHandler, limit *big.Int) OnEvent(addr module.Address, indexed, data [][]byte) OnBTPMessage(nid int64, message []byte) GetBalance(module.Address) *big.Int ReserveExecutor() error GetProxy(eeType state.EEType) eeproxy.Proxy Dispose() StepUsed() *big.Int SumOfStepUsed() *big.Int StepAvailable() *big.Int ApplySteps(t state.StepType, n int) bool ApplyCallSteps() error DeductSteps(s *big.Int) bool ResetStepLimit(s *big.Int) GetEventLogs(r txresult.Receipt) GetBTPMessages(r txresult.Receipt) EnterReadOnlyMode() SetFrameCodeID(id []byte) GetLastEIDOf(id []byte) int NewExecution() int GetReturnEID() int FrameID() int FrameLogger() *trace.Logger GetCustomLogs(name string, ot reflect.Type) CustomLogs SetFeeProportion(addr module.Address, portion int) RedeemSteps(s *big.Int) (*big.Int, error) GetRedeemLogs(r txresult.Receipt) bool ClearRedeemLogs() DoIOTask(func()) ResultFlags() ResultFlag }
func NewCallContext ¶
func NewCallContext(ctx Context, limit *big.Int, isQuery bool) CallContext
type CallHandler ¶
type CallHandler struct { *CommonHandler // contains filtered or unexported fields }
func (*CallHandler) AllowExtra ¶ added in v0.9.6
func (h *CallHandler) AllowExtra()
func (*CallHandler) ArrayDBContains ¶ added in v0.9.10
func (*CallHandler) DeleteValue ¶
func (h *CallHandler) DeleteValue(key []byte) ([]byte, error)
func (*CallHandler) Dispose ¶
func (h *CallHandler) Dispose()
func (*CallHandler) DoExecuteAsync ¶ added in v0.9.4
func (h *CallHandler) DoExecuteAsync(cc CallContext, ch eeproxy.CallContext, store containerdb.BytesStoreState) (err error)
func (*CallHandler) EEType ¶
func (h *CallHandler) EEType() state.EEType
func (*CallHandler) ExecuteAsync ¶
func (h *CallHandler) ExecuteAsync(cc CallContext) (err error)
func (*CallHandler) GetBalance ¶
func (h *CallHandler) GetBalance(addr module.Address) *big.Int
func (*CallHandler) GetInfo ¶
func (h *CallHandler) GetInfo() *codec.TypedObj
func (*CallHandler) GetMethodName ¶ added in v0.9.6
func (h *CallHandler) GetMethodName() string
func (*CallHandler) GetObjGraph ¶
func (*CallHandler) OnEvent ¶
func (h *CallHandler) OnEvent(addr module.Address, indexed, data [][]byte) error
func (*CallHandler) OnSetFeeProportion ¶ added in v0.9.3
func (h *CallHandler) OnSetFeeProportion(portion int)
func (*CallHandler) Prepare ¶
func (h *CallHandler) Prepare(ctx Context) (state.WorldContext, error)
func (*CallHandler) SendResult ¶
func (*CallHandler) SetCode ¶
func (h *CallHandler) SetCode(code []byte) error
func (*CallHandler) SetObjGraph ¶
func (h *CallHandler) SetObjGraph(flags bool, nextHash int, objGraph []byte) error
func (*CallHandler) SetValue ¶
func (h *CallHandler) SetValue(key []byte, value []byte) ([]byte, error)
func (*CallHandler) TLogStart ¶ added in v0.9.7
func (h *CallHandler) TLogStart()
type CommonHandler ¶
type CommonHandler struct {
From, To module.Address
Value *big.Int
Log *trace.Logger
// contains filtered or unexported fields
}
func NewCommonHandler ¶ added in v0.9.1
func (*CommonHandler) ApplyCallSteps ¶ added in v0.9.10
func (h *CommonHandler) ApplyCallSteps(cc CallContext) error
func (*CommonHandler) ApplyStepsForInterCall ¶ added in v0.9.4
func (h *CommonHandler) ApplyStepsForInterCall(cc CallContext) error
func (*CommonHandler) Logger ¶
func (h *CommonHandler) Logger() log.Logger
func (*CommonHandler) Prepare ¶
func (h *CommonHandler) Prepare(ctx Context) (state.WorldContext, error)
func (*CommonHandler) SetTraceLogger ¶ added in v1.2.4
func (h *CommonHandler) SetTraceLogger(logger *trace.Logger)
func (*CommonHandler) TraceLogger ¶ added in v1.2.4
func (h *CommonHandler) TraceLogger() *trace.Logger
type ContentBytes ¶ added in v0.9.6
func (*ContentBytes) Count ¶ added in v0.9.6
func (c *ContentBytes) Count(revision module.Revision) int
func (*ContentBytes) GetBytes ¶ added in v0.9.6
func (c *ContentBytes) GetBytes() []byte
func (*ContentBytes) UnmarshalJSON ¶ added in v0.9.6
func (c *ContentBytes) UnmarshalJSON(b []byte) error
type Context ¶
type Context interface { state.WorldContext TransactionTimeout() time.Duration ContractManager() ContractManager EEManager() eeproxy.Manager GetPreInstalledScore(id string) ([]byte, error) AddSyncRequest(id db.BucketID, key []byte) Logger() log.Logger GetTraceLogger(phase module.ExecutionPhase) *trace.Logger PatchDecoder() module.PatchDecoder TraceInfo() *module.TraceInfo ChainID() int GetProperty(name string) interface{} SetProperty(name string, value interface{}) GetEnabledEETypes() state.EETypes EEPriority() eeproxy.RequestPriority }
type ContractHandler ¶
type ContractManager ¶
type ContractManager interface { DefaultEnabledEETypes() state.EETypes GenesisTo() module.Address GetHandler(from, to module.Address, value *big.Int, ctype int, data []byte) (ContractHandler, error) GetCallHandler(from, to module.Address, value *big.Int, ctype int, paramObj *codec.TypedObj) (ContractHandler, error) PrepareContractStore(ws state.WorldState, contract state.ContractState) (ContractStore, error) GetSystemScore(contentID string, cc CallContext, from module.Address, value *big.Int) (SystemScore, error) Logger() log.Logger }
func NewContractManager ¶
type ContractStore ¶
type CustomLogs ¶ added in v0.9.10
type CustomLogs interface { Init(parent CustomLogs) CustomLogs Apply(data CustomLogs) }
type DSContextHistory ¶ added in v1.3.10
type DSContextHistory []DSContext
func DSContextHistoryFromBytes ¶ added in v1.3.10
func DSContextHistoryFromBytes(bs []byte) (DSContextHistory, error)
func (*DSContextHistory) Bytes ¶ added in v1.3.10
func (h *DSContextHistory) Bytes() []byte
func (*DSContextHistory) FirstHeight ¶ added in v1.3.10
func (h *DSContextHistory) FirstHeight() (int64, bool)
func (*DSContextHistory) Get ¶ added in v1.3.10
func (h *DSContextHistory) Get(height int64) []byte
type DSContextHistoryDB ¶ added in v1.3.10
type DSContextHistoryDB struct { DSContextHistory // contains filtered or unexported fields }
func NewDSContextHistoryDB ¶ added in v1.3.10
func NewDSContextHistoryDB(as containerdb.BytesStoreState) (*DSContextHistoryDB, error)
type DSRHandler ¶ added in v1.3.10
type DSRHandler struct { *CommonHandler // contains filtered or unexported fields }
func NewDSRHandler ¶ added in v1.3.10
func NewDSRHandler(from module.Address, dsr *DoubleSignReport, logger log.Logger) *DSRHandler
func (*DSRHandler) DoExecuteSync ¶ added in v1.3.10
func (h *DSRHandler) DoExecuteSync(cc CallContext) (error, *codec.TypedObj, module.Address)
func (*DSRHandler) ExecuteSync ¶ added in v1.3.10
func (h *DSRHandler) ExecuteSync(cc CallContext) (err error, ro *codec.TypedObj, _ module.Address)
func (*DSRHandler) Prepare ¶ added in v1.3.13
func (h *DSRHandler) Prepare(ctx Context) (state.WorldContext, error)
type DataCallJSON ¶
type DataCallJSON struct { Method string `json:"method"` Params json.RawMessage `json:"params"` }
func ParseCallData ¶
func ParseCallData(data []byte) (*DataCallJSON, error)
type DeployData ¶
type DeployData struct { ContentType string `json:"contentType"` Content *ContentBytes `json:"content"` Params json.RawMessage `json:"params"` }
func ParseDeployData ¶
func ParseDeployData(data []byte) (*DeployData, error)
type DeployHandler ¶
type DeployHandler struct { *CommonHandler // contains filtered or unexported fields }
func NewDeployHandlerForPreInstall ¶
func NewDeployHandlerForPreInstall(owner, scoreAddr module.Address, contentType string, content []byte, params *json.RawMessage, log log.Logger, ) *DeployHandler
func (*DeployHandler) DoExecuteSync ¶ added in v0.9.10
func (h *DeployHandler) DoExecuteSync(cc CallContext) (error, *codec.TypedObj, module.Address)
func (*DeployHandler) ExecuteSync ¶
func (h *DeployHandler) ExecuteSync(cc CallContext) (err error, ro *codec.TypedObj, score module.Address)
func (*DeployHandler) Prepare ¶
func (h *DeployHandler) Prepare(ctx Context) (state.WorldContext, error)
type DepositHandler ¶ added in v0.9.3
type DepositHandler struct { *CommonHandler // contains filtered or unexported fields }
func (*DepositHandler) ExecuteSync ¶ added in v0.9.3
func (h *DepositHandler) ExecuteSync(cc CallContext) (err error, ro *codec.TypedObj, addr module.Address)
func (*DepositHandler) Prepare ¶ added in v0.9.3
func (h *DepositHandler) Prepare(ctx Context) (state.WorldContext, error)
type DepositJSON ¶ added in v0.9.3
type DepositJSON struct { Action string `json:"action"` ID *common.HexBytes `json:"id,omitempty"` Amount *common.HexInt `json:"amount,omitempty"` }
func ParseDepositData ¶ added in v0.9.3
func ParseDepositData(data []byte) (*DepositJSON, error)
type DoubleSignReport ¶ added in v1.3.10
type DoubleSignReport struct { Type string `json:"type"` Data []common.HexBytes `json:"data"` Context common.HexBytes `json:"context"` // contains filtered or unexported fields }
func NewDoubleSignReport ¶ added in v1.3.10
func NewDoubleSignReport(data []module.DoubleSignData, context module.DoubleSignContext) *DoubleSignReport
func (*DoubleSignReport) Decode ¶ added in v1.3.10
func (dsr *DoubleSignReport) Decode(wc state.WorldContext, force bool) ([]module.DoubleSignData, module.DoubleSignContext, error)
type FeePayer ¶ added in v1.2.9
type FeePayer struct {
// contains filtered or unexported fields
}
func (*FeePayer) DelegateSteps ¶ added in v1.2.9
type FeePayerInfo ¶ added in v1.2.9
type FeePayerInfo []*FeePayer
func (*FeePayerInfo) Apply ¶ added in v1.2.9
func (p *FeePayerInfo) Apply(p2 FeePayerInfo, steps *big.Int)
func (*FeePayerInfo) ClearLogs ¶ added in v1.2.9
func (p *FeePayerInfo) ClearLogs()
func (*FeePayerInfo) GetLogs ¶ added in v1.2.9
func (p *FeePayerInfo) GetLogs(r txresult.Receipt) bool
func (*FeePayerInfo) PaySteps ¶ added in v1.2.9
func (p *FeePayerInfo) PaySteps(ctx CallContext, steps *big.Int) (*big.Int, error)
func (*FeePayerInfo) SetFeeProportion ¶ added in v1.2.9
func (p *FeePayerInfo) SetFeeProportion(payer module.Address, portion int) error
type Patch ¶
func ParsePatchData ¶
type ResultFlag ¶ added in v1.2.9
type ResultFlag int
const (
ResultForceRerun ResultFlag = 1 << iota
)
type SyncContractHandler ¶
type SyncContractHandler interface { ContractHandler ExecuteSync(cc CallContext) (error, *codec.TypedObj, module.Address) }
type SystemScore ¶
type SystemScoreModule ¶
type SystemScoreModule struct {
New func(cid string, cc CallContext, from module.Address, value *big.Int) (SystemScore, error)
}
type TransferAndCallHandler ¶
type TransferAndCallHandler struct { *CallHandler // contains filtered or unexported fields }
func (*TransferAndCallHandler) DoExecuteAsync ¶ added in v0.9.7
func (h *TransferAndCallHandler) DoExecuteAsync(cc CallContext, ch eeproxy.CallContext, store containerdb.BytesStoreState) (err error)
func (*TransferAndCallHandler) ExecuteAsync ¶
func (h *TransferAndCallHandler) ExecuteAsync(cc CallContext) (err error)
func (*TransferAndCallHandler) Prepare ¶
func (h *TransferAndCallHandler) Prepare(ctx Context) (state.WorldContext, error)
type TransferHandler ¶
type TransferHandler struct {
*CommonHandler
}
func (*TransferHandler) DoExecuteSync ¶ added in v0.9.4
func (h *TransferHandler) DoExecuteSync(cc CallContext) (err error, ro *codec.TypedObj, addr module.Address)
func (*TransferHandler) ExecuteSync ¶
func (h *TransferHandler) ExecuteSync(cc CallContext) (err error, ro *codec.TypedObj, addr module.Address)
Click to show internal directories.
Click to hide internal directories.