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

virtual chain from block batching. #454

Merged
merged 42 commits into from
Sep 19, 2024

Conversation

D-Stacks
Copy link
Collaborator

@D-Stacks D-Stacks commented Apr 18, 2024

This PR exposes virtual chain from block and acceptance data batching possibilities in consensus; via a limit parameter. new consensus api is exposed to the corresponding vspc rpc call, which will implictly batch by mergeset_size_limit * 10 amount of chain blocks, if include_trainsactions = false, else mergeset_size_limit * 10 amount of merged blocks (via further processing).

It also exposes get_virtual_chain_from_block in cli.

Note: this change needs to be clearly communicated and documented to external kaspa integrators, who are using this call, as changes are implicit, and not circumventable, any integrator that assumes a full virtual chain to the current virtual parent, and relies on this behavior, for whatever reason, may experience issues with their integration. Although old versions will still have this behavior.

Resolves #440

(also adds some log level changes for mempool, and a version bump to 0.15.2 on the side)

@D-Stacks D-Stacks marked this pull request as draft April 18, 2024 05:28
@D-Stacks D-Stacks marked this pull request as ready for review April 18, 2024 19:15
@D-Stacks D-Stacks changed the base branch from master to dev August 28, 2024 18:58
@michaelsutton michaelsutton deleted the branch kaspanet:master September 11, 2024 18:34
@michaelsutton michaelsutton reopened this Sep 11, 2024
@michaelsutton michaelsutton changed the base branch from dev to master September 11, 2024 18:43
Copy link
Collaborator

@coderofstuff coderofstuff left a comment

Choose a reason for hiding this comment

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

Notes

  • Based on discussions, the intent is that this RPC API should work with a default behavior even if startHash is not specified. In such a case, startHash will become the pruning point automatically.

Changes

  • Add this RPC call in cli/src/modules/rpc.rs
  • On rpc/core/wasm/message.rs:
    • update the IGetVirtualChanFromBlockRequest interface so that startHash is nullable.
    • Update the try_from accordingly such that if startHash is not set, it defaults to zero hash

rpc/service/src/converter/consensus.rs Outdated Show resolved Hide resolved
rpc/service/src/service.rs Outdated Show resolved Hide resolved
rpc/service/src/service.rs Outdated Show resolved Hide resolved
let mut removed = Vec::new();
let mut common_ancestor = from;
for current in self.reachability_service.default_backward_chain_iterator(from) {
for current in self.reachability_service.default_backward_chain_iterator(from).take(max_traversal_allowed) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This iteration would start from block at from + max_traversal_allowed and go back all the way to from correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

well technically it is more like starting at from, and going back at most max_traversal_allows (the break condition is in the loop).

coderofstuff
coderofstuff previously approved these changes Sep 19, 2024
@coderofstuff coderofstuff merged commit b14537f into kaspanet:master Sep 19, 2024
6 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.

Limit the number of blocks returned by GetVirtualChainFromBlock
3 participants