Skip to content

Commit

Permalink
lint tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tbro committed Jul 26, 2024
1 parent 0906697 commit 8a2d6c2
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion builder/src/lib.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub mod testing {
use async_trait::async_trait;
use committable::Committable;
use espresso_types::{
mock::MockStateCatchup, ChainConfig, Event, FeeAccount, L1Client, NodeState, PrivKey,
mock::MockStateCatchup, v0_3::ChainConfig, Event, FeeAccount, L1Client, NodeState, PrivKey,
PubKey, Transaction, ValidatedState,
};
use ethers::{
Expand Down
6 changes: 3 additions & 3 deletions sequencer/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ impl<T> SequencerStateDataSource for T where
mod test {
use async_compatibility_layer::logging::{setup_backtrace, setup_logging};
use espresso_types::{
validate_proposal, BlockSize, FeeAccount, FeeAccountProof, FeeAmount, FeeError, FeeInfo,
FeeMerkleProof, Leaf, ProposalValidationError,
v0_3::IterableFeeInfo, validate_proposal, BlockSize, FeeAccount, FeeAccountProof,
FeeAmount, FeeError, FeeInfo, FeeMerkleProof, Leaf, ProposalValidationError,
};
use ethers::{abi::Address, types::U256};
use hotshot_types::{
Expand Down Expand Up @@ -406,7 +406,7 @@ mod test {
ProposalValidationError::InsufficientFee {
max_block_size: instance.chain_config.max_block_size,
base_fee: instance.chain_config.base_fee,
proposed_fee: header.fee_info().amount()
proposed_fee: header.fee_info().amount().unwrap()
},
err
);
Expand Down
11 changes: 6 additions & 5 deletions types/src/reference_tests.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ use vbs::{
};

use crate::{
ChainConfig, FeeAccount, FeeInfo, Header, L1BlockInfo, NamespaceId, NsTable, Payload, SeqTypes,
Transaction, ValidatedState,
v0_3::ChainConfig, FeeAccount, FeeInfo, Header, L1BlockInfo, NamespaceId, NsTable, Payload,
SeqTypes, Transaction, ValidatedState,
};

type Serializer = vbs::Serializer<SequencerVersion>;
Expand Down Expand Up @@ -99,6 +99,7 @@ fn reference_chain_config() -> ChainConfig {
base_fee: 0.into(),
fee_contract: Some(Default::default()),
fee_recipient: Default::default(),
bid_recipient: None,
}
}

Expand Down Expand Up @@ -132,7 +133,7 @@ async fn reference_header(version: Version) -> Header {
let state = ValidatedState::default();

Header::create(
reference_chain_config().into(),
reference_chain_config(),
42,
789,
124,
Expand All @@ -142,8 +143,8 @@ async fn reference_header(version: Version) -> Header {
ns_table,
state.fee_merkle_tree.commitment(),
state.block_merkle_tree.commitment(),
fee_info,
Some(builder_signature),
vec![fee_info],
vec![builder_signature],
version,
)
}
Expand Down
2 changes: 1 addition & 1 deletion types/src/v0/impls/block/test.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use jf_vid::VidScheme;
use rand::RngCore;

use crate::{
BlockSize, ChainConfig, NamespaceId, NodeState, NsProof, Payload, Transaction, TxProof,
v0_3::ChainConfig, BlockSize, NamespaceId, NodeState, NsProof, Payload, Transaction, TxProof,
ValidatedState,
};

Expand Down
6 changes: 3 additions & 3 deletions types/src/v0/impls/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1634,7 +1634,7 @@ mod test_headers {
let (fee_account, _) = FeeAccount::generated_from_seed_indexed([0; 32], 0);

let v1_header = Header::create(
genesis.instance_state.chain_config.into(),
genesis.instance_state.chain_config,
1,
2,
3,
Expand All @@ -1657,7 +1657,7 @@ mod test_headers {
assert_eq!(v1_header, deserialized);

let v2_header = Header::create(
genesis.instance_state.chain_config.into(),
genesis.instance_state.chain_config,
1,
2,
3,
Expand All @@ -1680,7 +1680,7 @@ mod test_headers {
assert_eq!(v2_header, deserialized);

let v3_header = Header::create(
genesis.instance_state.chain_config.into(),
genesis.instance_state.chain_config,
1,
2,
3,
Expand Down
9 changes: 8 additions & 1 deletion types/src/v0/impls/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,9 +747,16 @@ mod test {

use super::*;
use crate::{
v0::impls::auction::mock_full_network_txs, BlockSize, FeeAccountProof, FeeMerkleProof,
eth_signature_key::EthKeyPair, v0_3::BidTx, BlockSize, FeeAccountProof, FeeMerkleProof,
};

pub fn mock_full_network_txs(key: Option<EthKeyPair>) -> Vec<FullNetworkTx> {
// if no key is supplied, use `test_key_pair`. Since default `BidTxBody` is
// signed with `test_key_pair`, it will verify successfully
let key = key.unwrap_or_else(FeeAccount::test_key_pair);
vec![FullNetworkTx::Bid(BidTx::mock(key))]
}

#[test]
fn test_apply_full_tx() {
let mut state = ValidatedState::default();
Expand Down

0 comments on commit 8a2d6c2

Please sign in to comment.