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

Implement SnapSync for Juno #1828

Open
6 tasks
stranger80 opened this issue Apr 16, 2024 · 3 comments
Open
6 tasks

Implement SnapSync for Juno #1828

stranger80 opened this issue Apr 16, 2024 · 3 comments
Assignees
Labels
Milestone

Comments

@stranger80
Copy link

stranger80 commented Apr 16, 2024

Tasks:

  • Leaf proof and verification
    • ...including the iterator (Rian)
  • Leaf range (Pawel & Rian) Implement the leaf range extraction and verification #1871
  • Define the pivot block (eg every 10th, or any of last 128), and implement logic to serve this state (Rian & Paweł & Kirill/Aneeque)
  • Refactor the original PoC code to align with the new range query interface (Ashraf)
  • Offline copy state via range (Ashraf)
    • Build the trie based on range query responses
  • Integrate with p2p (Ashraf & Pawel)
    • Ensure the trie is building correctly from p2p network
@stranger80 stranger80 added this to the v0.12.0 milestone Apr 16, 2024
@asdacap
Copy link
Contributor

asdacap commented May 20, 2024

type ContractRangeStreamingResult struct {
    ContractsRoot *felt.Felt
    ClassesRoot   *felt.Felt
    Range         []*spec.ContractState
    RangeProof    *spec.PatriciaRangeProof
}

type StorageRangeRequest struct {
    StateRoot     *felt.Felt
    ChunkPerProof uint64 // Missing in spec
    Queries       []*spec.StorageRangeQuery
}

type StorageRangeStreamingResult struct {
    ContractsRoot *felt.Felt
    ClassesRoot   *felt.Felt
    Range         []*spec.ContractStoredValue
    RangeProof    *spec.PatriciaRangeProof
}

type ClassRangeStreamingResult struct {
    ContractsRoot *felt.Felt
    ClassesRoot   *felt.Felt
    Range         []*spec.Class
    RangeProof    *spec.PatriciaRangeProof
}

type SnapServer interface {
    GetContractRange(request *spec.ContractRangeRequest) (chan *ContractRangeStreamingResult, error)
    GetStorageRange(request *StorageRangeRequest) (chan *StorageRangeStreamingResult, error)
    GetClassRange(request *spec.ClassRangeRequest) (chan *ClassRangeStreamingResult, error)
}

@asdacap
Copy link
Contributor

asdacap commented May 20, 2024

@asdacap
Copy link
Contributor

asdacap commented Jun 13, 2024

Changed the snap server interface.

type ContractRangeStreamingResult struct {
	ContractsRoot *felt.Felt
	ClassesRoot   *felt.Felt
	Range         []*spec.ContractState
	RangeProof    *spec.PatriciaRangeProof
}

type StorageRangeRequest struct {
	StateRoot     *felt.Felt
	ChunkPerProof uint64 // Missing in spec
	Queries       []*spec.StorageRangeQuery
}

type StorageRangeStreamingResult struct {
	ContractsRoot *felt.Felt
	ClassesRoot   *felt.Felt
	Range         []*spec.ContractStoredValue
	RangeProof    *spec.PatriciaRangeProof
}

type ClassRangeStreamingResult struct {
	ContractsRoot *felt.Felt
	ClassesRoot   *felt.Felt
	Range         *spec.Classes
	RangeProof    *spec.PatriciaRangeProof
}

type SnapServer interface {
	GetContractRange(ctx context.Context, request *spec.ContractRangeRequest) iter.Seq2[*ContractRangeStreamingResult, error]
	GetStorageRange(ctx context.Context, request *StorageRangeRequest) iter.Seq2[*StorageRangeStreamingResult, error]
	GetClassRange(ctx context.Context, request *spec.ClassRangeRequest) iter.Seq2[*ClassRangeStreamingResult, error]
	GetClasses(ctx context.Context, classHashes []*felt.Felt) ([]*spec.Class, error)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Progress
Development

No branches or pull requests

2 participants