Skip to content

Commit

Permalink
test pass
Browse files Browse the repository at this point in the history
  • Loading branch information
rkdud007 committed Jul 16, 2024
1 parent bb1ee15 commit f0e24db
Show file tree
Hide file tree
Showing 8 changed files with 172,140 additions and 4,751 deletions.
167,346 changes: 167,346 additions & 0 deletions build/compiled_cairo/contract_dry_run.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cairo_run_output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"tasks_root": "0xa987a9040ad5fcacb9f48856700b61127450fcabb2966babffcae1839039656f", "results_root": "0xe243737cce1407b7e01eee0bc23174fd7c54127d718ca7c613983ba3b17ad66d", "results": [0]}
30 changes: 14 additions & 16 deletions helpers/fetch_cairo_input.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,32 @@ async function main() {
process.exit(1);
}
const encoder = new AbiCoder();
usedMmrId = [cached["mmr"]["id"]];
usedMmrSize = [cached["mmr"]["size"]];
usedMmrRoot = [padToBytes32(cached["mmr"]["root"])];
usedMMRs = cached["mmr_metas"];
mmrIds = usedMMRs.map((mmr) => mmr["id"]);
mmrSizes = usedMMRs.map((mmr) => mmr["size"]);
mmrRoots = usedMMRs.map((mmr) => padToBytes32(mmr["root"]));
resultsMerkleRoot = cached["results_root"];
tasksMerkleRoot = cached["tasks_root"];
tasks_list = cached["tasks"]
tasksCommitments = tasks_list.map((task) => task["task_commitment"]);
results = tasks_list.map((task) => {
const bigIntValue = BigInt(task["compiled_result"]);
const hexString = "0x" + bigIntValue.toString(16).padStart(64, "0");
return hexString;
});
tasksCommitments = cached["tasks_commitments"];
resultsCommitments = cached["results_commitments"];
rawResults = cached["raw_results"];
const tasksMerkleTree = StandardMerkleTree.of([tasksCommitments], ["bytes32"], { sortLeaves: false });
const resultsMerkleTree = StandardMerkleTree.of([results], ["bytes32"], { sortLeaves: false });
const resultsMerkleTree = StandardMerkleTree.of([resultsCommitments], ["bytes32"], { sortLeaves: false });
tasksInclusionProofs = tasksCommitments.map(commit => tasksMerkleTree.getProof(tasksCommitments.indexOf(commit)));
resultsInclusionProofs = results.map(commit => resultsMerkleTree.getProof(results.indexOf(commit)));
resultsInclusionProofs = resultsCommitments.map(commit => resultsMerkleTree.getProof(resultsCommitments.indexOf(commit)));


const abiEncodedResult = encoder.encode(
["uint256[]", "uint256[]", "bytes32[]", "bytes32", "bytes32", "bytes32[][]", "bytes32[][]", "bytes32[]", "bytes32[]"],
[ usedMmrId,
usedMmrSize,
usedMmrRoot,
[ mmrIds,
mmrSizes,
mmrRoots,
tasksMerkleRoot,
resultsMerkleRoot,
tasksInclusionProofs,
resultsInclusionProofs,
tasksCommitments,
results,
rawResults,
]
);
console.log(abiEncodedResult);
Expand Down
4 changes: 2 additions & 2 deletions helpers/script/hdp-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ prepare_cairo_enviroment() {
# Call the function to ensure the virtual environment is activated
prepare_cairo_enviroment

hdp encode -a -p helpers/target/bs_cached_input.json -o helpers/target/bs_cached_output.json -c helpers/target/bs_hdp_pie.zip avg -b 5858987 5858997 header.excess_blob_gas 2
hdp encode -a -p helpers/target/tx_cached_input.json -o helpers/target/tx_cached_output.json -c helpers/target/tx_hdp_pie.zip avg -t 5605816 tx_receipt.success 12 53 1 0,0,1,1
hdp encode -a -p helpers/target/bs_cached_input.json -o helpers/target/bs_cached_output.json -c helpers/target/bs_hdp_pie.zip slr none.10000000 -b 5858987 5858997 header.excess_blob_gas 2
hdp encode -a -p helpers/target/tx_cached_input.json -o helpers/target/tx_cached_output.json -c helpers/target/tx_hdp_pie.zip slr none.50 -t 5605816 tx_receipt.success 12 53 1 0,0,1,1
Loading

0 comments on commit f0e24db

Please sign in to comment.