Skip to content

Commit

Permalink
sync latest protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
smtmfft committed Aug 9, 2024
1 parent 7fa9f09 commit 122bc2d
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 26 deletions.
30 changes: 30 additions & 0 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,36 @@ mod tests {
.expect("proof generation failed");
}

#[ignore]
#[tokio::test(flavor = "multi_thread")]
async fn test_prove_block_taiko_dev() {
let proof_type = get_proof_type_from_env();
let l1_network = "taiko_dev_l1".to_owned();
let network = "taiko_dev".to_owned();
// Give the CI an simpler block to test because it doesn't have enough memory.
// Unfortunately that also means that kzg is not getting fully verified by CI.
let block_number = 20 ;
let chain_specs = SupportedChainSpecs::merge_from_file(
"../host/config/chain_spec_list_devnet.json".into(),
)
.unwrap();
let taiko_chain_spec = chain_specs.get_chain_spec(&network).unwrap();
let l1_chain_spec = chain_specs.get_chain_spec(&l1_network).unwrap();

let proof_request = ProofRequest {
block_number,
l1_inclusive_block_number: 80,
network,
graffiti: B256::ZERO,
prover: Address::ZERO,
l1_network,
proof_type,
blob_proof_type: BlobProofType::ProofOfEquivalence,
prover_args: test_proof_params(),
};
prove_block(l1_chain_spec, taiko_chain_spec, proof_request).await;
}

#[tokio::test(flavor = "multi_thread")]
async fn test_prove_block_taiko_a7() {
let proof_type = get_proof_type_from_env();
Expand Down
13 changes: 9 additions & 4 deletions host/config/chain_spec_list_devnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"RISC0": null
}
},
"genesis_time": 1722392400,
"genesis_time": 1723183700,
"seconds_per_slot": 12,
"is_taiko": false
},
Expand All @@ -44,7 +44,7 @@
"Block": 0
},
"ONTAKE": {
"Block": 999999
"Block": 20
},
"CANCUN": "TBD"
},
Expand All @@ -54,13 +54,18 @@
"base_fee_max_decrease_denominator": "0x8",
"elasticity_multiplier": "0x2"
},
"l1_contract": "0x558E38a3286916934Cb63ced04558A52F7Ce67a9",
"l1_contract": "0xA4702E22F8807Df82Fe5B6dDdd99eB3Fcb0237B0",
"l2_contract": "0x1670010000000000000000000000000000010001",
"rpc": "https://rpc.internal.taiko.xyz",
"beacon_rpc": null,
"verifier_address_forks": {
"HEKLA": {
"SGX": "0xC069c3d2a9f2479F559AD34485698ad5199C555f",
"SGX": "0xebB0DA61818F639f460F67940EB269b36d1F104E",
"SP1": null,
"RISC0": "0x28336BC4116B9672000E7C6Ab96B1454D9d138f7"
},
"ONTAKE": {
"SGX": "0xebB0DA61818F639f460F67940EB269b36d1F104E",
"SP1": null,
"RISC0": "0x28336BC4116B9672000E7C6Ab96B1454D9d138f7"
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl<DB: Database<Error = ProviderError> + DatabaseCommit + OptimisticDatabase>
l1_header: self.input.taiko.l1_header.clone(),
parent_header: self.input.parent_header.clone(),
l2_contract: self.input.chain_spec.l2_contract.unwrap_or_default(),
basefee_ratio: self.input.taiko.block_proposed.basefee_sharing_ratio(),
basefee_ratio: self.input.block.extra_data[0],
basefee_adj_quotient: self.input.taiko.block_proposed.basefee_adjustment_quotient(),
gas_issue_per_sec: self.input.taiko.block_proposed.gas_issuance_per_second(),
})
Expand Down
7 changes: 0 additions & 7 deletions lib/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,6 @@ impl BlockProposedFork {
}
}

pub fn basefee_sharing_ratio(&self) -> u8 {
match self {
BlockProposedFork::Ontake(block) => block.meta.basefeeSharingPctg,
_ => 0,
}
}

pub fn basefee_adjustment_quotient(&self) -> u8 {
match self {
BlockProposedFork::Ontake(block) => block.meta.basefeeAdjustmentQuotient,
Expand Down
24 changes: 11 additions & 13 deletions lib/src/input/ontake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ use core::fmt::Debug;
use serde::{Deserialize, Serialize};

sol! {
#[derive(Debug, Default, Deserialize, Serialize)]
struct BlockParamsV2 {
address coinbase;
bytes32 parentMetaHash;
uint64 anchorBlockId; // NEW
uint64 timestamp; // NEW
uint32 blobTxListOffset; // NEW
uint32 blobTxListLength; // NEW
uint8 blobIndex; // NEW
}

#[derive(Debug, Default, Deserialize, Serialize)]
struct BlockMetadataV2 {
bytes32 anchorBlockHash; // `_l1BlockHash` in TaikoL2's anchor tx.
Expand All @@ -27,22 +38,9 @@ sol! {
uint32 blobTxListLength;
uint8 blobIndex;
uint8 basefeeAdjustmentQuotient;
uint8 basefeeSharingPctg;
uint32 gasIssuancePerSecond;
}

#[derive(Debug, Default, Deserialize, Serialize)]
struct BlockParamsV2 {
address coinbase;
bytes32 extraData;
bytes32 parentMetaHash;
uint64 anchorBlockId; // NEW
uint64 timestamp; // NEW
uint32 blobTxListOffset; // NEW
uint32 blobTxListLength; // NEW
uint8 blobIndex; // NEW
}

#[derive(Debug, Default, Deserialize, Serialize)]
event BlockProposedV2(uint256 indexed blockId, BlockMetadataV2 meta);

Expand Down
1 change: 0 additions & 1 deletion lib/src/protocol_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ impl BlockMetaDataFork {
blobTxListOffset: block_proposed_v2.meta.blobTxListOffset,
blobTxListLength: block_proposed_v2.meta.blobTxListLength,
blobIndex: block_proposed_v2.meta.blobIndex,
basefeeSharingPctg: block_proposed_v2.meta.basefeeSharingPctg,
basefeeAdjustmentQuotient: block_proposed_v2.meta.basefeeAdjustmentQuotient,
gasIssuancePerSecond: block_proposed_v2.meta.gasIssuancePerSecond,
})
Expand Down

0 comments on commit 122bc2d

Please sign in to comment.