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

feat: update raiko with taiko-mono #15

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions primitives/src/taiko/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ pub mod testnet {
Address::from_str("0x08a3f537c4bbe8B6176420f4Cd0C84b02172dC65")
.expect("invalid l1 signal service")
});

pub static L1_SGX_VERIFIER: Lazy<Address> = Lazy::new(|| {
Address::from_str("0xA30517F2Ee52634ddD9a3473FB50B162C772c84D")
.expect("invalid l1 sgx verifier")
});

pub static L2_CONTRACT: Lazy<Address> = Lazy::new(|| {
Address::from_str("0x1670080000000000000000000000000000010001")
.expect("invalid l2 contract address")
Expand Down
9 changes: 7 additions & 2 deletions primitives/src/taiko/protocol_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use alloy_primitives::{Address, B256, U256};
use alloy_sol_types::{sol, SolEvent, SolValue, TopicList};
use anyhow::{anyhow, Context, Result};
use ethers_core::types::{Log, H256};
use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};

use crate::{ethers::from_ethers_h256, keccak};
use crate::{ethers::from_ethers_h256, keccak, taiko::consts::testnet};

sol! {
#[derive(Debug, Default, Deserialize, Serialize)]
Expand Down Expand Up @@ -112,11 +113,15 @@ impl ProtocolInstance {
keccak::keccak(self.block_metadata.abi_encode()).into()
}

// keccak256(abi.encode(tran, newInstance, prover, metaHash))
// keccak256(abi.encode("VERIFY_PROOF", ITaikoL1(taikoL1).getConfig.chainId,
// address(this), tran, newInstance, prover, metaHash))
pub fn hash(&self, evidence_type: EvidenceType) -> B256 {
match evidence_type {
EvidenceType::Sgx { new_pubkey } => keccak::keccak(
(
String::from("VERIFY_PROOF"),
testnet::CHAIN_ID,
Lazy::<alloy_primitives::Address>::get(&testnet::L1_SGX_VERIFIER).unwrap(),
self.transition.clone(),
new_pubkey,
self.prover,
Expand Down