Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ New Staking Contract #453

Merged
merged 19 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into new_staking
  • Loading branch information
BertrandD committed Dec 17, 2024
commit d479d2449a8e2e8a2f7d2a625dee18fe9f277f30
1 change: 0 additions & 1 deletion contracts/risc0-recursion/tests/recursion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::collections::HashMap;

use hyrun::{Cli, Context, ContractData};
use risc0_recursion::ProofInput;
use risc0_zkvm::sha::Digestible;
use sdk::{HyleOutput, StateDigest};

#[test_log::test(test)]
Expand Down
Binary file modified contracts/staking/staking.img
Binary file not shown.
2 changes: 1 addition & 1 deletion contracts/staking/staking.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
de5ae548062c24f22ceffc6b838d6dcd8a0b3a43cc15c6511cbd81f127924845
b74f2308e46f81b4d317fb3fffcc7f17e86dabafec1d5dd1d4639da8e0f7b26f
9 changes: 9 additions & 0 deletions src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,15 @@ impl Genesis {
contract_name: "hydentity".into(),
},
)),
Transaction::wrap(TransactionData::RegisterContract(
RegisterContractTransaction {
owner: "hyle".into(),
verifier: "risc0".into(),
program_id: hyle_contracts::RISC0_RECURSION_ID.to_vec().into(),
state_digest: hyle_contract_sdk::StateDigest(vec![]),
contract_name: "risc0-recursion".into(),
},
)),
],
states,
)
Expand Down
18 changes: 11 additions & 7 deletions src/mempool/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ pub async fn api(ctx: &CommonRunContext) -> Router<()> {

Router::new()
.route("/contract/register", post(send_contract_transaction))
//.route("/tx/send/stake", post(send_staking_transaction)) // TODO
.route("/tx/send/blob", post(send_blob_transaction))
.route("/tx/send/proof", post(send_proof_transaction))
.route(
Expand Down Expand Up @@ -86,12 +85,17 @@ pub async fn send_proof_transaction(
handle_send(state, TransactionData::Proof(payload)).await
}

//pub async fn send_staking_transaction(
// State(state): State<RouterState>,
// Json(payload): Json<Staker>,
//) -> Result<impl IntoResponse, AppError> {
// handle_send(state, TransactionData::Stake(payload)).await
//}
pub async fn send_recursive_proof_transaction(
State(state): State<RouterState>,
Json(mut payload): Json<RecursiveProofTransaction>,
) -> Result<impl IntoResponse, AppError> {
let proof_bytes = payload
.proof
.to_bytes()
.map_err(|err| AppError(StatusCode::BAD_REQUEST, anyhow!(err)))?;
payload.proof = ProofData::Bytes(proof_bytes);
handle_send(state, TransactionData::RecursiveProof(payload)).await
}

impl Clone for RouterState {
fn clone(&self) -> Self {
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.