Skip to content

Commit

Permalink
feat(api): add proof-of-inclusion (PoI) endpoints (#854)
Browse files Browse the repository at this point in the history
* Create proof-of-inclusion endpoints and initial logic

* Cleanup and test Merkle tree hasher

* Add db query for pastcone in whiteflag order

* Create PoI

* Improve hasher

* Improve hasher 2

* Implement contains check

* Impl proof validation part 1

* Clippy + Format

* Faulty License header complaint and clippy belitteling

* Fix validity check

* Add PoI api spec

* Add PoI link

* Impl proof validation part 2

* Cleanup Merkle hasher

* Cleanup Merkle proof

* Test dto roundtrip

* Format

* Remove key_manager module (as it was kinda bloat)

* Update api-poi.yaml

* Remove hex prefix for milestone validation

* Format

* I hate you clippy ... sometimes ;)

* Nit

* Don't need to fetch the milestone on validation

* Make PoI feature default

* Return error if decoding public key fails

* Include 'white_flag_index' into new combound index

* Refactor 'Hashable' enum

* Improve 'compute_proof' recursive fn

Co-authored-by: Alex Coats <[email protected]>

* Refactor 'merkle_proof' module

* Document recursive fn

* Remove generics from the Merkle hasher

Co-authored-by: Alex Coats <[email protected]>

* Nit

* Add PoI endpoints for applied blocks

* Remove dependency on lazy-static

* Remove binary response stubs

* Simplify audit path algo

* Further simplify and document audit path algo

* Improve docs

* Refer to Core REST API

* Debug 1

* Support single block cone audit paths

* Improve docs

* Impl AsRef for BlockId and make use of it

* Cleanup PoI routes

* More cleanup

Co-authored-by: Alex Coats <[email protected]>
Co-authored-by: Jochen Görtler <[email protected]>
  • Loading branch information
3 people authored Dec 19, 2022
1 parent 774d76b commit 62545a2
Show file tree
Hide file tree
Showing 20 changed files with 1,414 additions and 80 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ ed25519 = { version = "1.5", default-features = false, features = [ "alloc", "pk
ed25519-dalek = { version = "1.0", default-features = false, features = [ "u64_backend" ], optional = true }
hex = { version = "0.4", default-features = false, optional = true }
hyper = { version = "0.14", default-features = false, features = [ "server", "tcp", "stream" ], optional = true }
lazy_static = { version = "1.4", default-features = false, optional = true }
packable = { version = "0.7", default-features = false, optional = true }
rand = { version = "0.8", default-features = false, features = [ "std" ], optional = true }
regex = { version = "1.7", default-features = false, features = [ "std" ], optional = true }
Expand All @@ -78,6 +77,9 @@ tonic = { version = "0.8", default-features = false, optional = true }
# Loki
tracing-loki = { version = "0.2", default-features = false, features = [ "compat-0-2-1", "native-tls" ], optional = true }

# PoI
iota-crypto = { version = "0.15", default-features = false, features = [ "blake2b" ], optional = true }

# Stardust types
iota-types = { version = "1.0.0-rc", default-features = false, features = [ "api", "block", "std" ], optional = true }

Expand All @@ -92,6 +94,7 @@ default = [
"inx",
"loki",
"metrics",
"poi",
"stardust",
]
analytics = [
Expand All @@ -105,7 +108,6 @@ api = [
"dep:hex",
"derive_more/from",
"dep:hyper",
"dep:lazy_static",
"dep:packable",
"dep:rand",
"dep:regex",
Expand All @@ -129,6 +131,10 @@ metrics = [
"dep:influxdb",
"dep:chrono",
]
poi = [
"api",
"dep:iota-crypto",
]
rand = [
"iota-types?/rand",
]
Expand Down
Loading

0 comments on commit 62545a2

Please sign in to comment.