Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input/Ordering Block Implementation #2055

Open
wants to merge 129 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
10362c9
WeakBlockAlgos
kushti Aug 22, 2023
76e2f60
Merge branch 'v5.0.15' of github.com:ergoplatform/ergo into weak-blocks
kushti Sep 12, 2023
c5d30d3
WeakBlockInfo, WeakBlockMessageSpec
kushti Sep 18, 2023
5c2eb29
impl steps
kushti Sep 28, 2023
d378942
Merge branch 'v5.0.16' of github.com:ergoplatform/ergo into weak-blocks
kushti Oct 25, 2023
8843114
initial weak blocks structures and algos
kushti Oct 30, 2023
5c4f9c2
compact block like messaging
kushti Oct 31, 2023
0dbfeb0
before structures
kushti Nov 1, 2023
1a68d0e
skeleton of processing algo
kushti Nov 4, 2023
1040926
weak blocks => sub blocks
kushti Nov 7, 2023
636f3d8
more weak=>sub renaming
kushti Nov 7, 2023
6293421
returning download plan
kushti Nov 7, 2023
23a5db0
better comments and todos, formatting
kushti Nov 9, 2023
2c5cf3c
motivation started in EIP, data structures refined
kushti Nov 10, 2023
4189783
Merge branch 'master' of github.com:ergoplatform/ergo into weak-blocks
kushti Nov 28, 2023
4962218
pow, superblocks
kushti Dec 1, 2023
514e6fb
subblocks section finished
kushti Dec 2, 2023
564ad05
propagation text started, prevSubBlockId made optional (comp fails)
kushti Dec 6, 2023
346e1a7
commitment
kushti Dec 21, 2023
a068545
styling fixes
kushti Dec 28, 2023
c0709f2
key spaces for sub-blocks and sidechains
kushti Dec 29, 2023
85de7a4
eip update
kushti Jan 3, 2024
a248ccf
dag note, new subsections added
kushti Jan 4, 2024
0a9fd56
Merge branch 'master' of github.com:ergoplatform/ergo into weak-blocks
kushti Feb 12, 2024
93bc6bc
merging w. master, accounting for optional prevSubBlockId
kushti Feb 12, 2024
02056c2
Merge branch 'master' of github.com:ergoplatform/ergo into weak-blocks
kushti Jul 17, 2024
92baed0
input/ordering blocks intro
kushti Jul 19, 2024
54c9971
script execution ctx started
kushti Jul 20, 2024
73d76f2
extending subblocks info
kushti Jul 24, 2024
69adf58
Merge branch 'master' of github.com:ergoplatform/ergo into weak-blocks
kushti Jul 30, 2024
bed12e6
SubsPerBlock* improved comments in SubBlockAlgos
kushti Jul 30, 2024
01da1a0
BlockKind, distnguishing fn
kushti Aug 3, 2024
e448fb8
Merge branch 'master' of github.com:ergoplatform/ergo into weak-blocks
kushti Aug 5, 2024
3e9f4d1
blockKind()
kushti Aug 6, 2024
1a8aaeb
unused reportModifierIsInvalid removed
kushti Aug 7, 2024
184996e
ProgressInfo.empty, removing implicit ScorexEncoder
kushti Aug 7, 2024
8bc72cc
MessageSpecInitial / MessageSpecSubBlock
kushti Aug 12, 2024
4192c61
merkle proof added to SubBlockInfo, serializer updated, SubBlockMessa…
kushti Aug 14, 2024
a044955
batch merkle proof usage and serialization
kushti Aug 29, 2024
613fc58
Merge branch 'jni-dep' of github.com:ergoplatform/ergo into weak-blocks
kushti Aug 29, 2024
c382a38
processSubblock started
kushti Sep 3, 2024
15ca997
subblock height check
kushti Sep 3, 2024
222c850
SubBlockTransactionsRequestSpec, completing processSubblock stub
kushti Sep 4, 2024
e6ee392
SubBlockTransactionsSpec
kushti Sep 5, 2024
fb98a2e
subblocks p2p logic stub
kushti Sep 8, 2024
95fb95e
LocallyGeneratedSubBlock
kushti Sep 13, 2024
5f66580
subblock keys, CandidateGenerator simplification
kushti Sep 13, 2024
f118879
more simplification in CandidateGenerator
kushti Sep 13, 2024
e8bcdfa
bestSubblock() stub. createCandidate #1
kushti Sep 13, 2024
647b6db
initial version of best subblock selection
kushti Sep 18, 2024
e93d333
merging w. 5.0.23
kushti Sep 19, 2024
e0feb83
input/ordering block distintcion in mining logic #1, input block gene…
kushti Sep 19, 2024
9ebe5db
subblocks generation
kushti Oct 1, 2024
5e623b4
fixing delivery of sub-blocks to processing
kushti Oct 1, 2024
c9de516
input block pow validation
kushti Oct 10, 2024
b908142
completeOrderingBlock / completeInputBlock
kushti Oct 10, 2024
08c52d6
sendInputToNodeView stub (pre-refactoring)
kushti Oct 15, 2024
ac824a4
LocallyGeneratedInputBlock / LocallyGeneratedOrderingBlock
kushti Oct 16, 2024
4fc43c5
reworked LocallyGeneratedInputBlock signature
kushti Oct 18, 2024
ef02664
forum post
kushti Oct 30, 2024
4011aa5
removing subblock field from Candidate
kushti Oct 30, 2024
e9811ce
Merge branch 'master' of github.com:ergoplatform/ergo into weak-blocks
kushti Dec 10, 2024
c81839d
papers/subblocks folder
kushti Dec 10, 2024
319f7a6
forming SubBlockInfo, SubBlockTransactionsData moved to completeInput…
kushti Dec 10, 2024
cac7cd1
Merge branch 'master' of github.com:ergoplatform/ergo into weak-blocks
kushti Dec 23, 2024
caf9f3f
subblock -> inputblock
kushti Dec 23, 2024
87a91d5
input blocks data pruning
kushti Dec 24, 2024
8e9d526
forming prevInputBlockId
kushti Dec 24, 2024
139d770
improving linking logic and code
kushti Dec 24, 2024
afb4ef4
refs, motivation rework
kushti Dec 28, 2024
8ed3749
EIP rework #1
kushti Dec 30, 2024
70c57c2
Transactions Handling
kushti Jan 1, 2025
d16aa23
Transactions Handling
kushti Jan 3, 2025
8d8afa5
propagation wip1
kushti Jan 3, 2025
3752b30
incentivization section
kushti Jan 4, 2025
e15dcd0
EIP alpha version
kushti Jan 4, 2025
7aae74a
update notes
kushti Jan 6, 2025
5d059f7
transactions handling section updatte
kushti Jan 7, 2025
7dfd05e
transactions handling update
kushti Jan 8, 2025
c5814df
input-block related extension fields
kushti Jan 9, 2025
251d097
generateCandidate comments
kushti Jan 10, 2025
7fd69ec
createCandidate refatoring
kushti Jan 10, 2025
b77765c
new extension fields stub
kushti Jan 10, 2025
7dcec20
forming prev input block id
kushti Jan 13, 2025
e34a181
comments for extension fields
kushti Jan 13, 2025
5773c17
reordering code before reworking forming transactions
kushti Jan 14, 2025
41f2d59
initial input/ordering txs split
kushti Jan 14, 2025
2245808
comments fix
kushti Jan 16, 2025
a4d892a
bestBlocks
kushti Jan 16, 2025
4633a5e
parentInputBlockIdOpt fix
kushti Jan 16, 2025
cebf363
transactionsCache
kushti Jan 16, 2025
8a4b690
input block id, prev link fix, accumulating ordering block transactions
kushti Jan 17, 2025
f687ca4
using previous ordering block transactions in orderingBlocktransactio…
kushti Jan 20, 2025
d0f7ca6
fixing subblocksPerBlock in checkNonces
kushti Jan 20, 2025
3288e61
checkInputBlockPoW & checkOrderingBlockPoW in AutolykosPowScheme
kushti Jan 20, 2025
879b50b
passing link to previous input block, clearing miner cache on input b…
kushti Jan 21, 2025
b689299
filtering out non-input transactions
kushti Jan 22, 2025
c77d30b
filtering out already included before collectTxs, id arg fix in apply…
kushti Jan 23, 2025
cac0278
real Merkle tree digests
kushti Jan 23, 2025
bca36db
NewBestInputBlock signal, /info field
kushti Jan 24, 2025
4988a6e
getInputBlock
kushti Jan 24, 2025
1aaa562
improving comments
kushti Jan 25, 2025
377d6c9
inputBlockParents stub
kushti Jan 27, 2025
c01a3d1
getBestInputBlocksChain
kushti Jan 27, 2025
9521425
bestInputBlock / bestInputChain
kushti Jan 28, 2025
49acb70
input blocks application tests plan
kushti Feb 4, 2025
be23a52
input blocks dag processing wip1
kushti Feb 4, 2025
d91fef6
check for best header for first subblock
kushti Feb 4, 2025
c19cc2e
handling missing parent wip1
kushti Feb 6, 2025
fa22cb8
first test in InputBlockProcessorSpecification, some fixes in ib appl…
kushti Feb 7, 2025
8e52469
chain of two input blocks and out of order application tests
kushti Feb 7, 2025
aadcd2b
deliveryWaitlist / disconnectedWaitlist
kushti Feb 8, 2025
47d1ef9
moving best input block update to applyInputBlockTransactions
kushti Feb 10, 2025
517e8fa
applyInputBlockTransactions scaladoc and fixes
kushti Feb 12, 2025
f436de2
-Xasync to solve idea compilation issues, processBestInputBlockCandid…
kushti Feb 13, 2025
9e2a6dd
bestHeight, bestTips to find best input block chains tips efficiently
kushti Feb 13, 2025
e39618a
updateBestTipsAndHeight, check best tips and best tip height in tests
kushti Feb 14, 2025
34cad4c
check tip height in tests
kushti Feb 14, 2025
c78e2ac
isAncestor
kushti Feb 14, 2025
13663b8
isAncestor returns parent's child
kushti Feb 14, 2025
10e1258
scaladoc for structures
kushti Feb 24, 2025
47e4f4b
improved comments, applyInputBlock refactoring
kushti Feb 25, 2025
adc4ebc
refactoring and fixing updateBestTipsAndHeight
kushti Feb 26, 2025
0170c15
processBestInputBlockCandidate extraction
kushti Feb 26, 2025
6d9abf9
recursively updating best input blocks
kushti Feb 28, 2025
f4add6d
checking applyInputBlockTransactions output in tests
kushti Mar 5, 2025
fad3817
input block id fix
kushti Mar 6, 2025
a9c522f
out of order txs application and corresponding fix
kushti Mar 7, 2025
a4a9306
packages refactoring, out of order test fix
kushti Mar 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
MessageSpecInitial / MessageSpecSubBlock
  • Loading branch information
kushti committed Aug 12, 2024
commit 8bc72ccb2a62a73f0bf71bea2d40689d03fce868
8 changes: 4 additions & 4 deletions ergo-core/src/main/scala/org/ergoplatform/SubBlockAlgos.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.ergoplatform.SubBlockAlgos.SubBlockInfo
import org.ergoplatform.mining.AutolykosPowScheme
import org.ergoplatform.modifiers.history.header.{Header, HeaderSerializer}
import org.ergoplatform.network.message.MessageConstants.MessageCode
import org.ergoplatform.network.message.MessageSpecV1
import org.ergoplatform.network.message.MessageSpecInitial
import org.ergoplatform.serialization.ErgoSerializer
import org.ergoplatform.settings.{Constants, Parameters}
import scorex.crypto.hash.Digest32
Expand Down Expand Up @@ -122,7 +122,7 @@ object SubBlockAlgos {
* Message that is informing about sub block produced.
* Contains header and link to previous sub block ().
*/
object SubBlockMessageSpec extends MessageSpecV1[SubBlockInfo] {
object SubBlockMessageSpec extends MessageSpecInitial[SubBlockInfo] {

val MaxMessageSize = 10000

Expand All @@ -142,7 +142,7 @@ object SubBlockAlgos {
* On receiving sub block or block, the node is sending last sub block or block id it has to get short transaction
* ids since then
*/
object GetDataSpec extends MessageSpecV1[ModifierId] {
object GetDataSpec extends MessageSpecInitial[ModifierId] {

import scorex.util.{bytesToId, idToBytes}

Expand All @@ -160,7 +160,7 @@ object SubBlockAlgos {

case class TransactionsSince(transactionsWithBlockIds: Array[(ModifierId, Array[Array[Byte]])])

class DataSpec extends MessageSpecV1[TransactionsSince] {
class DataSpec extends MessageSpecInitial[TransactionsSince] {

override val messageCode: MessageCode = 92: Byte
override val messageName: String = "GetData"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package org.ergoplatform.network

import org.ergoplatform.network.message.MessageConstants.MessageCode
import org.ergoplatform.network.message.MessageSpecV1
import org.ergoplatform.network.message.MessageSpecInitial
import scorex.util.serialization.{Reader, Writer}

/**
* The `Handshake` message provides information about the transmitting node
* to the receiving node at the beginning of a connection. Until both peers
* have exchanged `Handshake` messages, no other messages will be accepted.
*/
object HandshakeSerializer extends MessageSpecV1[Handshake] {
object HandshakeSerializer extends MessageSpecInitial[Handshake] {
override val messageCode: MessageCode = 75: Byte
override val messageName: String = "Handshake"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ object Version {
val Eip37ForkVersion: Version = Version(4, 0, 100)
val JitSoftForkVersion: Version = Version(5, 0, 0)

val SubblocksVersion: Version = Version(6, 0, 0) // todo: check before activation

val UtxoSnapsnotActivationVersion: Version = Version(5, 0, 12)

val NipopowActivationVersion: Version = Version(5, 0, 13)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import scorex.util.serialization.{Reader, Writer}
/**
* The `GetNipopowProof` message requests a `NipopowProof` message from the receiving node
*/
object GetNipopowProofSpec extends MessageSpecV1[NipopowProofData] {
object GetNipopowProofSpec extends MessageSpecInitial[NipopowProofData] {

val SizeLimit = 1000

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import scorex.util.serialization.{Reader, Writer}
* or it can be sent in reply to a `SyncInfo` message (or application-specific messages like `GetMempool`).
*
*/
object InvSpec extends MessageSpecV1[InvData] {
object InvSpec extends MessageSpecInitial[InvData] {

val maxInvObjects: Int = 400

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,20 @@ trait MessageSpec[Content] extends ErgoSerializer[Content] {
}

/**
* P2p messages, that where implemented since the beginning.
* P2p messages, that where implemented before sub-blocks
*/
trait MessageSpecV1[Content] extends MessageSpec[Content] {
trait MessageSpecInitial[Content] extends MessageSpec[Content] {

override val protocolVersion: Version = Version.initial

}


/**
* Sub-blocks related messages, V2 of the protocol
*/
trait MessageSpecSubblocks[Content] extends MessageSpec[Content] {

override val protocolVersion: Version = Version.SubblocksVersion

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import scala.collection.immutable
/**
* The `Modifier` message is a reply to a `RequestModifier` message which requested these modifiers.
*/
object ModifiersSpec extends MessageSpecV1[ModifiersData] with ScorexLogging {
object ModifiersSpec extends MessageSpecInitial[ModifiersData] with ScorexLogging {

val maxMessageSize: Int = 2048576

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import scorex.util.serialization.{Reader, Writer}
/**
* The `NipopowProof` message is a reply to a `GetNipopowProof` message.
*/
object NipopowProofSpec extends MessageSpecV1[Array[Byte]] {
object NipopowProofSpec extends MessageSpecInitial[Array[Byte]] {

val SizeLimit = 2000000
override val messageCode: Byte = 91
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import scorex.util.serialization.{Reader, Writer}
* data from a node which previously advertised it had that data by sending an `Inv` message.
*
*/
object RequestModifierSpec extends MessageSpecV1[InvData] {
object RequestModifierSpec extends MessageSpecInitial[InvData] {
override val messageCode: MessageCode = 22: Byte
override val messageName: String = "RequestModifier"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import scorex.util.serialization.{Reader, Writer}
*
* Payload of this message should be determined in underlying applications.
*/
class SyncInfoMessageSpec[SI <: SyncInfo](serializer: ErgoSerializer[SI]) extends MessageSpecV1[SI] {
class SyncInfoMessageSpec[SI <: SyncInfo](serializer: ErgoSerializer[SI]) extends MessageSpecInitial[SI] {

override val messageCode: MessageCode = 65: Byte
override val messageName: String = "Sync"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ trait VersionBasedPeerFilteringRule extends PeerFilteringRule {
* @return - whether the peer should be selected
*/
override def condition(peer: ConnectedPeer): Boolean = {
val version = peer.peerInfo.map(_.peerSpec.protocolVersion).getOrElse(Version.initial)
val version = peer.peerInfo.map(_.peerSpec.protocolVersion).getOrElse(Version.Eip37ForkVersion)
condition(version)
}

Expand Down Expand Up @@ -83,7 +83,7 @@ object NipopowSupportFilter extends PeerFilteringRule {
* @return - whether the peer should be selected
*/
override def condition(peer: ConnectedPeer): Boolean = {
val version = peer.peerInfo.map(_.peerSpec.protocolVersion).getOrElse(Version.initial)
val version = peer.peerInfo.map(_.peerSpec.protocolVersion).getOrElse(Version.Eip37ForkVersion)

peer.mode.flatMap(_.nipopowBootstrapped).isEmpty &&
version.compare(Version.NipopowActivationVersion) >= 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.ergoplatform.sdk.wallet.Constants.ModifierIdLength
* its database of available nodes rather than waiting for unsolicited `Peers`
* messages to arrive over time.
*/
object GetPeersSpec extends MessageSpecV1[Unit] {
object GetPeersSpec extends MessageSpecInitial[Unit] {
override val messageCode: MessageCode = 1: Byte

override val messageName: String = "GetPeers message"
Expand All @@ -41,7 +41,7 @@ object PeersSpec {
* The `Peers` message is a reply to a `GetPeer` message and relays connection information about peers
* on the network.
*/
class PeersSpec(peersLimit: Int) extends MessageSpecV1[Seq[PeerSpec]] {
class PeersSpec(peersLimit: Int) extends MessageSpecInitial[Seq[PeerSpec]] {

override val messageCode: MessageCode = PeersSpec.messageCode

Expand All @@ -64,7 +64,7 @@ class PeersSpec(peersLimit: Int) extends MessageSpecV1[Seq[PeerSpec]] {
/**
* The `GetSnapshotsInfo` message requests an `SnapshotsInfo` message from the receiving node
*/
object GetSnapshotsInfoSpec extends MessageSpecV1[Unit] {
object GetSnapshotsInfoSpec extends MessageSpecInitial[Unit] {
private val SizeLimit = 100

override val messageCode: MessageCode = 76: Byte
Expand All @@ -83,7 +83,7 @@ object GetSnapshotsInfoSpec extends MessageSpecV1[Unit] {
* The `SnapshotsInfo` message is a reply to a `GetSnapshotsInfo` message.
* It contains information about UTXO set snapshots stored locally.
*/
object SnapshotsInfoSpec extends MessageSpecV1[SnapshotsInfo] {
object SnapshotsInfoSpec extends MessageSpecInitial[SnapshotsInfo] {
private val SizeLimit = 20000

override val messageCode: MessageCode = 77: Byte
Expand Down Expand Up @@ -115,7 +115,7 @@ object SnapshotsInfoSpec extends MessageSpecV1[SnapshotsInfo] {
/**
* The `GetManifest` sends manifest (BatchAVLProverManifest) identifier
*/
object GetManifestSpec extends MessageSpecV1[ManifestId] {
object GetManifestSpec extends MessageSpecInitial[ManifestId] {
private val SizeLimit = 100

override val messageCode: MessageCode = 78: Byte
Expand All @@ -136,7 +136,7 @@ object GetManifestSpec extends MessageSpecV1[ManifestId] {
* The `Manifest` message is a reply to a `GetManifest` message.
* It contains serialized manifest, top subtree of a tree authenticating UTXO set snapshot
*/
object ManifestSpec extends MessageSpecV1[Array[Byte]] {
object ManifestSpec extends MessageSpecInitial[Array[Byte]] {
private val SizeLimit = 4000000

override val messageCode: MessageCode = 79: Byte
Expand All @@ -160,7 +160,7 @@ object ManifestSpec extends MessageSpecV1[Array[Byte]] {
/**
* The `GetUtxoSnapshotChunk` sends send utxo subtree (BatchAVLProverSubtree) identifier
*/
object GetUtxoSnapshotChunkSpec extends MessageSpecV1[SubtreeId] {
object GetUtxoSnapshotChunkSpec extends MessageSpecInitial[SubtreeId] {
private val SizeLimit = 100

override val messageCode: MessageCode = 80: Byte
Expand All @@ -181,7 +181,7 @@ object GetUtxoSnapshotChunkSpec extends MessageSpecV1[SubtreeId] {
/**
* The `UtxoSnapshotChunk` message is a reply to a `GetUtxoSnapshotChunk` message.
*/
object UtxoSnapshotChunkSpec extends MessageSpecV1[Array[Byte]] {
object UtxoSnapshotChunkSpec extends MessageSpecInitial[Array[Byte]] {
private val SizeLimit = 4000000

override val messageCode: MessageCode = 81: Byte
Expand Down
Loading