Skip to content

Simplex reconfiguration framework - Part I (Helpers) - #363

Merged
yacovm merged 7 commits into
mainfrom
reconfig-1
May 4, 2026
Merged

Simplex reconfiguration framework - Part I (Helpers)#363
yacovm merged 7 commits into
mainfrom
reconfig-1

Conversation

@yacovm

@yacovm yacovm commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

This commit adds some helpers for the Simplex reconfiguration framework.

This commit entails:

  • README.md changes to align with latest implementation
  • misc.go contains helpers which will be removed once we moved the code to avalanchego.
  • builds_decision.go contains a wrapper to the mempool that also listens to P-chain changes,
    and returns either when the mempool needs to build a block or re-configuration is in order.
  • encoding.go contains the types that encode Simplex metadata and blocks.

@yacovm
yacovm force-pushed the reconfig-1 branch 3 times, most recently from 815daf2 to 76dca27 Compare April 16, 2026 16:57
Comment thread msm/build_decision.go Outdated
Comment thread msm/encoding.go Outdated
Comment thread msm/misc.go Outdated
Comment thread msm/encoding.go
Comment thread msm/encoding.go
canotoData canotoData_SimplexEpochInfo
}

func (sei *SimplexEpochInfo) IsZero() bool {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IsEmpty naming matches the blacklists pattern.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but I actually think that was a mistake and we should've used IsZero for the blacklist as well.

I suggest we change it at a later time and just keep SimplexEpochInfo's IsZero as it's more more idiomatic and it's not a container (stack, list, slice) so it makes no sense to give it an "empty" adjective.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, created an issue to remember this
#375

Comment thread msm/build_decision.go
Comment thread msm/build_decision.go
Comment thread msm/build_decision.go Outdated
Comment thread msm/build_decision.go Outdated
Comment thread msm/build_decision_test.go Outdated
Comment thread msm/encoding.go Outdated
Comment thread msm/encoding.go Outdated
})
}

func (nbms NodeBLSMappings) ForEach(selector func(int, NodeBLSMapping)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we should remove this method

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we adding these to a seperate pr? i thought we decided to update this pr with its comments

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread msm/encoding.go Outdated

type ValidatorSetApprovals []ValidatorSetApproval

func (vsa ValidatorSetApprovals) ForEach(f func(int, ValidatorSetApproval)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with this

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yacovm added 2 commits May 4, 2026 17:00
This commit adds some helpers for the Simplex reconfiguration framework.

This commit entails:

- README.md changes to align with latest implementation
- misc.go contains helpers which will be removed once we moved the code to avalanchego.
- builds_decision.go contains a wrapper to the mempool that also listens to P-chain changes,
  and returns either when the mempool needs to build a block or re-configuration is in order.
- encoding.go contains the types that encode Simplex metadata and blocks.

Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>

@samliok samliok left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, one comment but not needed. i think there are a couple unresolved comments from my previous review but when those are resolved i'll hit approve

Comment thread msm/build_decision.go Outdated
maxBlockBuildingWaitTime time.Duration
pChainListener PChainProgressListener
waitForPendingBlock func(ctx context.Context)
shouldTransitionEpoch func(pChainHeight uint64) (bool, error)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have a more detailed comment on what this callback expects? i feel like this should be named hasValidatorSetChanged to be more clear. and if we are doing hasValidatorSetChanged then the parameters of the callback should be prevPChainHeight, currentPChainHeight.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yacovm added 3 commits May 4, 2026 20:54
Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
@yacovm
yacovm merged commit 88491b9 into main May 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants