@@ -207,7 +207,21 @@ def apply_transaction(
207207 is_stateless = True ,
208208 witness_db = None ):
209209 """
210- Apply transaction
210+ Apply transaction to the given block
211+
212+ :param vm_state: the VMState object
213+ :param transaction: the transaction need to be applied
214+ :param block: the block which the transaction applies on
215+ :param is_stateless: if is_stateless, call VMState.add_transactionto set block
216+ :param witness_db: for stateless mode, use witness_db as chaindb
217+ :type vm_state: VMState
218+ :type transaction: Transaction
219+ :type block: Block
220+ :type is_stateless: bool
221+ :type witness_db: BaseChainDB
222+
223+ :return: the computation, applied block, and the trie_data
224+ :rtype: (Computation, Block, dict[bytes, bytes])
211225 """
212226 if is_stateless :
213227 # Update block in this level.
@@ -236,6 +250,21 @@ def apply_transaction(
236250 def add_transaction (cls , vm_state , transaction , computation , block ):
237251 """
238252 Add a transaction to the given block and save the block data into chaindb.
253+
254+ Update the bloom_filter, transaction trie and receipt trie roots, bloom_filter,
255+ bloom, and used_gas of the block.
256+
257+ :param vm_state: the VMState object
258+ :param transaction: the executed transaction
259+ :param computation: the Computation object with executed result
260+ :param block: the Block which the transaction is added in
261+ :type vm_state: VMState
262+ :type transaction: Transaction
263+ :type computation: Computation
264+ :type block: Block
265+
266+ :return: the block and the trie_data
267+ :rtype: (Block, dict[bytes, bytes])
239268 """
240269 receipt = cls .make_receipt (vm_state , transaction , computation )
241270 transaction_idx = len (block .transactions )
@@ -276,7 +305,7 @@ def add_trie_node_to_db(root_hash, index_key, node, db):
276305 trie_db = HexaryTrie (db , root_hash = root_hash )
277306 trie_db [index_key ] = rlp .encode (node )
278307 return trie_db .root_hash , trie_db .db
279-
308+
280309 @staticmethod
281310 def execute_transaction (vm_state , transaction ):
282311 """
0 commit comments