@@ -54,13 +54,6 @@ type BlockValidator interface {
54
54
// and can now be recorded in the ledger. This is an optimized version of
55
55
// calling EnsureBlock() on the Ledger.
56
56
type ValidatedBlock interface {
57
- // WithSeed creates a copy of this ValidatedBlock with its
58
- // cryptographically random seed set to the given value.
59
- //
60
- // Calls to Seed() or to Digest() on the copy's Block must
61
- // reflect the value of the new seed.
62
- WithSeed (committee.Seed ) ValidatedBlock
63
-
64
57
// Block returns the underlying block that has been validated.
65
58
Block () bookkeeping.Block
66
59
}
@@ -72,21 +65,42 @@ var ErrAssembleBlockRoundStale = errors.New("requested round for AssembleBlock i
72
65
// An BlockFactory produces an Block which is suitable for proposal for a given
73
66
// Round.
74
67
type BlockFactory interface {
75
- // AssembleBlock produces a new ValidatedBlock which is suitable for proposal
76
- // at a given Round.
68
+ // AssembleBlock produces a new UnfinishedBlock for a given Round.
69
+ // It must be finalized before proposed by agreement. It is provided
70
+ // a list of participating addresses that may propose this block.
77
71
//
78
- // AssembleBlock should produce a ValidatedBlock for which the corresponding
72
+ // AssembleBlock should produce a block for which the corresponding
79
73
// BlockValidator validates (i.e. for which BlockValidator.Validate
80
74
// returns true). If an insufficient number of nodes can assemble valid
81
75
// entries, the agreement protocol may lose liveness.
82
76
//
83
77
// AssembleBlock may return an error if the BlockFactory is unable to
84
- // produce a ValidatedBlock for the given round. If an insufficient number of
78
+ // produce an UnfinishedBlock for the given round. If an insufficient number of
85
79
// nodes on the network can assemble entries, the agreement protocol may
86
80
// lose liveness.
87
- AssembleBlock (basics.Round ) (ValidatedBlock , error )
81
+ AssembleBlock (rnd basics.Round , partAddresses []basics.Address ) (UnfinishedBlock , error )
82
+ }
83
+
84
+ // An UnfinishedBlock represents a Block produced by a BlockFactory
85
+ // and must be finalized before being proposed by agreement.
86
+ type UnfinishedBlock interface {
87
+ // FinishBlock creates a proposable block, having set the cryptographically
88
+ // random seed and payout related fields.
89
+ //
90
+ // Calls to Seed() or to Digest() on the copy's Block must
91
+ // reflect the value of the new seed.
92
+ FinishBlock (seed committee.Seed , proposer basics.Address , eligible bool ) Block
93
+
94
+ Round () basics.Round
88
95
}
89
96
97
+ // Block (in agreement) represents an UnfinishedBlock produced by a
98
+ // BlockFactory, that was later finalized by providing the seed and the
99
+ // proposer, and can now be proposed by agreement.
100
+ //
101
+ //msgp:ignore Block
102
+ type Block bookkeeping.Block
103
+
90
104
// A Ledger represents the sequence of Entries agreed upon by the protocol.
91
105
// The Ledger consists of two parts: a LedgerReader and a LedgerWriter, which
92
106
// provide read and write access to the ledger, respectively.
0 commit comments