aionnetwork / AVM

Enabling Java code to run in a blockchain environment
https://theoan.com/
MIT License
49 stars 25 forks source link

[CLOSED] Pass several transactions at once into the AVM #280

Closed aionbot closed 5 years ago

aionbot commented 5 years ago

Issue created by jeff-aion (on Monday Oct 15, 2018 at 21:27 GMT)

This has 2 angles which need to be addressed:

  1. Avm API: this is required for testing the concurrent executor but also making sure that larger transaction batching is exposed at the AVM level in the stack
  2. The alpha2 AVM launcher must be invokable with multiple transactions, to expose this functionality
aionbot commented 5 years ago

Comment by jeff-aion (on Thursday Oct 18, 2018 at 15:05 GMT)

The plan for step 1 is to modify the Avm.run() method to have the following shape:

    Future<TransactionResult>[] run(TransactionContext[]);

The given array of TransactionContext will represent a block of transactions which the AVM can handle and which must write-back in the given order (but execute in any order so long as the write-back order appears in-order). Each returned Future<TransactionResult> corresponds to a single TransactionContext and will block until the result is available.

An additional rule we will be adding to this contract is that no call can be made until all the Future objects returned by the previous call have been observed. This is to ensure that the system remains lock-step around the processing of these contiguous transaction groups.

This interface has a few important properties:

  1. It can receive a contiguous chunk of transactions along with their intended order.
  2. The number of threads living on either side of the interface is not a consideration of the other, so long as there is at least 1 on either side.
  3. We can extend the returned data, in the future, to represent all write-back intentions, which would allow for an arbitrary tail of this list to be discarded without harming the consistency of the system (could be useful in some mining scenarios).
aionbot commented 5 years ago

Comment by jeff-aion (on Thursday Oct 18, 2018 at 15:56 GMT)

I might define a simpler Future interface for this case since we don't need things like ExecutionException, InterruptedException, cancellation or timeout waits.