forked from hyperledger/besu-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix linking error for LibIpaMultipoint(hyperledger#131)
Signed-off-by: Neo <neotheprogramist@proton.me> Signed-off-by: Kevaundray Wedderburn <kevtheappdev@gmail.com>
- Loading branch information
1 parent
5a1a8e9
commit 4117417
Showing
5 changed files
with
334 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...ultipoint/src/test/java/org/hyperledger/besu/nativelib/ipa_multipoint/CommitRootTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright Besu Contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
*/ | ||
package org.hyperledger.besu.nativelib.ipa_multipoint; | ||
|
||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
import static org.assertj.core.api.Assertions.*; | ||
|
||
import com.fasterxml.jackson.core.type.TypeReference; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
import org.apache.tuweni.bytes.Bytes; | ||
import org.apache.tuweni.bytes.Bytes32; | ||
import org.hyperledger.besu.nativelib.ipamultipoint.LibIpaMultipoint; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class CommitRootTest { | ||
private static final ObjectMapper objectMapper = new ObjectMapper(); | ||
|
||
public static List<TestData> JsonData() throws IOException { | ||
InputStream inputStream = PedersenCommitmentTest.class.getResourceAsStream("/genesis_lvl1_commits.json"); | ||
return objectMapper.readValue(inputStream, new TypeReference<List<TestData>>() { | ||
}); | ||
} | ||
|
||
static class TestData { | ||
public ArrayList<String> frs; | ||
public String expected; | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource("JsonData") | ||
public void TestPolynomialCommitments(TestData testData) { | ||
List<Bytes> FrBytes = new ArrayList<>(); | ||
for (int i = 0; i < 256; i++) { | ||
Bytes32 value = Bytes32.fromHexString(testData.frs.get(i)); | ||
FrBytes.add(value); | ||
} | ||
byte[] input = Bytes.concatenate(FrBytes).toArray(); | ||
Bytes32 result = Bytes32.wrap(LibIpaMultipoint.commitRoot(input)); | ||
Bytes32 expected = Bytes32.fromHexString(testData.expected); | ||
assertThat(result).isEqualTo(expected); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.