Skip to content

Commit

Permalink
origin fix
Browse files Browse the repository at this point in the history
  • Loading branch information
trajan0x committed Sep 4, 2023
1 parent f36d6d0 commit 9be03a5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ contract BondingManager is AgentManager, InterfaceBondingManager {

// ═════════════════════════════════════════ CONSTRUCTOR & INITIALIZER ═════════════════════════════════════════════

constructor(uint32 synapseDomain) MessagingBase("0.0.3", synapseDomain) {
constructor(uint32 _synapseDomain) MessagingBase("0.0.3", _synapseDomain) {

Check warning

Code scanning / Slither

Variable names too similar Warning

if (localDomain != synapseDomain) revert MustBeSynapseDomain();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ abstract contract DeployMessaging003BaseScript is DeployerUtils {
require(statementInbox != address(0), "Statement Inbox not set");
require(agentManager.code.length > 0, "Agent Manager not deployed");
constructorArgs = abi.encode(localDomain, agentManager, statementInbox);
deployment = factoryDeploy(DESTINATIONo, type(Destination).creationCode, constructorArgs);
deployment = factoryDeploy(DESTINATION, type(Destination).creationCode, constructorArgs);
}

/// @dev Initializes Destination.
Expand Down
1 change: 1 addition & 0 deletions packages/contracts-core/test/suite/Destination.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ contract DestinationTest is ExecutionHubTest {
uint32 domain = random.nextUint32();
vm.assume(domain != DOMAIN_SYNAPSE);
address caller = random.nextAddress();
vm.chainId(uint256(domain));
LightManager agentManager = new LightManager(DOMAIN_SYNAPSE);
address inbox_ = random.nextAddress();
bytes32 agentRoot = random.next();
Expand Down
4 changes: 3 additions & 1 deletion packages/contracts-core/test/suite/Origin.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {InterfaceOrigin} from "../../contracts/Origin.sol";
import {Versioned} from "../../contracts/base/Version.sol";

import {RevertingApp} from "../harnesses/client/RevertingApp.t.sol";
import {console, stdJson} from "forge-std/Script.sol";

import {fakeState, fakeSnapshot} from "../utils/libs/FakeIt.t.sol";
import {Random} from "../utils/libs/Random.t.sol";
Expand Down Expand Up @@ -58,11 +59,12 @@ contract OriginTest is AgentSecuredTest {
}

function test_cleanSetup(Random memory random) public override {
uint32 domain = random.nextUint32();
uint32 domain = uint32(block.chainid);
address caller = random.nextAddress();
address agentManager = random.nextAddress();
address inbox_ = random.nextAddress();
address gasOracle_ = address(new GasOracle(DOMAIN_SYNAPSE, random.nextAddress()));

Origin cleanContract = new Origin(DOMAIN_SYNAPSE, agentManager, inbox_, gasOracle_);
vm.prank(caller);
cleanContract.initialize();
Expand Down
9 changes: 9 additions & 0 deletions packages/contracts-core/test/utils/SynapseTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ abstract contract SynapseTest is ProductionEvents, SuiteEvents, SynapseAgents, S
setupAgentsLM();
// Skip block
skipBlock();
// cleanup the env.
vm.chainId(DOMAIN_LOCAL);

}

function setupAgentsBM() public virtual {
Expand Down Expand Up @@ -110,6 +113,7 @@ abstract contract SynapseTest is ProductionEvents, SuiteEvents, SynapseAgents, S
// ═════════════════════════════════════════════ DEPLOY CONTRACTS ══════════════════════════════════════════════════

function deployLightManager() public virtual {
vm.chainId(DOMAIN_LOCAL);
lightManager = new LightManagerHarness(DOMAIN_SYNAPSE);
vm.label(address(lightManager), "LightManager");
}
Expand All @@ -119,6 +123,7 @@ abstract contract SynapseTest is ProductionEvents, SuiteEvents, SynapseAgents, S
}

function deployBondingManager() public virtual {
vm.chainId(DOMAIN_SYNAPSE);
bondingManager = new BondingManagerHarness(DOMAIN_SYNAPSE);
vm.label(address(bondingManager), "BondingManager");
}
Expand All @@ -128,6 +133,7 @@ abstract contract SynapseTest is ProductionEvents, SuiteEvents, SynapseAgents, S
}

function deployLightInbox() public virtual {
vm.chainId(DOMAIN_LOCAL);
lightInbox = new LightInbox(DOMAIN_SYNAPSE);
}

Expand All @@ -136,6 +142,7 @@ abstract contract SynapseTest is ProductionEvents, SuiteEvents, SynapseAgents, S
}

function deployInbox() public virtual {
vm.chainId(DOMAIN_SYNAPSE);
inbox = new Inbox(DOMAIN_SYNAPSE);
}

Expand Down Expand Up @@ -223,6 +230,8 @@ abstract contract SynapseTest is ProductionEvents, SuiteEvents, SynapseAgents, S
}

function deploySummit() public virtual {
vm.chainId(DOMAIN_SYNAPSE);

uint256 option = deployMask & DEPLOY_MASK_SUMMIT;
if (option == DEPLOY_MOCK_SUMMIT) {
summit = address(new SummitMock());
Expand Down

0 comments on commit 9be03a5

Please sign in to comment.