orbs-network / orbs-spec

Orbs platform protocol and service specifications, network architecture, etc
MIT License
31 stars 3 forks source link

Read state storage in send transaction #24

Closed YaDavid closed 6 years ago

YaDavid commented 6 years ago

When a transaction queries the state for a specific piece of information, a block height must be indicated or else different nodes might get different results. Now, there are two complications: If StateStorage hasn't processed the indicated block, there has to be some delay until the transaction is processed. If StateStorage has already deleted the state related to the indicated block, the node must somehow fetch that state. (It seems that the amount of blocks that need to be kept in StateStorage matches the amount of time transactions are kept in the transaction pool.)

This is also relevant for CrosschainConnector queries.

OdedWx commented 6 years ago

SendTransaction is performed on the candidate block block_height which is passed in the ReadKeys interface.

OdedWx commented 6 years ago

Modified: Was Read state storage in send transaction. Add an interface to get the reference block height and to request read based on that height.

talkol commented 6 years ago

PublicApi.CallMethod will stop accessing BlockStorage directly and instead pass 0 as the block height for VirtualMachine.CallLocalMethod (this indicates last block that StateStorage has). VirtualMachine will access StateStorage and retrieve its latest block height (StateStorageLastestBlockHeight) and set it for the duration of the call

OdedWx commented 6 years ago

Committed, State Storage provides it's last committed block height and timestamp.