GithubHelp home page GithubHelp logo

input-output-hk / scrypto Goto Github PK

View Code? Open in Web Editor NEW
201.0 22.0 52.0 2.14 MB

Cryptographic primitives for Scala

License: Creative Commons Zero v1.0 Universal

Scala 99.59% Dockerfile 0.16% Shell 0.25%

scrypto's Issues

Write specification for AVL+ implementation

Scrypto has an implementation of AVL+ tree described in briefly in https://eprint.iacr.org/2016/994 , see BatchAVLProver/BatchAVLVerifier classes and further scorex.crypto.authds.avltree.batch package.

In particular, this tree is tailored for blockchain applications. See the presentation from RWC2017 https://www.youtube.com/watch?v=PHY7JnLrK5o

There's no detailed specification for the tree (construction, serialization) and proofs (algorithms, serialization) yet, but it is needed, as the tree is used in Ergo blockchain (core, contracts), and possibly , somewhere else.

Check or restore keys during sliced tree recovery

Currently keys are stored during manifest and subtrees serialization in BatchAVLProverSerializer. However, they are not protected via collision-resistant hash function for internal nodes. Thus, currently verifier (calling verify() functions in BatchAVLProverManifest and BatchAVLProverSubtree) is blindly trusting the keys, which opens possibilities for adversaries.

So we need to whether avoid storing keys for internal nodes at all, or implement check (for subtrees, and for manifest(assuming bottom keys of subtrees are correct)).

Stack overflow in BatchMerkleProof.valid

As part of ergoplatform/sigma-rust implementation of BatchMerkleProof #538, I found a way to trigger stack overflow in BatchMerkleProof::valid implementation. After some testing, this issue occured in both the scala implementation and Rust. In loop() code, if a is empty, then it will still keep recursing and passing yet another empty array of indices to loop(). Here is a minimally failing example:

val batch = BatchMerkleProof(Seq(), Seq((Digest32 @@ Array.fill[Byte](32)(0),MerkleProof.LeftSide)))
batch.valid(Digest32 @@ Array.fill[Byte](32)(0))

Why the version 1.2.1 is not published yet?

I've tried to follow the README using the version 1.2.1 but sbt can't find it, I've tried to look into sonatype and also in mavenrepository but can't find it either. Why it hasn't been published yet?

Batch MerkleProof

Similarly to scorex.crypto.authds.merkle.MerkleProof, make BatchMerkleProof for many elements in the tree.

Scalastyle

Add scalastyle plugin, configure jenkins to check style after commits

publishing to remote is failing with "Repository for publishing is not specified"

After #98 got merged, publish/publishSigned is aborting with error like

[error] java.io.IOException: Server returned HTTP response code: 401 for URL: https://oss.sonatype.org/content/repositories/snapshots/org/scorexfoundation/scrypto_2.13/2.2.1-33-88372613-20230123-1543-SNAPSHOT/scrypto_2.13-2.2.1-33-88372613-20230123-1543-SNAPSHOT.jar
...
[error] java.lang.RuntimeException: Repository for publishing is not specified.
...

Provide a Replacement for hash "correct Tag" Test

This test:

property(s"${hash.getClass.getSimpleName} should return correct Tag") {
forAll { (string: String, bytes: Array[Byte]) =>
val digest = hash(string)
digest.isInstanceOf[D] shouldBe true
if (digest.isInstanceOf[Digest32]) {
hash.DigestSize shouldBe 32
} else if (digest.isInstanceOf[Digest64]) {
hash.DigestSize shouldBe 64
}
}
}

is not functional within scala 2.

This came up during work on

Reproduce

  • just replace 32/64 hash.DigestSize shouldBe 32 with a wrong value, the test will not fail.
  • or: add breakpoints to lines 64 and 66
  • or: add else { fail("Tag is not Digest32 or Digest64") } to line 67
  • #108 (review) (reproducer in CI)

Tasks

  • disable the non-functioning part
  • find a solution to have the Tag available in runtime
  • provide a new test (for scala 2 and 3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.