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

feat: [EXC-1619] Implement get_block_headers() endpoint #298

Open
wants to merge 58 commits into
base: master
Choose a base branch
from

Conversation

dragoljub-duric
Copy link
Contributor

@dragoljub-duric dragoljub-duric commented May 17, 2024

This PR implements get_block_headers endpoint as stated in dfinity/interface-spec#298.
E2E test will be added in follow-up.
Charging cycles, and determining the cost of the endpoint will be added in follow-up.

Copy link

github-actions bot commented May 17, 2024

canbench 🏋 (dir: .)

No significant performance changes detected ✅

./canbench_results.yml is up to date ✅

~/work/bitcoin-canister/bitcoin-canister/scripts ~/work/bitcoin-canister/bitcoin-canister
~/work/bitcoin-canister/bitcoin-canister

---------------------------------------------------

Benchmark: insert_300_blocks
  total:
    instructions: 561.77 M (-0.00%) (change within noise threshold)
    heap_increase: 6 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: get_metrics
  total:
    instructions: 87.00 M (0.00%) (change within noise threshold)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: insert_block_headers
  total:
    instructions: 3.90 B (0.00%) (change within noise threshold)
    heap_increase: 2 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: insert_block_headers_multiple_times
  total:
    instructions: 13.90 B (0.02%) (change within noise threshold)
    heap_increase: 7 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: pre_upgrade_with_many_unstable_blocks
  total:
    instructions: 8.95 B (0.00%) (change within noise threshold)
    heap_increase: 8194 pages (no change)
    stable_memory_increase: 2944 pages (no change)

  serialize_blocktree (scope):
    instructions: 5.25 B (no change)
    heap_increase: 4097 pages (no change)
    stable_memory_increase: 0 pages (no change)

  serialize_blocktree_flatten (scope):
    instructions: 201.60 K (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  serialize_blocktree_serialize_seq (scope):
    instructions: 5.25 B (no change)
    heap_increase: 4097 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

dragoljub-duric added a commit that referenced this pull request May 21, 2024
As stated in [here](dfinity/interface-spec#298),
candid interface should look as:

```
type bitcoin_block_header = blob;

type get_block_headers_request = record {
	start_height : nat32;
	end_height: opt nat32;
};

type get_block_headers_result = record {
	tip_height: nat32;
	block_headers: vec bitcoin_block_header;
};

bitcoin_get_block_headers : (get_block_headers_request) -> (get_block_headers_response);
```
This PR will add no-op endpoint for returning the block headers in the
[follow-up](#298) we
will implement specified function.
@dragoljub-duric dragoljub-duric requested a review from a team as a code owner May 28, 2024 13:10
@dragoljub-duric dragoljub-duric requested a review from THLO May 28, 2024 13:10
canister/src/api/get_block_headers.rs Outdated Show resolved Hide resolved
canister/src/api/get_block_headers.rs Outdated Show resolved Hide resolved
canister/candid.did Outdated Show resolved Hide resolved
canister/src/api/get_block_headers.rs Show resolved Hide resolved
canister/src/api/get_block_headers.rs Outdated Show resolved Hide resolved
canister/src/api/get_block_headers.rs Outdated Show resolved Hide resolved
canister/src/api/get_block_headers.rs Outdated Show resolved Hide resolved
canister/src/api/get_block_headers.rs Outdated Show resolved Hide resolved
dragoljub-duric and others added 2 commits May 30, 2024 16:20
Co-authored-by: Islam El-Ashi <islam.elashi@dfinity.org>
canister/src/api/get_block_headers.rs Outdated Show resolved Hide resolved
canister/src/api/get_block_headers.rs Outdated Show resolved Hide resolved
canister/src/api/get_block_headers.rs Outdated Show resolved Hide resolved
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

2 participants