Skip to content

Commit

Permalink
Rollup protocol (#2321)
Browse files Browse the repository at this point in the history
* Rollup protocol

Previously the leader polled for new transactions. This is inefficient,
as new transactions have to wait for the leader to poll.

With this PR, the all followers forward transactions directly to the leader.
Once the leader has a transaction, he directly starts a new block.
Once the new block has been accepted, eventually queued up transactions
are also sent.

This has been tested to be able to go from old nodes to new nodes on a
local machine.

* Tharvik's comments
  • Loading branch information
ineiti committed Jul 29, 2020
1 parent bbf4091 commit 63a2ff9
Show file tree
Hide file tree
Showing 24 changed files with 822 additions and 1,947 deletions.
25 changes: 9 additions & 16 deletions byzcoin/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,6 @@ func TestClient_Streaming(t *testing.T) {
require.NoError(t, err)
_, err = c.AddTransaction(tx)
require.NoError(t, err)

// sleep for a block interval so we create multiple blocks
time.Sleep(msg.BlockInterval)
}
}()

Expand Down Expand Up @@ -363,19 +360,15 @@ type corruptedService struct {

func newTestService(c *onet.Context) (onet.Service, error) {
s := &Service{
ServiceProcessor: onet.NewServiceProcessor(c),
contracts: newContractRegistry(),
txBuffer: newTxBuffer(),
storage: &bcStorage{},
darcToSc: make(map[string]skipchain.SkipBlockID),
stateChangeCache: newStateChangeCache(),
stateChangeStorage: newStateChangeStorage(c),
heartbeatsTimeout: make(chan string, 1),
closeLeaderMonitorChan: make(chan bool, 1),
heartbeats: newHeartbeats(),
viewChangeMan: newViewChangeManager(),
streamingMan: streamingManager{},
closed: true,
ServiceProcessor: onet.NewServiceProcessor(c),
contracts: newContractRegistry(),
storage: &bcStorage{},
darcToSc: make(map[string]skipchain.SkipBlockID),
stateChangeCache: newStateChangeCache(),
stateChangeStorage: newStateChangeStorage(c),
viewChangeMan: newViewChangeManager(),
streamingMan: streamingManager{},
closed: true,
}

cs := &corruptedService{Service: s}
Expand Down
242 changes: 0 additions & 242 deletions byzcoin/collect_tx.go

This file was deleted.

109 changes: 0 additions & 109 deletions byzcoin/collect_tx_test.go

This file was deleted.

0 comments on commit 63a2ff9

Please sign in to comment.