-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtodo.txt
More file actions
77 lines (56 loc) · 2.74 KB
/
todo.txt
File metadata and controls
77 lines (56 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Now I need to implement SYNCHRONIZATION :
I define these global variables :
transactionPool chan model.Transaction :
If a block becomes full and the validation process begins,
all the incoming transaction must not be added to a block
but rather must be stored in a transaction pool.
Each transaction in this pool is going to be processed when
the block is validated.
isBlockValidating of type bool :
Indicates whether this node is in process of validating a
block
blockValidationSignal chan struct{} :
Indicates when this node finished the process of validating this
a block
mtx sync.Mutex :
A mutex to synchronize access to the transactionPool
Proof-Of-Stake Implementation :
1. Differentiate Hard-State and Soft-State
-> Hard-State is the state that is inferred from the
last validated block
-> Soft-State is Hard-State + the transactions of the
last (unvalidated-incomplete) block
-> Can be implemented adding another []NodeInfo array
in the node type definition. This array would be
called SoftRing (in contrast to the Ring for the hard
state).
Or add another field called SoftBalance to each NodeInfo object
and SoftStake ??
-> The code refactoring necessary is changing the
[]NodeInfo array being modified in Block.AddTransaction()
to be the SoftBalance while only modifying in MintBlock()
-> Investigate the bootstrap process in SoftBalance()
Decision :
Add a new field to each NodeInfo object called 'SoftBalance'
and 'SoftStake' which is storing the soft-state balance & stake balance
of each node.
The Node.Wallet.Balance, NodeInfo.Balance && NodeInfo.Stake store the
hard-state balance & stake balance.
IMPLEMENTED
2. Implementing MintBlock() - the method called only from the
elected/leader node e.g. myNode.id == electedNodeId
This function will broadcast the new block
e.g. call the api function ReceiveValidatedBlock()
for every other node in the Ring.
NEEDS SMALL IMPLEMENTATION && TESTING
3. Implementing ReceiveValidatedBlock() - this will be the only
function that will modify the Ring []NodeInfo array
then check that the Ring is equal to SoftRing
DONE!!
NEEDS SMALL IMPLEMENTATION && TESTING
4. When to release stakes ? - Release stakes when a stake
txn with amount 0 is called.
Add code in addTransaction() etc. to handle that.
5. Implement the txn fee mechanism - refactor various blocks
of code - Give the elected leader their gathered fees
in the MintBlock() function (?)