Skip to content

Commit

Permalink
linter suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
dubbelosix committed Aug 28, 2023
1 parent 50ccc10 commit d46766d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
6 changes: 3 additions & 3 deletions examples/demo-stf/src/tests/da_simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ pub fn simulate_da_with_revert_msg() -> Vec<RawTx> {
}

pub fn simulate_da_with_bad_sig() -> Vec<RawTx> {
let b = BadSignatureBankCallMessages::new();
let b: BadSignatureBankCallMessages = Default::default();
b.create_raw_txs::<Runtime<C>>()
}

pub fn simulate_da_with_bad_nonce() -> Vec<RawTx> {
let b = BadNonceBankCallMessages::new();
let b: BadNonceBankCallMessages = Default::default();
b.create_raw_txs::<Runtime<C>>()
}

pub fn simulate_da_with_bad_serialization() -> Vec<RawTx> {
let b = BadSerializationBankCallMessages::new();
let b: BadSerializationBankCallMessages = Default::default();
b.create_raw_txs::<Runtime<C>>()
}
1 change: 0 additions & 1 deletion examples/demo-stf/src/tests/tx_revert_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ fn test_tx_bad_nonce() {

assert_eq!(1, apply_block_result.batch_receipts.len());
let tx_receipts = apply_block_result.batch_receipts[0].tx_receipts.clone();

// Bad nonce means that the transaction has to be reverted
assert_eq!(tx_receipts[0].receipt, TxEffect::Reverted);

Expand Down
24 changes: 21 additions & 3 deletions module-system/utils/sov-data-generators/src/bank_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ impl BadSerializationBankCallMessages {
}
}

impl Default for BadSerializationBankCallMessages {
fn default() -> Self {
Self::new()
}
}

impl MessageGenerator for BadSerializationBankCallMessages {
type Module = Bank<DefaultContext>;
type Context = DefaultContext;
Expand All @@ -203,7 +209,7 @@ impl MessageGenerator for BadSerializationBankCallMessages {
Rc::new(DefaultPrivateKey::from_hex(DEFAULT_PVT_KEY).unwrap()),
CallMessage::CreateToken {
salt,
token_name: token_name.clone(),
token_name,
initial_balance: 1000,
minter_address,
authorized_minters: Vec::from([minter_address]),
Expand Down Expand Up @@ -250,6 +256,12 @@ impl BadSignatureBankCallMessages {
}
}

impl Default for BadSignatureBankCallMessages {
fn default() -> Self {
Self::new()
}
}

impl MessageGenerator for BadSignatureBankCallMessages {
type Module = Bank<DefaultContext>;
type Context = DefaultContext;
Expand All @@ -264,7 +276,7 @@ impl MessageGenerator for BadSignatureBankCallMessages {
Rc::new(DefaultPrivateKey::from_hex(DEFAULT_PVT_KEY).unwrap()),
CallMessage::CreateToken {
salt,
token_name: token_name.clone(),
token_name,
initial_balance: 1000,
minter_address,
authorized_minters: Vec::from([minter_address]),
Expand Down Expand Up @@ -305,6 +317,12 @@ impl BadNonceBankCallMessages {
}
}

impl Default for BadNonceBankCallMessages {
fn default() -> Self {
Self::new()
}
}

impl MessageGenerator for BadNonceBankCallMessages {
type Module = Bank<DefaultContext>;
type Context = DefaultContext;
Expand All @@ -319,7 +337,7 @@ impl MessageGenerator for BadNonceBankCallMessages {
Rc::new(DefaultPrivateKey::from_hex(DEFAULT_PVT_KEY).unwrap()),
CallMessage::CreateToken {
salt,
token_name: token_name.clone(),
token_name,
initial_balance: 1000,
minter_address,
authorized_minters: Vec::from([minter_address]),
Expand Down

0 comments on commit d46766d

Please sign in to comment.