thehubbleproject / contracts

Smart contracts for OPRHub protocol ✌🏻
12 stars 10 forks source link

Use stateID's in transaction instead of accID's #95

Closed vaibhavchellani closed 3 years ago

vaibhavchellani commented 4 years ago

There are 2 trees in hubble:

Index of leaf in accounts-tree is AccID and index of leaf in state-tree is StateID

Right now the from and the to indexes in the transaction point to the AccID and hence it is used to do lookups in the accounts-tree. While this works well for on-chain only deposit mechanisms but breaks for off-chain account creations as now we can have 2 accounts with same set of (AccID, Balance, Nonce,Token) and could lead to corruption of state by introducing ambiguity.

The solution is to point the indexes in transactions to StateID's as they are always unique for an account.

ChihChengLiang commented 3 years ago

fixed