burrow, events

本文深入探讨了Hyperledger Burrow中智能合约执行的各种事件类型,包括调用、日志、输入输出、治理等,详细解释了每种事件的触发条件及处理流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

All events

// Execution event types
const (
	TypeUnknown EventType = iota
	TypeCall
	TypeLog
	TypeAccountInput
	TypeAccountOutput
	TypeTxExecution
	TypeBlockExecution
	TypeGovernAccount
	TypeBeginBlock
	TypeBeginTx
	TypeEnvelope
	TypeEndTx
	TypeEndBlock
)

Call

Fired whenever a contract is being called, even when called from another contract.

func (txe *TxExecution) Call(call *CallEvent, exception *errors.Exception) error {
	txe.Append(&Event{
		Header: txe.Header(TypeCall, EventStringAccountCall(call.CallData.Callee), exception),
		Call:   call,
	})
	return nil
}

github.com/hyperledger/burrow/execution/exec.(*TxExecution).Call at tx_execution.go:116
github.com/hyperledger/burrow/execution/native.FireCallEvent at call.go:26
github.com/hyperledger/burrow/execution/native.Call at call.go:19
github.com/hyperledger/burrow/execution/evm.(*Contract).Call at contract.go:32
github.com/hyperledger/burrow/execution/evm.(*Contract).execute at contract.go:782
github.com/hyperledger/burrow/execution/evm.(*Contract).execute-fm at contract.go:36
github.com/hyperledger/burrow/execution/native.Call at call.go:17
github.com/hyperledger/burrow/execution/evm.(*Contract).Call at contract.go:32
github.com/hyperledger/burrow/execution/evm.(*EVM).Execute at evm.go:87
github.com/hyperledger/burrow/execution/contexts.(*CallContext).Deliver at call_context.go:222
github.com/hyperledger/burrow/execution/contexts.(*CallContext).Execute at call_context.go:49
github.com/hyperledger/burrow/execution.(*executor).Execute at execution.go:270
github.com/hyperledger/burrow/consensus/abci.ExecuteTx at execute_tx.go:30
github.com/hyperledger/burrow/consensus/abci.(*App).DeliverTx at app.go:212
github.com/tendermint/tendermint/abci/client.(*localClient).DeliverTxAsync at local_client.go:88
github.com/tendermint/tendermint/proxy.(*appConnConsensus).DeliverTxAsync at app_conn.go:73
github.com/tendermint/tendermint/state.execBlockOnProxyApp at execution.go:294
github.com/tendermint/tendermint/state.(*BlockExecutor).ApplyBlock at execution.go:131
github.com/tendermint/tendermint/consensus.(*State).finalizeCommit at state.go:1431
github.com/tendermint/tendermint/consensus.(*State).tryFinalizeCommit at state.go:1350
github.com/tendermint/tendermint/consensus.(*State).enterCommit.func1 at state.go:1285
github.com/tendermint/tendermint/consensus.(*State).enterCommit at state.go:1322
github.com/tendermint/tendermint/consensus.(*State).addVote at state.go:1819
github.com/tendermint/tendermint/consensus.(*State).tryAddVote at state.go:1642
github.com/tendermint/tendermint/consensus.(*State).handleMsg at state.go:709
github.com/tendermint/tendermint/consensus.(*State).receiveRoutine at state.go:660
runtime.goexit at asm_amd64.s:1357
 - Async stack trace
github.com/tendermint/tendermint/consensus.(*State).OnStart at state.go:335

Log

Fired from EVM opcode LOGX.

func (txe *TxExecution) Log(log *LogEvent) error {
	txe.Append(&Event{
		Header: txe.Header(TypeLog, EventStringLogEvent(log.Address), nil),
		Log:    log,
	})
	return nil
}
github.com/hyperledger/burrow/execution/exec.(*TxExecution).Log at tx_execution.go:108
github.com/hyperledger/burrow/execution/evm.(*Contract).execute at contract.go:582
github.com/hyperledger/burrow/execution/evm.(*Contract).execute-fm at contract.go:36
github.com/hyperledger/burrow/execution/native.Call at call.go:17
github.com/hyperledger/burrow/execution/evm.(*Contract).Call at contract.go:32
github.com/hyperledger/burrow/execution/evm.(*Contract).execute at contract.go:782
github.com/hyperledger/burrow/execution/evm.(*Contract).execute-fm at contract.go:36
github.com/hyperledger/burrow/execution/native.Call at call.go:17
github.com/hyperledger/burrow/execution/evm.(*Contract).Call at contract.go:32
github.com/hyperledger/burrow/execution/evm.(*EVM).Execute at evm.go:87
github.com/hyperledger/burrow/execution/contexts.(*CallContext).Deliver at call_context.go:222
github.com/hyperledger/burrow/execution/contexts.(*CallContext).Execute at call_context.go:49
github.com/hyperledger/burrow/execution.(*executor).Execute at execution.go:270
github.com/hyperledger/burrow/consensus/abci.ExecuteTx at execute_tx.go:30
github.com/hyperledger/burrow/consensus/abci.(*App).DeliverTx at app.go:212
github.com/tendermint/tendermint/abci/client.(*localClient).DeliverTxAsync at local_client.go:88
github.com/tendermint/tendermint/proxy.(*appConnConsensus).DeliverTxAsync at app_conn.go:73
github.com/tendermint/tendermint/state.execBlockOnProxyApp at execution.go:294
github.com/tendermint/tendermint/state.(*BlockExecutor).ApplyBlock at execution.go:131
github.com/tendermint/tendermint/consensus.(*State).finalizeCommit at state.go:1431
github.com/tendermint/tendermint/consensus.(*State).tryFinalizeCommit at state.go:1350
github.com/tendermint/tendermint/consensus.(*State).enterCommit.func1 at state.go:1285
github.com/tendermint/tendermint/consensus.(*State).enterCommit at state.go:1322
github.com/tendermint/tendermint/consensus.(*State).addVote at state.go:1819
github.com/tendermint/tendermint/consensus.(*State).tryAddVote at state.go:1642
github.com/tendermint/tendermint/consensus.(*State).handleMsg at state.go:709
github.com/tendermint/tendermint/consensus.(*State).receiveRoutine at state.go:660
runtime.goexit at asm_amd64.s:1357
 - Async stack trace
github.com/tendermint/tendermint/consensus.(*State).OnStart at state.go:335

Input & Output

// Emit events
func (txe *TxExecution) Input(address crypto.Address, exception *errors.Exception) {
	txe.Append(&Event{
		Header: txe.Header(TypeAccountInput, EventStringAccountInput(address), exception),
		Input: &InputEvent{
			Address: address,
		},
	})
}

func (txe *TxExecution) Output(address crypto.Address, exception *errors.Exception) {
	txe.Append(&Event{
		Header: txe.Header(TypeAccountOutput, EventStringAccountOutput(address), exception),
		Output: &OutputEvent{
			Address: address,
		},
	})
}

Governance

Fired in GovernanceContext.Execute

func (txe *TxExecution) GovernAccount(governAccount *GovernAccountEvent, exception *errors.Exception) {
	txe.Append(&Event{
		Header:        txe.Header(TypeGovernAccount, EventStringGovernAccount(governAccount.AccountUpdate.Address), exception),
		GovernAccount: governAccount,
	})
}

Others

Stream Event

TypeTxExecution
TypeBlockExecution
TypeBeginBlock
TypeBeginTx
TypeEnvelope
TypeEndTx
TypeEndBlock
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值