Skip to content

Move msm metadata encoding to common#420

Closed
yacovm wants to merge 2 commits into
mainfrom
moveMSMEncoding
Closed

Move msm metadata encoding to common#420
yacovm wants to merge 2 commits into
mainfrom
moveMSMEncoding

Conversation

@yacovm

@yacovm yacovm commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

yacovm added 2 commits June 22, 2026 22:14
Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
The orchestration layer needs to be able to instantiate StateMachineMetadata,
so it makes more sense to move the block encoding to common/ along with the rest
of the encoding implementation, instead of having it in msm/

Signed-off-by: Yacov Manevich <yacov.manevich@avalabs.org>
@yacovm yacovm changed the title Move msm encoding Move msm metadata encoding to common Jun 22, 2026
Comment thread common/record.go
func BlockRecord(bh BlockHeader, blockData []byte) []byte {
mdBytes := bh.Bytes()

buff := make([]byte, len(mdBytes)+len(blockData)+2)

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.

I'm just moving code, not implementing this

@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.

i get moving some of the stuff, but for the MSM specific structs shouldn't we keep them in the MSM package?

Comment thread msm/approvals_test.go
validators: 3,
approvals: []approvalAndTimestamp{
{ValidatorSetApproval{NodeID: makeNodeID(99), PChainHeight: 1}, 1},
{common.ValidatorSetApproval{NodeID: makeNodeID(99), PChainHeight: 1}, 1},

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.

ValidatorSetApprovals are only used in the msm code? if we move everything to the common repo aren't we back to where we started?

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.

Right now it's only used in the msm code, but eventually we'll need a way to send it over the wire, which means we might need to move it to be closer to msg.go

Comment thread msm/block_type.go
}
}

func IdentifyBlockType(nextBlockMD StateMachineMetadata, prevBlockMD StateMachineMetadata, prevSeq uint64) BlockType {

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 the StateMachineMetadata doesn't it make sense to keep this in the msm?

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.

I thought that it might not be ideal that we have encodings of stuff spread out across the entire repo.

Having said that, I think I'll close this PR and see if it's possible to continue implementing the orchestration layer without moving the msm encoding to common.

@yacovm yacovm closed this Jun 22, 2026
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.

3 participants