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

Implementing Chain Types #81

Closed
dutterbutter opened this issue Dec 9, 2019 · 3 comments
Closed

Implementing Chain Types #81

dutterbutter opened this issue Dec 9, 2019 · 3 comments
Assignees
Labels
Priority: 4 - Low Limited impact and can be implemented at any time

Comments

@dutterbutter
Copy link
Contributor

dutterbutter commented Dec 9, 2019

Need to implement the basic chain structures as defined in the spec under Chain. This task has a dependency on having a Chain Store implemented (e.g. for retrieving head tipset).

  1. Chain type
  2. Chain methods
  3. Checkpoints

[ 1 ] The chain type is defined in the spec as:

type Chain struct {
    HeadTipset Tipset
}

However, I cannot see this defined in the go-filecoin implementation or how its exactly used. The closest implementation to this and the chain methods are in the porcelain package here go-filecoin/internal/app/go-filecoin/porcelain/chain.go / .

[ 2 ] Much like the Chain type, the methods described in the spec are not clearly defined in the go implementation. As defined in the spec:

// Returns the tipset at or immediately prior to `epoch`.
func (chain *Chain_I) TipsetAtEpoch(epoch block.ChainEpoch) Tipset {
	current := chain.HeadTipset()
	for current.Epoch() > epoch {
		current = current.Parents()
	}

	return current
}

// Draws randomness from the tipset at or immediately prior to `epoch`.
func (chain *Chain_I) RandomnessAtEpoch(epoch block.ChainEpoch) util.Bytes {
	ts := chain.TipsetAtEpoch(epoch)
	return ts.MinTicket().DrawRandomness(epoch)
}

func (chain *Chain_I) LatestCheckpoint() epoch block.ChainEpoch {
}

For TipsetAtEpoch, I think this should be TipSetByKey, where you would pass in a TipSetKey as a param rather than epoch imo.

[ 3 ] Checkpoints x3, can be implemented and are defined as:

type Checkpoint &block.BlockHeader
type SoftCheckpoint Checkpoint
type TrustedCheckpoint Checkpoint

For more information refer to Chain. I was not able to find any reference to checkpoint in the go implementation except for the rust file scheduler.rs under sector-builder.

@dutterbutter dutterbutter self-assigned this Dec 10, 2019
@dutterbutter
Copy link
Contributor Author

dutterbutter commented Dec 16, 2019

Started implementing, when the TipIndex from #106 is completed will open for PR.

Although not really well defined in the spec, and the use of SoftCheckpoint and Checkpoint don't seem to be referenced anywhere only TrustedCheckpoint.

@dutterbutter dutterbutter added the Priority: 4 - Low Limited impact and can be implemented at any time label Dec 21, 2019
@amerameen
Copy link
Contributor

This issue had #106 as a blocker? Is that not needed anymore? Was there a workaround?

@dutterbutter
Copy link
Contributor Author

@amerameen this issue originally was dependant on the TipIndex due to the method TipsetAtEpoch which was included #109 as a subtask of #106. Although the checkpoints have not been completed I have closed this issue as everything else has either been implemented elsewhere.

As for the checkpoints, I believe a new issue can be created when we complete blocksync and other sync functionality, otherwise it will sit as dead code for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 4 - Low Limited impact and can be implemented at any time
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants