Skip to content
Merged
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
9 changes: 2 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ on:

env:
CARGO_TERM_COLOR: always
GOAT_CHAIN_URL: https://rpc.testnet3.goat.network
GOAT_GATEWAY_CONTRACT_ADDRESS: 0xeD8AeeD334fA446FA03Aa00B28aFf02FA8aC02df
GOAT_GATEWAY_CONTRACT_CREATION: 0
GOAT_CHAIN_ID: 48816

jobs:
fmt:
Expand Down Expand Up @@ -51,6 +47,5 @@ jobs:
toolchain:
- nightly
steps:
- name: Run UTs
uses: actions/checkout@v2
run: cargo test -r
- uses: actions/checkout@v2
- run: GOAT_CHAIN_URL=https://rpc.testnet3.goat.network GOAT_GATEWAY_CONTRACT_ADDRESS=0xeD8AeeD334fA446FA03Aa00B28aFf02FA8aC02df GOAT_GATEWAY_CONTRACT_CREATION=0 GOAT_CHAIN_ID=48816 cargo test -r
2 changes: 1 addition & 1 deletion crates/bitvm2/src/committee/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ pub fn push_committee_pre_signatures(
graph: &mut Bitvm2Graph,
signed_witness: &[Witness; COMMITTEE_PRE_SIGN_NUM],
) -> Result<()> {
if graph.committee_pre_signed == true {
if graph.committee_pre_signed {
bail!("already pre-signed by committee".to_string())
};
graph.take1.tx_mut().input[0].witness = signed_witness[0].clone();
Expand Down
8 changes: 3 additions & 5 deletions crates/bitvm2/src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ impl CommitteeMasterKey {
NodeMasterKey(self.0).master_keypair()
}
pub fn keypair_for_instance(&self, instance_id: Uuid) -> Keypair {
let domain =
vec![b"committee_bitvm_key".to_vec(), instance_id.as_bytes().to_vec()].concat();
let domain = [b"committee_bitvm_key".to_vec(), instance_id.as_bytes().to_vec()].concat();
let instance_seed = derive_secret(&self.0, &domain);
generate_keypair_from_seed(instance_seed)
}
Expand All @@ -45,7 +44,7 @@ impl CommitteeMasterKey {
instance_id: Uuid,
graph_id: Uuid,
) -> [(SecNonce, PubNonce, Signature); COMMITTEE_PRE_SIGN_NUM] {
let domain = vec![
let domain = [
b"committee_bitvm_nonces".to_vec(),
instance_id.as_bytes().to_vec(),
graph_id.as_bytes().to_vec(),
Expand All @@ -69,8 +68,7 @@ impl OperatorMasterKey {
self.master_keypair()
}
pub fn wots_keypair_for_graph(&self, graph_id: Uuid) -> (WotsSecretKeys, WotsPublicKeys) {
let domain =
vec![b"operator_bitvm_wots_key".to_vec(), graph_id.as_bytes().to_vec()].concat();
let domain = [b"operator_bitvm_wots_key".to_vec(), graph_id.as_bytes().to_vec()].concat();
let wot_seed = derive_secret(&self.0, &domain);
generate_wots_keys(&wot_seed)
}
Expand Down
10 changes: 5 additions & 5 deletions crates/bitvm2/src/operator/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub fn sign_proof(
ark_pubin: PublicInputs,
wots_sec: &WotsSecretKeys,
) -> Groth16WotsSignatures {
generate_signatures_lit(ark_proof, ark_pubin, &ark_vkey, wots_sec.1.to_vec()).unwrap()
generate_signatures_lit(ark_proof, ark_pubin, ark_vkey, wots_sec.1.to_vec()).unwrap()
}

pub fn generate_bitvm_graph(
Expand Down Expand Up @@ -264,7 +264,7 @@ pub fn generate_bitvm_graph(
let assert_wots_pubkeys = &params.operator_wots_pubkeys.1;
let connector_d = ConnectorD::new(network, &committee_taproot_pubkey);
let all_assert_commit_connectors_e =
AllCommitConnectorsE::new(network, &operator_pubkey, &assert_wots_pubkeys);
AllCommitConnectorsE::new(network, &operator_pubkey, assert_wots_pubkeys);
let assert_init_input_0_vout: usize = 2;
let assert_init_input_0 = Input {
outpoint: OutPoint { txid: kickoff_txid, vout: assert_init_input_0_vout as u32 },
Expand Down Expand Up @@ -424,7 +424,7 @@ pub fn push_operator_pre_signature(
graph: &mut Bitvm2Graph,
signed_witness: &Witness,
) -> Result<()> {
if graph.operator_pre_signed == true {
if graph.operator_pre_signed {
bail!("already pre-signed by operator".to_string())
};
graph.challenge.tx_mut().input[0].witness = signed_witness.clone();
Expand All @@ -442,7 +442,7 @@ pub fn operator_sign_kickoff(
let kickoff_wots_commitment_keys =
CommitmentMessageId::pubkey_map_for_kickoff(&operator_wots_pubkeys.0);
let evm_txid_inputs = WinternitzSigningInputs {
message: &withdraw_evm_txid.to_vec(),
message: withdraw_evm_txid.as_ref(),
signing_key: &operator_wots_seckeys.0[0],
};
let connector_6 = Connector6::new(
Expand Down Expand Up @@ -508,7 +508,7 @@ pub fn operator_sign_assert(
let all_assert_commit_connectors_e = AllCommitConnectorsE::new(
operator_context.network,
&operator_context.operator_public_key,
&assert_wots_pubkeys,
assert_wots_pubkeys,
);
graph.assert_commit.sign(&all_assert_commit_connectors_e, assert_commit_witness);

Expand Down
4 changes: 2 additions & 2 deletions crates/bitvm2/src/pegin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pub fn check_pegin_opreturn(network: &Network, script: &Script) -> bool {
return false;
}
// Display decoded pushes
let mut instructions = script.instructions();
while let Some(instr) = instructions.next() {
let instructions = script.instructions();
for instr in instructions {
match instr {
Ok(script::Instruction::PushBytes(bytes)) => {
println!("Data pushed: {}", hex::encode(bytes));
Expand Down
6 changes: 3 additions & 3 deletions crates/bitvm2/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ pub mod node_serializer {
serde::de::Error::custom(format!("Missing groth16pk.pub.[{}]", i))
})?;

if v.len() != W256_LEN as usize {
if v.len() != W256_LEN {
return Err(serde::de::Error::custom("Invalid wots public-key length"));
};

Expand All @@ -285,7 +285,7 @@ pub mod node_serializer {
serde::de::Error::custom(format!("Missing groth16pk.wot256.[{}]", i))
})?;

if v.len() != W256_LEN as usize {
if v.len() != W256_LEN {
return Err(serde::de::Error::custom("Invalid wots public-key length"));
};

Expand All @@ -311,7 +311,7 @@ pub mod node_serializer {
serde::de::Error::custom(format!("Missing groth16pk.wothash.[{}]", i))
})?;

if v.len() != WHASH_LEN as usize {
if v.len() != WHASH_LEN {
return Err(serde::de::Error::custom("Invalid wots public-key length"));
};

Expand Down
Loading
Loading