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

cmd, process, factory, node, integrationTests: versioned header factory #3108

Merged
merged 5 commits into from
May 24, 2021

Conversation

AdoAdoAdo
Copy link
Contributor

@AdoAdoAdo AdoAdoAdo commented May 20, 2021

This PR implements a versioned header factory

import "github.com/ElrondNetwork/elrond-go/data"

// HeaderVersionHandlerMock -
type HeaderVersionHandlerMock struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is actually a stub

},
ScheduledRootHash: nil,
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

the code would have been a little clearer if it would have been like:

func (shf *shardHeaderFactory) Create(epoch uint32) data.HeaderHandler {
	version := shf.headerVersionHandler.GetVersion(epoch)

	switch version {
	case "2":
		return &block.HeaderV2{
			Header: &block.Header{
				Epoch:           epoch,
				SoftwareVersion: []byte(version),
			},
			ScheduledRootHash: nil,
		}
        default: 
                return &block.Header{
			Epoch:           epoch,
			SoftwareVersion: []byte(version),
		}
	}

iulianpascalau
iulianpascalau previously approved these changes May 21, 2021
factory/block/headerVersionHandler.go Outdated Show resolved Hide resolved
factory/block/errors.go Outdated Show resolved Hide resolved
factory/block/errors.go Outdated Show resolved Hide resolved
factory/block/headerVersionHandler.go Outdated Show resolved Hide resolved
factory/block/headerVersionHandler.go Outdated Show resolved Hide resolved
factory/block/headerVersionHandler.go Outdated Show resolved Hide resolved
iulianpascalau
iulianpascalau previously approved these changes May 21, 2021
@AdoAdoAdo AdoAdoAdo merged commit 7ba9ad3 into feat/scheduled-sc-execution May 24, 2021
@AdoAdoAdo AdoAdoAdo deleted the header-factory branch May 24, 2021 07:21
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.

None yet

4 participants