Skip to content

Commit 48aa952

Browse files
eigmaxjackDev221
andauthored
ci: fix env (#36)
* ci: add ci * update localdb function: store_nonces (#37) * ci: change toolchain * ci: change toolchain * fix use create_place_holders (#38) * fix: clippy by `cargo clippy --fix` * fix: rpc ci * ci: add ci --------- Co-authored-by: jackDev221 <jackDev221@126.com>
1 parent 454da43 commit 48aa952

32 files changed

Lines changed: 477 additions & 540 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ on:
1010

1111
env:
1212
CARGO_TERM_COLOR: always
13-
GOAT_CHAIN_URL: https://rpc.testnet3.goat.network
14-
GOAT_GATEWAY_CONTRACT_ADDRESS: 0xeD8AeeD334fA446FA03Aa00B28aFf02FA8aC02df
15-
GOAT_GATEWAY_CONTRACT_CREATION: 0
16-
GOAT_CHAIN_ID: 48816
1713

1814
jobs:
1915
fmt:
@@ -51,6 +47,5 @@ jobs:
5147
toolchain:
5248
- nightly
5349
steps:
54-
- name: Run UTs
55-
uses: actions/checkout@v2
56-
run: cargo test -r
50+
- uses: actions/checkout@v2
51+
- 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

crates/bitvm2/src/committee/api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ pub fn push_committee_pre_signatures(
309309
graph: &mut Bitvm2Graph,
310310
signed_witness: &[Witness; COMMITTEE_PRE_SIGN_NUM],
311311
) -> Result<()> {
312-
if graph.committee_pre_signed == true {
312+
if graph.committee_pre_signed {
313313
bail!("already pre-signed by committee".to_string())
314314
};
315315
graph.take1.tx_mut().input[0].witness = signed_witness[0].clone();

crates/bitvm2/src/keys.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ impl CommitteeMasterKey {
3535
NodeMasterKey(self.0).master_keypair()
3636
}
3737
pub fn keypair_for_instance(&self, instance_id: Uuid) -> Keypair {
38-
let domain =
39-
vec![b"committee_bitvm_key".to_vec(), instance_id.as_bytes().to_vec()].concat();
38+
let domain = [b"committee_bitvm_key".to_vec(), instance_id.as_bytes().to_vec()].concat();
4039
let instance_seed = derive_secret(&self.0, &domain);
4140
generate_keypair_from_seed(instance_seed)
4241
}
@@ -45,7 +44,7 @@ impl CommitteeMasterKey {
4544
instance_id: Uuid,
4645
graph_id: Uuid,
4746
) -> [(SecNonce, PubNonce, Signature); COMMITTEE_PRE_SIGN_NUM] {
48-
let domain = vec![
47+
let domain = [
4948
b"committee_bitvm_nonces".to_vec(),
5049
instance_id.as_bytes().to_vec(),
5150
graph_id.as_bytes().to_vec(),
@@ -69,8 +68,7 @@ impl OperatorMasterKey {
6968
self.master_keypair()
7069
}
7170
pub fn wots_keypair_for_graph(&self, graph_id: Uuid) -> (WotsSecretKeys, WotsPublicKeys) {
72-
let domain =
73-
vec![b"operator_bitvm_wots_key".to_vec(), graph_id.as_bytes().to_vec()].concat();
71+
let domain = [b"operator_bitvm_wots_key".to_vec(), graph_id.as_bytes().to_vec()].concat();
7472
let wot_seed = derive_secret(&self.0, &domain);
7573
generate_wots_keys(&wot_seed)
7674
}

crates/bitvm2/src/operator/api.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pub fn sign_proof(
137137
ark_pubin: PublicInputs,
138138
wots_sec: &WotsSecretKeys,
139139
) -> Groth16WotsSignatures {
140-
generate_signatures_lit(ark_proof, ark_pubin, &ark_vkey, wots_sec.1.to_vec()).unwrap()
140+
generate_signatures_lit(ark_proof, ark_pubin, ark_vkey, wots_sec.1.to_vec()).unwrap()
141141
}
142142

143143
pub fn generate_bitvm_graph(
@@ -264,7 +264,7 @@ pub fn generate_bitvm_graph(
264264
let assert_wots_pubkeys = &params.operator_wots_pubkeys.1;
265265
let connector_d = ConnectorD::new(network, &committee_taproot_pubkey);
266266
let all_assert_commit_connectors_e =
267-
AllCommitConnectorsE::new(network, &operator_pubkey, &assert_wots_pubkeys);
267+
AllCommitConnectorsE::new(network, &operator_pubkey, assert_wots_pubkeys);
268268
let assert_init_input_0_vout: usize = 2;
269269
let assert_init_input_0 = Input {
270270
outpoint: OutPoint { txid: kickoff_txid, vout: assert_init_input_0_vout as u32 },
@@ -424,7 +424,7 @@ pub fn push_operator_pre_signature(
424424
graph: &mut Bitvm2Graph,
425425
signed_witness: &Witness,
426426
) -> Result<()> {
427-
if graph.operator_pre_signed == true {
427+
if graph.operator_pre_signed {
428428
bail!("already pre-signed by operator".to_string())
429429
};
430430
graph.challenge.tx_mut().input[0].witness = signed_witness.clone();
@@ -442,7 +442,7 @@ pub fn operator_sign_kickoff(
442442
let kickoff_wots_commitment_keys =
443443
CommitmentMessageId::pubkey_map_for_kickoff(&operator_wots_pubkeys.0);
444444
let evm_txid_inputs = WinternitzSigningInputs {
445-
message: &withdraw_evm_txid.to_vec(),
445+
message: withdraw_evm_txid.as_ref(),
446446
signing_key: &operator_wots_seckeys.0[0],
447447
};
448448
let connector_6 = Connector6::new(
@@ -508,7 +508,7 @@ pub fn operator_sign_assert(
508508
let all_assert_commit_connectors_e = AllCommitConnectorsE::new(
509509
operator_context.network,
510510
&operator_context.operator_public_key,
511-
&assert_wots_pubkeys,
511+
assert_wots_pubkeys,
512512
);
513513
graph.assert_commit.sign(&all_assert_commit_connectors_e, assert_commit_witness);
514514

crates/bitvm2/src/pegin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ pub fn check_pegin_opreturn(network: &Network, script: &Script) -> bool {
99
return false;
1010
}
1111
// Display decoded pushes
12-
let mut instructions = script.instructions();
13-
while let Some(instr) = instructions.next() {
12+
let instructions = script.instructions();
13+
for instr in instructions {
1414
match instr {
1515
Ok(script::Instruction::PushBytes(bytes)) => {
1616
println!("Data pushed: {}", hex::encode(bytes));

crates/bitvm2/src/types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ pub mod node_serializer {
259259
serde::de::Error::custom(format!("Missing groth16pk.pub.[{}]", i))
260260
})?;
261261

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

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

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

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

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

0 commit comments

Comments
 (0)