Skip to content

Commit

Permalink
draft mythril cd
Browse files Browse the repository at this point in the history
  • Loading branch information
dnkolegov committed Feb 15, 2024
1 parent 7fbfe9a commit 0fb3b15
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 2 deletions.
Empty file.
4 changes: 2 additions & 2 deletions contracts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ slither:
slither . --config-file ./slither.config.json

check-gateway:
docker run --rm -v $(shell pwd):/app -w /app mythril/myth:latest -v4 analyze --solc-json remappings.json ./src/Gateway.sol --solv 0.8.19
docker run --rm -v $(shell pwd):/app -w /app mythril/myth:latest -v4 analyze --solc-json remappings.json ./test/invariants/handlers/GatewayActorFacade.sol --solv 0.8.19

check-subnet:
docker run --rm -v $(shell pwd):/app -w /app mythril/myth:latest -v4 analyze --solc-json remappings.json ./src/SubnetActor.sol --solv 0.8.19
docker run --rm -v $(shell pwd):/app -w /app mythril/myth:latest -v4 analyze --solc-json remappings.json ./src/SubnetActorDiamond.sol --solv 0.8.19

# ==============================================================================
# Development support
Expand Down
59 changes: 59 additions & 0 deletions contracts/test/invariants/handlers/GatewayActorFacade.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity 0.8.19;

import "forge-std/StdUtils.sol";
import "forge-std/StdCheats.sol";
import {CommonBase} from "forge-std/Base.sol";
import {FvmAddress} from "../../../src/structs/FvmAddress.sol";
import {SubnetID} from "../../../src/structs/Subnet.sol";
import {GatewayDiamond} from "../../../src/GatewayDiamond.sol";
import {GatewayManagerFacet} from "../../../src/gateway/GatewayManagerFacet.sol";
import {EnumerableSet} from "openzeppelin-contracts/utils/structs/EnumerableSet.sol";

uint256 constant ETH_SUPPLY = 129_590_000 ether;

contract GatewayActorFacade is CommonBase, StdCheats, StdUtils {
GatewayManagerFacet managerFacet;

uint256 private constant DEFAULT_MIN_VALIDATOR_STAKE = 10 ether;

constructor(GatewayDiamond _gw) {
managerFacet = GatewayManagerFacet(address(_gw));

deal(address(this), ETH_SUPPLY);
}

function register(uint256 amount) external payable {
managerFacet.register(amount);
}

function addStake() external payable {
managerFacet.addStake();
}

function releaseStake(uint256 amount) external {
managerFacet.releaseStake(amount);
}

function kill() external {
managerFacet.kill();
}

function fund(SubnetID calldata subnetId, FvmAddress calldata to) external payable {
managerFacet.fund(subnetId, to);
}

function fundWithToken(SubnetID calldata subnetId, FvmAddress calldata to, uint256 amount) external {
managerFacet.fundWithToken(subnetId, to, amount);
}

function release(FvmAddress calldata to) external payable {
managerFacet.release(to);
}

function forward(address callee, bytes calldata _data) public {
callee.delegatecall(_data);
}

receive() external payable {}
}

0 comments on commit 0fb3b15

Please sign in to comment.