Skip to content

Commit

Permalink
Move Pasta and Poseidon contracts to blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
storojs72 committed Jul 20, 2023
1 parent ab14b67 commit 52aee4b
Show file tree
Hide file tree
Showing 24 changed files with 39 additions and 91 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:

- name: Regenerate Contracts
run: |
python src/poseidon/poseidon-contract-gen.py neptune-constants-U24-pallas.json PoseidonU24Pallas > src/poseidon/PoseidonNeptuneU24pallas.sol
python src/poseidon/poseidon-contract-gen.py neptune-constants-U24-vesta.json PoseidonU24Vesta > src/poseidon/PoseidonNeptuneU24vesta.sol
python src/blocks/poseidon/poseidon-contract-gen.py neptune-constants-U24-pallas.json PoseidonU24Pallas > src/blocks/poseidon/PoseidonNeptuneU24pallas.sol
python src/blocks/poseidon/poseidon-contract-gen.py neptune-constants-U24-vesta.json PoseidonU24Vesta > src/blocks/poseidon/PoseidonNeptuneU24vesta.sol
- name: Run forge fmt on re-generated contracts
run: |
Expand Down
51 changes: 0 additions & 51 deletions nifs-expected-loader.py

This file was deleted.

4 changes: 2 additions & 2 deletions src/NovaVerifierAbstractions.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import "src/pasta/Vesta.sol";
import "src/pasta/Pallas.sol";
import "src/blocks/pasta/Vesta.sol";
import "src/blocks/pasta/Pallas.sol";
import "src/Utilities.sol";

library Abstractions {
Expand Down
4 changes: 2 additions & 2 deletions src/blocks/EqPolynomial.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.16;

import "src/pasta/Vesta.sol";
import "src/pasta/Pallas.sol";
import "src/blocks/pasta/Vesta.sol";
import "src/blocks/pasta/Pallas.sol";

library EqPolinomialLib {
function evaluate(
Expand Down
4 changes: 2 additions & 2 deletions src/blocks/KeccakTranscript.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.16;

import "src/pasta/Vesta.sol";
import "src/pasta/Pallas.sol";
import "src/blocks/pasta/Vesta.sol";
import "src/blocks/pasta/Pallas.sol";

library ScalarFromUniformLib {
uint256 private constant SCALAR_UNIFORM_BYTE_SIZE = 64;
Expand Down
4 changes: 2 additions & 2 deletions src/blocks/PolyEvalInstance.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import "src/pasta/Vesta.sol";
import "src/pasta/Pallas.sol";
import "src/blocks/pasta/Vesta.sol";
import "src/blocks/pasta/Pallas.sol";

library PolyEvalInstanceUtilities {
function powers(uint256 s, uint256 len, uint256 modulus) internal pure returns (uint256[] memory) {
Expand Down
4 changes: 2 additions & 2 deletions src/blocks/SparsePolynomial.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.16;

import "src/pasta/Vesta.sol";
import "src/pasta/Pallas.sol";
import "src/blocks/pasta/Vesta.sol";
import "src/blocks/pasta/Pallas.sol";

// Port of Nova' SparsePolynomial (https://github.com/microsoft/Nova/blob/main/src/spartan/polynomial.rs#L121)
library SparsePolynomialLib {
Expand Down
4 changes: 2 additions & 2 deletions src/blocks/Sumcheck.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pragma solidity ^0.8.0;

import "@std/Test.sol";
import "src/pasta/Pallas.sol";
import "src/pasta/Vesta.sol";
import "src/blocks/pasta/Pallas.sol";
import "src/blocks/pasta/Vesta.sol";
import "src/blocks/KeccakTranscript.sol";
import "src/blocks/EqPolynomial.sol";

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Do not change manually. This contract has been auto-generated by src/poseidon/poseidon-contract-gen.py
// Do not change manually. This contract has been auto-generated by src/blocks/poseidon/poseidon-contract-gen.py
pragma solidity ^0.8.16;

library PoseidonU24Pallas {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Do not change manually. This contract has been auto-generated by src/poseidon/poseidon-contract-gen.py
// Do not change manually. This contract has been auto-generated by src/blocks/poseidon/poseidon-contract-gen.py
pragma solidity ^0.8.16;

library PoseidonU24Vesta {
Expand Down
5 changes: 2 additions & 3 deletions src/poseidon/Sponge.sol → src/blocks/poseidon/Sponge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
pragma solidity ^0.8.16;

import "@std/Test.sol";
import "src/pasta/Pallas.sol";
import "src/poseidon/PoseidonNeptuneU24pallas.sol";
import "src/poseidon/PoseidonNeptuneU24vesta.sol";
import "src/blocks/poseidon/PoseidonNeptuneU24pallas.sol";
import "src/blocks/poseidon/PoseidonNeptuneU24vesta.sol";

library SpongeOpLib {
enum SpongeOpType {
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/verifier/Step2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pragma solidity ^0.8.0;

import "@std/Test.sol";
import "src/NovaVerifierAbstractions.sol";
import "src/poseidon/Sponge.sol";
import "src/pasta/Pallas.sol";
import "src/pasta/Vesta.sol";
import "src/blocks/poseidon/Sponge.sol";
import "src/blocks/pasta/Pallas.sol";
import "src/blocks/pasta/Vesta.sol";

library Step2Lib {
uint256 private constant NUM_FE_WITHOUT_IO_FOR_CRHF = 17;
Expand Down
6 changes: 3 additions & 3 deletions src/verifier/Step3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
pragma solidity ^0.8.0;

import "@std/Test.sol";
import "src/pasta/Pallas.sol";
import "src/pasta/Vesta.sol";
import "src/poseidon/Sponge.sol";
import "src/blocks/pasta/Pallas.sol";
import "src/blocks/pasta/Vesta.sol";
import "src/blocks/poseidon/Sponge.sol";
import "src/blocks/KeccakTranscript.sol";
import "src/blocks/Sumcheck.sol";
import "src/NovaVerifierAbstractions.sol";
Expand Down
4 changes: 2 additions & 2 deletions test/eq-evaluation-tests.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ pragma solidity ^0.8.0;

import "@std/Test.sol";
import "src/blocks/EqPolynomial.sol";
import "src/pasta/Vesta.sol";
import "src/pasta/Pallas.sol";
import "src/blocks/pasta/Vesta.sol";
import "src/blocks/pasta/Pallas.sol";

contract EqEvaluationTest is Test {
function testEqEvaluationPrimary1() public {
Expand Down
4 changes: 2 additions & 2 deletions test/field-tests.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ pragma solidity ^0.8.0;

import "@std/Test.sol";
import "src/Utilities.sol";
import "src/pasta/Pallas.sol";
import "src/pasta/Vesta.sol";
import "src/blocks/pasta/Pallas.sol";
import "src/blocks/pasta/Vesta.sol";

contract FieldLibraryTest is Test {
function testPallasInvertFr() public {
Expand Down
4 changes: 2 additions & 2 deletions test/pasta-curves-tests.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ pragma solidity ^0.8.0;

import "@std/Test.sol";
import "src/Utilities.sol";
import "src/pasta/Pallas.sol";
import "src/pasta/Vesta.sol";
import "src/blocks/pasta/Pallas.sol";
import "src/blocks/pasta/Vesta.sol";

contract PastaCurvesContractTests is Test {
function testPallasMSM() public {
Expand Down
4 changes: 2 additions & 2 deletions test/poly-eval-instance-tests.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pragma solidity ^0.8.0;

import "@std/Test.sol";
import "src/pasta/Pallas.sol";
import "src/pasta/Vesta.sol";
import "src/blocks/pasta/Pallas.sol";
import "src/blocks/pasta/Vesta.sol";
import "src/blocks/PolyEvalInstance.sol";

contract PolyEvalInstanceTest is Test {
Expand Down
4 changes: 2 additions & 2 deletions test/poseidon-tests.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pragma solidity ^0.8.0;

import "@std/Test.sol";
import "src/poseidon/PoseidonNeptuneU24pallas.sol";
import "src/poseidon/PoseidonNeptuneU24vesta.sol";
import "src/blocks/poseidon/PoseidonNeptuneU24pallas.sol";
import "src/blocks/poseidon/PoseidonNeptuneU24vesta.sol";

contract PoseidonContractTest is Test {
function testPoseidonNeptuneU24PallasCompatibility() public {
Expand Down
4 changes: 2 additions & 2 deletions test/pp-spartan.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pragma solidity ^0.8.0;

import "@std/Test.sol";
import "src/pasta/Pallas.sol";
import "src/pasta/Vesta.sol";
import "src/blocks/pasta/Pallas.sol";
import "src/blocks/pasta/Vesta.sol";
import "src/blocks/EqPolynomial.sol";
import "src/blocks/KeccakTranscript.sol";
import "src/blocks/PolyEvalInstance.sol";
Expand Down
4 changes: 2 additions & 2 deletions test/sparse-poly-evaluation-tests.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ pragma solidity ^0.8.0;

import "@std/Test.sol";
import "src/blocks/SparsePolynomial.sol";
import "src/pasta/Vesta.sol";
import "src/pasta/Pallas.sol";
import "src/blocks/pasta/Vesta.sol";
import "src/blocks/pasta/Pallas.sol";

contract SparseEvaluationTest is Test {
function testSparseEvaluationPrimary() public {
Expand Down
2 changes: 1 addition & 1 deletion test/sponge-tests.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.0;

import "@std/Test.sol";
import "src/poseidon/Sponge.sol";
import "src/blocks/poseidon/Sponge.sol";

// TODO: add other sponge (in simplex mode) tests from neptune: https://github.com/lurk-lab/neptune/blob/master/src/sponge/vanilla.rs#L501
contract SpongeContractTest is Test {
Expand Down

0 comments on commit 52aee4b

Please sign in to comment.