Skip to content

Commit c5e330a

Browse files
committed
debug: using static image id
1 parent 85ae0f6 commit c5e330a

File tree

10 files changed

+2320
-2547
lines changed

10 files changed

+2320
-2547
lines changed

aggregation_mode/Cargo.lock

Lines changed: 17 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aggregation_mode/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ risc0-ethereum-contracts = { git = "https://github.com/risc0/risc0-ethereum/", t
2828

2929
[build-dependencies]
3030
sp1-build = { version = "4.1.3" }
31-
risc0-build = { version = "2.0.0" }
31+
risc0-build = { version = "2.0.1", features = ["docker"] }
32+
risc0-build-ethereum = { git = "https://github.com/risc0/risc0-ethereum", tag = "v2.0.1" }
3233

3334
[package.metadata.risc0]
3435
# Tell risc0 build to find method in ./aggregation_programs/risc0 package

aggregation_mode/build.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Paths where the generated Solidity files will be written.
2+
const SOLIDITY_IMAGE_ID_PATH: &str = "../contracts/src/ImageID.sol";
3+
const SOLIDITY_ELF_PATH: &str = "../contracts/src/Elf.sol";
4+
15
fn main() {
26
sp1_build::build_program_with_args("./aggregation_programs/sp1", {
37
sp1_build::BuildArgs {
@@ -6,5 +10,11 @@ fn main() {
610
}
711
});
812

9-
risc0_build::embed_methods();
13+
let guests = risc0_build::embed_methods();
14+
15+
let solidity_opts = risc0_build_ethereum::Options::default()
16+
.with_image_id_sol_path(SOLIDITY_IMAGE_ID_PATH)
17+
.with_elf_sol_path(SOLIDITY_ELF_PATH);
18+
19+
risc0_build_ethereum::generate_solidity_files(guests.as_slice(), &solidity_opts).unwrap();
1020
}

contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

contracts/scripts/anvil/state/eigenlayer-deployed-anvil-state.json

Lines changed: 2234 additions & 2534 deletions
Large diffs are not rendered by default.

contracts/scripts/anvil/state/risc0-deployed-anvil-state.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

contracts/scripts/anvil/state/sp1-deployed-anvil-state.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

contracts/src/Elf.sol

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2024 RISC Zero, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
// SPDX-License-Identifier: Apache-2.0
16+
17+
// This file is automatically generated
18+
19+
pragma solidity ^0.8.20;
20+
21+
library Elf {
22+
string public constant RISC0_AGGREGATOR_PROGRAM_PATH =
23+
"/Users/marcos/code/aligned_layer/aggregation_mode/target/riscv-guest/proof_aggregator/risc0_aggregation_program/riscv32im-risc0-zkvm-elf/release/risc0_aggregator_program.bin";
24+
}

contracts/src/ImageID.sol

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2024 RISC Zero, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
// SPDX-License-Identifier: Apache-2.0
16+
17+
// This file is automatically generated
18+
19+
pragma solidity ^0.8.20;
20+
21+
library ImageID {
22+
bytes32 public constant RISC0_AGGREGATOR_PROGRAM_ID =
23+
bytes32(0x14c9111202a268f839eaa1b0e81975f015f034caecad116adc2f11ab8a7cf29d);
24+
}

contracts/src/core/AlignedProofAggregationService.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {UUPSUpgradeable} from "@openzeppelin-upgrades/contracts/proxy/utils/UUPS
77
import {IAlignedProofAggregationService} from "./IAlignedProofAggregationService.sol";
88
import {ISP1Verifier} from "@sp1-contracts/ISP1Verifier.sol";
99
import {IRiscZeroVerifier} from "@risc0-contracts/IRiscZeroVerifier.sol";
10+
import {ImageID} from "../ImageID.sol";
1011

1112
contract AlignedProofAggregationService is
1213
IAlignedProofAggregationService,
@@ -82,11 +83,10 @@ contract AlignedProofAggregationService is
8283

8384
// In dev mode, poofs are mocked, so we skip the verification part
8485
if (_isRisc0VerificationEnabled()) {
85-
bytes32 myDigest = sha256(risc0JournalBytes);
86-
if (myDigest != risc0JournalDigest) {
87-
revert("Digest did not matc");
88-
}
89-
IRiscZeroVerifier(risc0VerifierAddress).verify(risc0ReceiptSeal, risc0ImageId, risc0JournalDigest);
86+
// bytes32 myDigest = sha256(risc0JournalBytes);
87+
IRiscZeroVerifier(risc0VerifierAddress).verify(
88+
risc0ReceiptSeal, ImageID.RISC0_AGGREGATOR_PROGRAM_ID, risc0JournalDigest
89+
);
9090
}
9191

9292
aggregatedProofs[merkleRoot] = true;

0 commit comments

Comments
 (0)