Skip to content

Commit

Permalink
Reduce sov accounts to check nonce only (#518)
Browse files Browse the repository at this point in the history
* Reduce sov accounts to check nonce only

* Update sov-accounts call message response

* Remove sov account call message fuzz tests
  • Loading branch information
ercecan authored May 8, 2024
1 parent 7255696 commit 8be384c
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 491 deletions.
11 changes: 7 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 14 additions & 28 deletions crates/sovereign-sdk/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,21 @@ rand = "0.8"

# Sovereign-maintained dependencies.
sov-celestia-adapter = { path = "../adapters/celestia", features = ["native"] }
sov-modules-api = { path = "../module-system/sov-modules-api", features = ["arbitrary", "native"] }
sov-accounts = { path = "../module-system/module-implementations/sov-accounts", features = ["arbitrary", "native"] }
sov-bank = { path = "../module-system/module-implementations/sov-bank", features = ["native"] }
sov-modules-api = { path = "../module-system/sov-modules-api", features = [
"arbitrary",
"native",
] }
sov-accounts = { path = "../module-system/module-implementations/sov-accounts", features = [
"arbitrary",
"native",
] }
sov-bank = { path = "../module-system/module-implementations/sov-bank", features = [
"native",
] }
sov-state = { path = "../module-system/sov-state" }
sov-prover-storage-manager = { path = "../full-node/sov-prover-storage-manager", features = ["test-utils"] }
sov-prover-storage-manager = { path = "../full-node/sov-prover-storage-manager", features = [
"test-utils",
] }

# Prevent this from interfering with workspaces.
[workspace]
Expand Down Expand Up @@ -55,32 +65,8 @@ path = "fuzz_targets/bank_call.rs"
test = false
doc = false

[[bin]]
name = "accounts_call"
path = "fuzz_targets/accounts_call.rs"
test = false
doc = false

[[bin]]
name = "accounts_call_random"
path = "fuzz_targets/accounts_call_random.rs"
test = false
doc = false

[[bin]]
name = "bank_parse_call_message"
path = "fuzz_targets/bank_parse_call_message.rs"
test = false
doc = false

[[bin]]
name = "accounts_parse_call_message"
path = "fuzz_targets/accounts_parse_call_message.rs"
test = false
doc = false

[[bin]]
name = "accounts_parse_call_message_random"
path = "fuzz_targets/accounts_parse_call_message_random.rs"
test = false
doc = false
87 changes: 0 additions & 87 deletions crates/sovereign-sdk/fuzz/fuzz_targets/accounts_call.rs

This file was deleted.

26 changes: 0 additions & 26 deletions crates/sovereign-sdk/fuzz/fuzz_targets/accounts_call_random.rs

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,7 @@ use proptest::arbitrary::any;
use proptest::strategy::{BoxedStrategy, Strategy};
use sov_modules_api::{Context, Module, PrivateKey, WorkingSet};

use crate::{Account, AccountConfig, Accounts, CallMessage};

impl<'a, C> Arbitrary<'a> for CallMessage<C>
where
C: Context,
C::PrivateKey: Arbitrary<'a>,
{
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
let secret = C::PrivateKey::arbitrary(u)?;
let public = secret.pub_key();

let payload_len = u.arbitrary_len::<u8>()?;
let payload = u.bytes(payload_len)?;
let signature = secret.sign(payload);

Ok(Self::UpdatePublicKey(public, signature))
}
}

impl<C> proptest::arbitrary::Arbitrary for CallMessage<C>
where
C: Context,
C::PrivateKey: proptest::arbitrary::Arbitrary,
{
type Parameters = ();
type Strategy = BoxedStrategy<Self>;

fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
(any::<C::PrivateKey>(), any::<Vec<u8>>())
.prop_map(|(secret, payload)| {
let public = secret.pub_key();
let signature = secret.sign(&payload);
Self::UpdatePublicKey(public, signature)
})
.boxed()
}
}
use crate::{Account, AccountConfig, Accounts};

impl<'a, C> Arbitrary<'a> for Account<C>
where
Expand Down
Loading

0 comments on commit 8be384c

Please sign in to comment.