diff --git a/src/org/aion/interfaces/tx/Transaction.java b/src/org/aion/interfaces/tx/Transaction.java index 21a72df..6102353 100644 --- a/src/org/aion/interfaces/tx/Transaction.java +++ b/src/org/aion/interfaces/tx/Transaction.java @@ -19,6 +19,4 @@ public interface Transaction extends Cloneable, TransactionInterface { long getNrgConsume(); void setNrgConsume(long _nrg); - - Address getContractAddress(); } diff --git a/src/org/aion/vm/api/interfaces/KernelInterface.java b/src/org/aion/vm/api/interfaces/KernelInterface.java index 9ed8694..129ad04 100644 --- a/src/org/aion/vm/api/interfaces/KernelInterface.java +++ b/src/org/aion/vm/api/interfaces/KernelInterface.java @@ -307,4 +307,41 @@ public interface KernelInterface { * @return True if this address can be invoked from the calling {@link VirtualMachine}. */ boolean destinationAddressIsSafeForThisVM(Address address); + + /** + * Returns the number of the block that this kernel interface is at. + * + * @return The block number. + */ + long getBlockNumber(); + + /** + * Returns the timestamp of the block that this kernel interface is at. + * + * @return The block timestamp. + */ + long getBlockTimestamp(); + + // TODO: block energy limit can probably be removed. + + /** + * Returns the energy limit of the block that this kernel interface is at. + * + * @return The block energy limit. + */ + long getBlockEnergyLimit(); + + /** + * Returns the difficulty of the block that this kernel interface is at. + * + * @return The block difficulty. + */ + long getBlockDifficulty(); + + /** + * Returns the address of the miner of the block that this kernel interface is at. + * + * @return The miner's address. + */ + Address getMinerAddress(); } diff --git a/src/org/aion/vm/api/interfaces/TransactionInterface.java b/src/org/aion/vm/api/interfaces/TransactionInterface.java index ee61dca..db50323 100644 --- a/src/org/aion/vm/api/interfaces/TransactionInterface.java +++ b/src/org/aion/vm/api/interfaces/TransactionInterface.java @@ -30,6 +30,12 @@ public interface TransactionInterface { */ Address getDestinationAddress(); + /** + * Returns the address of the contract that this transaction will create. + * + * @return The destination address. + */ Address getContractAddress(); + /** * Returns the nonce of this transaction, which is the nonce of the sender account. * @@ -92,4 +98,11 @@ public interface TransactionInterface { * @return True if this transaction creates a new contract. */ boolean isContractCreationTransaction(); + + /** + * Returns the kind of the corresponding transaction. For example, CREATE or CALL. + * + * @return The transaction kind. + */ + byte getKind(); } diff --git a/src/org/aion/vm/api/interfaces/TransactionResult.java b/src/org/aion/vm/api/interfaces/TransactionResult.java index dc3f7da..95c528a 100644 --- a/src/org/aion/vm/api/interfaces/TransactionResult.java +++ b/src/org/aion/vm/api/interfaces/TransactionResult.java @@ -69,5 +69,12 @@ public interface TransactionResult { */ void setEnergyRemaining(long energyRemaining); + /** + * Returns the side-effects that were the result of executing the corresponding transaction. + * + * @return The execution side-effects of the transaction. + */ + TransactionSideEffects getSideEffects(); + byte[] toBytes(); } diff --git a/src/org/aion/vm/api/interfaces/VirtualMachine.java b/src/org/aion/vm/api/interfaces/VirtualMachine.java index 30e72c2..c646112 100644 --- a/src/org/aion/vm/api/interfaces/VirtualMachine.java +++ b/src/org/aion/vm/api/interfaces/VirtualMachine.java @@ -35,17 +35,17 @@ public interface VirtualMachine { void shutdown(); /** - * Executes the transactions contained in the array of contexts in such a way that the logical - * ordering of the transactions is preserved. + * Executes the transactions in such a way that the logical ordering of the transactions is + * preserved. * *

This method possibly runs asynchronously and returns its results to the caller via a non- * blocking {@link SimpleFuture} array. * * @param kernel The {@link KernelInterface} representing the blockchain state for these transactions. - * @param contexts The transaction contexts to execute. + * @param transactions The transactions to execute. * @return The results of the execution. * @throws ClosedVirtualMachineException if no long-lived instance of this class currently * exists. */ - SimpleFuture[] run(KernelInterface kernel, TransactionContext[] contexts); + SimpleFuture[] run(KernelInterface kernel, TransactionInterface[] transactions); }