Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
klkvr committed May 13, 2024
1 parent 7eeb7ed commit d9820a1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
7 changes: 2 additions & 5 deletions crates/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use foundry_compilers::{
};
use inflector::Inflector;
use regex::Regex;
use revm_primitives::{fixed_bytes, FixedBytes, SpecId};
use revm_primitives::{FixedBytes, SpecId};
use semver::Version;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::{
Expand Down Expand Up @@ -454,10 +454,7 @@ impl Config {
pub const DEFAULT_SENDER: Address = address!("1804c8AB1F12E6bbf3894d4083f33e07309d1f38");

/// Default salt for create2 library deployments
///
/// cast keccak 'foundry create2'
pub const DEFAULT_CREATE2_LIBRARY_SALT: FixedBytes<32> =
fixed_bytes!("19bf59b7b67ae8edcbc6e53616080f61fa99285c061450ad601b0bc40c9adfc9");
pub const DEFAULT_CREATE2_LIBRARY_SALT: FixedBytes<32> = FixedBytes::<32>::ZERO;

/// Returns the current `Config`
///
Expand Down
29 changes: 29 additions & 0 deletions crates/forge/tests/cli/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1422,3 +1422,32 @@ forgetest_async!(can_deploy_library_create2, |prj, cmd| {
.assert_nonce_increment(&[(0, 1), (1, 1)])
.await;
});

// Asserts that running the same script twice only deploys library once when using different
// senders.
forgetest_async!(can_deploy_library_create2_different_sender, |prj, cmd| {
let (_api, handle) = spawn(NodeConfig::test()).await;

let mut tester = ScriptTester::new_broadcast(cmd, &handle.http_endpoint(), prj.root());

tester
.load_private_keys(&[0, 1])
.await
.add_sig("BroadcastTest", "deploy()")
.simulate(ScriptOutcome::OkSimulation)
.broadcast(ScriptOutcome::OkBroadcast)
.assert_nonce_increment(&[(0, 2), (1, 1)])
.await;

tester.clear();

// Run different script from the same contract (which requires the same library).
tester
.load_private_keys(&[2])
.await
.add_sig("BroadcastTest", "deployNoArgs()")
.simulate(ScriptOutcome::OkSimulation)
.broadcast(ScriptOutcome::OkBroadcast)
.assert_nonce_increment(&[(2, 2)])
.await;
});

0 comments on commit d9820a1

Please sign in to comment.