Skip to content

Commit

Permalink
Merge pull request #87 from NilFoundation/74-lookup-compatibility
Browse files Browse the repository at this point in the history
74 lookup compatibility
  • Loading branch information
nkaskov authored Nov 11, 2023
2 parents 7a40d6f + 2b401f1 commit e41aeee
Show file tree
Hide file tree
Showing 90 changed files with 6,738 additions and 26,880 deletions.
34 changes: 34 additions & 0 deletions contracts/interfaces/modular_commitment.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: Apache-2.0.
//---------------------------------------------------------------------------//
// Copyright (c) 2023 Elena Tatuzova <[email protected]>
//
// 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.
//---------------------------------------------------------------------------//

pragma solidity >=0.8.4;

import "../types.sol";

interface ICommitmentScheme {
function initialize(
bytes32 tr_state_before
) external returns(bytes32 tr_state_after);

// Append commitments
function verify_eval(
bytes calldata blob,
uint256[5] memory commitments,
uint256 challenge,
bytes32 transcript_state_before
) external view returns (bool);
}
24 changes: 24 additions & 0 deletions contracts/interfaces/modular_gate_argument.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: Apache-2.0.
//---------------------------------------------------------------------------//
// Copyright (c) 2023 Elena Tatuzova <[email protected]>
//
// 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.
//---------------------------------------------------------------------------//
pragma solidity ^0.8.0;

interface IGateArgument {
function verify(
bytes calldata blob,
uint256 theta
) external view returns (uint256 F);
}
27 changes: 27 additions & 0 deletions contracts/interfaces/modular_lookup_argument.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-License-Identifier: Apache-2.0.
//---------------------------------------------------------------------------//
// Copyright (c) 2023 Elena Tatuzova <[email protected]>
//
// 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.
//---------------------------------------------------------------------------//
pragma solidity ^0.8.0;

interface ILookupArgument {
function verify(
bytes calldata blob, // Table values and permutations' values
bytes calldata sorted, // Sorted batch values
uint256 lookup_commitment, // Lookup commitment
uint256 l0,
bytes32 tr_state_before // It's better than transfer all random values
) external view returns (uint256[4] memory F, bytes32 tr_state_after);
}
25 changes: 25 additions & 0 deletions contracts/interfaces/modular_permutation_argument.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: Apache-2.0.
//---------------------------------------------------------------------------//
// Copyright (c) 2023 Elena Tatuzova <[email protected]>
//
// 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.
//---------------------------------------------------------------------------//
pragma solidity ^0.8.0;

interface IModularPermutationArgument {
function verify(
bytes calldata blob,
uint256 beta,
uint256 gamma
) external view returns (uint256[3] memory F);
}
31 changes: 31 additions & 0 deletions contracts/interfaces/modular_verifier.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// SPDX-License-Identifier: Apache-2.0.
//---------------------------------------------------------------------------//
// Copyright (c) 2023 Elena Tatuzova <[email protected]>
//
// 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.
//---------------------------------------------------------------------------//
pragma solidity ^0.8.0;

interface IModularVerifier {
function initialize(
// address permutation_argument_contract_address,
address lookup_argument_contract_address,
address gate_argument_contract_address,
address commitment_contract_address
) external;

function verify(
bytes calldata blob,
uint256[] calldata public_input
) external view returns (bool result);
}
Loading

0 comments on commit e41aeee

Please sign in to comment.