Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ MULTISIG_OWNER_2_TESTNET=<owner2_address>
MULTISIG_OWNER_3_TESTNET=<owner3_address>
MULTISIG_OWNER_4_TESTNET=<owner4_address>
MULTISIG_OWNER_5_TESTNET=<owner5_address>

# Differential network configuration
DIFF_NETWORK=<mainnet|testnet|both>
50 changes: 50 additions & 0 deletions script/HelperConfig.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import {Script} from "lib/forge-std/src/Script.sol";
import {BridgeMock} from "../src/test-contracts/BridgeMock.sol";

contract HelperConfig is Script {
struct DifferentialNetworkConfig {
string networkKey;
bool mainnet;
uint256 pinBlock;
uint256 btcBlockTime;
}

struct NetworkConfig {
address bridge;
uint256 minimumCollateral;
Expand Down Expand Up @@ -258,4 +265,47 @@ contract HelperConfig is Script {
adminDelay: uint48(vm.envOr("ADMIN_DELAY_LOCAL", uint256(0)))
});
}

/// @notice Resolve single-network config for differential tests.
/// @dev DIFF_NETWORK supports only "mainnet" or "testnet" to keep
/// differential suites network-agnostic and backed by one active harness.
function getDifferentialNetworkConfig()
external
view
returns (DifferentialNetworkConfig memory)
{
string memory mode = vm.envOr("DIFF_NETWORK", string("mainnet"));
bytes32 modeHash = keccak256(bytes(mode));
if (
modeHash == keccak256(bytes("mainnet")) ||
modeHash == keccak256(bytes("MAINNET"))
) {
return
DifferentialNetworkConfig({
networkKey: "rskMainnet",
mainnet: true,
pinBlock: vm.envOr("DIFF_MAINNET_BLOCK", uint256(0)),
btcBlockTime: vm.envOr(
"DIFF_BTC_BLOCK_TIME_MAINNET",
uint256(600)
)
});
}
if (
modeHash == keccak256(bytes("testnet")) ||
modeHash == keccak256(bytes("TESTNET"))
) {
return
DifferentialNetworkConfig({
networkKey: "rskTestnet",
mainnet: false,
pinBlock: vm.envOr("DIFF_TESTNET_BLOCK", uint256(0)),
btcBlockTime: vm.envOr(
"DIFF_BTC_BLOCK_TIME_TESTNET",
uint256(600)
)
});
}
revert("DIFF_NETWORK must be mainnet|testnet");
}
}
10 changes: 10 additions & 0 deletions script/deployment/DeployFlyover.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ contract DeployFlyover is Script {
return d;
}

/// @notice Test-only helper to deploy without broadcast/env key lookup.
/// @dev Reuses the same deployment and role wiring logic as run().
function deployForTesting(
address defaultAdmin,
HelperConfig.FlyoverConfig memory cfg
) external returns (FlyoverDeployment memory d) {
d = _deployAll(defaultAdmin, cfg);
_setupRoles(d);
}

function _deployAll(
address defaultAdmin,
HelperConfig.FlyoverConfig memory cfg
Expand Down
Loading
Loading