Skip to content

Commit

Permalink
Merge pull request #16 from rainlanguage/2024-10-15-legals
Browse files Browse the repository at this point in the history
add legal to ci
  • Loading branch information
thedavidmeister authored Oct 15, 2024
2 parents 0b07395 + 0bdf9a0 commit fef6918
Show file tree
Hide file tree
Showing 17 changed files with 261 additions and 102 deletions.
12 changes: 0 additions & 12 deletions .devcontainer.json

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/rainix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
task: [rainix-sol-test, rainix-sol-static]
task: [rainix-sol-test, rainix-sol-static, rainix-sol-legal]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
Expand All @@ -21,11 +21,11 @@ jobs:
uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2

- run: nix develop --command rainix-sol-prelude
- run: nix develop -c rainix-sol-prelude

- name: Run ${{ matrix.task }}
env:
ETH_RPC_URL: ${{ secrets.CI_DEPLOY_RPC_URL }}
ETHERSCAN_API_KEY: ${{ secrets.EXPLORER_VERIFICATION_KEY }}
DEPLOY_VERIFIER: 'etherscan'
run: nix develop --command ${{ matrix.task }}
run: nix develop -c ${{ matrix.task }}
5 changes: 1 addition & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/rain.extrospection"]
path = lib/rain.extrospection
url = https://github.com/rainprotocol/rain.extrospection
[submodule "lib/rain.interpreter.interface"]
path = lib/rain.interpreter.interface
url = https://github.com/rainlanguage/rain.interpreter.interface
url = https://github.com/rainlanguage/rain.extrospection
1 change: 1 addition & 0 deletions LICENSE
189 changes: 189 additions & 0 deletions LICENSES/LicenseRef-DCL-1.0.txt

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version = 1

[[annotations]]
path = [
".gas-snapshot",
".github/workflows/**/",
".vscode/**/",
".gitignore",
".gitmodules",
"README.md",
"flake.lock",
"flake.nix",
"foundry.toml",
"slither.config.json",
"REUSE.toml"
]
SPDX-FileCopyrightText = "Copyright (c) 2020 thedavidmeister"
SPDX-License-Identifier = "LicenseRef-DCL-1.0"
72 changes: 19 additions & 53 deletions flake.lock

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

1 change: 0 additions & 1 deletion lib/rain.interpreter.interface
Submodule rain.interpreter.interface deleted from 7a7825
3 changes: 2 additions & 1 deletion script/Deploy.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: CAL
// SPDX-License-Identifier: LicenseRef-DCL-1.0
// SPDX-FileCopyrightText: Copyright (c) 2020 thedavidmeister
pragma solidity =0.8.25;

import {Script} from "forge-std/Script.sol";
Expand Down
6 changes: 4 additions & 2 deletions src/concrete/CloneFactory.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: CAL
// SPDX-License-Identifier: LicenseRef-DCL-1.0
// SPDX-FileCopyrightText: Copyright (c) 2020 thedavidmeister
pragma solidity =0.8.25;

import {ICloneableV2, ICLONEABLE_V2_SUCCESS} from "../interface/ICloneableV2.sol";
Expand Down Expand Up @@ -30,7 +31,8 @@ contract CloneFactory is ICloneableFactoryV2 {
// Standard Open Zeppelin clone here.
address child = Clones.clone(implementation);
// NewClone does NOT include the data passed to initialize.
// The implementation is responsible for emitting an event if it wants.
// The implementation is responsible for emitting a data event if it
// wants.
emit NewClone(msg.sender, implementation, child);
// Checking the return value of initialize is mandatory as per
// ICloneableFactoryV2.
Expand Down
3 changes: 2 additions & 1 deletion src/interface/ICloneableFactoryV2.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: CAL
// SPDX-License-Identifier: LicenseRef-DCL-1.0
// SPDX-FileCopyrightText: Copyright (c) 2020 thedavidmeister
pragma solidity ^0.8.18;

/// @title ICloneableFactoryV2
Expand Down
3 changes: 2 additions & 1 deletion src/interface/ICloneableV2.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: CAL
// SPDX-License-Identifier: LicenseRef-DCL-1.0
// SPDX-FileCopyrightText: Copyright (c) 2020 thedavidmeister
pragma solidity ^0.8.18;

/// @dev This hash MUST be returned when an `ICloneableV2` is successfully
Expand Down
3 changes: 2 additions & 1 deletion src/interface/deprecated/ICloneableFactoryV1.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: CAL
// SPDX-License-Identifier: LicenseRef-DCL-1.0
// SPDX-FileCopyrightText: Copyright (c) 2020 thedavidmeister
pragma solidity ^0.8.18;

/// @title ICloneableFactoryV1
Expand Down
3 changes: 2 additions & 1 deletion src/interface/deprecated/ICloneableV1.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: CAL
// SPDX-License-Identifier: LicenseRef-DCL-1.0
// SPDX-FileCopyrightText: Copyright (c) 2020 thedavidmeister
pragma solidity ^0.8.18;

/// @title ICloneableV1
Expand Down
11 changes: 6 additions & 5 deletions src/interface/deprecated/IFactory.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: CAL
// SPDX-License-Identifier: LicenseRef-DCL-1.0
// SPDX-FileCopyrightText: Copyright (c) 2020 thedavidmeister
pragma solidity ^0.8.18;

interface IFactory {
Expand All @@ -18,18 +19,18 @@ interface IFactory {

/// Creates a new child contract.
///
/// @param data_ Domain specific data for the child contract constructor.
/// @param data Domain specific data for the child contract constructor.
/// @return New child contract address.
function createChild(bytes calldata data_) external returns (address);
function createChild(bytes calldata data) external returns (address);

/// Checks if address is registered as a child contract of this factory.
///
/// Addresses that were not deployed by `createChild` MUST NOT return
/// `true` from `isChild`. This is CRITICAL to the security guarantees for
/// any contract implementing `IFactory`.
///
/// @param maybeChild_ Address to check registration for.
/// @param maybeChild Address to check registration for.
/// @return `true` if address was deployed by this contract factory,
/// otherwise `false`.
function isChild(address maybeChild_) external view returns (bool);
function isChild(address maybeChild) external view returns (bool);
}
7 changes: 0 additions & 7 deletions src/lib/LibIERC1820.sol

This file was deleted.

20 changes: 10 additions & 10 deletions test/concrete/CloneFactory.t.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: CAL
// SPDX-License-Identifier: LicenseRef-DCL-1.0
// SPDX-FileCopyrightText: Copyright (c) 2020 thedavidmeister
pragma solidity =0.8.25;

import {Test, Vm, console2} from "forge-std/Test.sol";

import {LibExtrospectERC1167Proxy} from "rain.extrospection/src/lib/LibExtrospectERC1167Proxy.sol";
import {ICloneableV2, ICLONEABLE_V2_SUCCESS} from "src/interface/ICloneableV2.sol";
import {CloneFactory, ZeroImplementationCodeSize, InitializationFailed} from "src/concrete/CloneFactory.sol";
import {IExpressionDeployerV3} from "rain.interpreter.interface/interface/unstable/IExpressionDeployerV3.sol";

/// @title TestCloneable
/// @notice A cloneable contract that implements `ICloneableV2`. Initializes
Expand Down Expand Up @@ -39,11 +39,11 @@ contract TestCloneableFailure is ICloneableV2 {
contract CloneFactoryCloneTest is Test {
/// The `CloneFactory` instance under test. As `CloneFactory` is
/// stateless, we can reuse the same instance for all tests.
CloneFactory internal immutable _iCloneFactory;
CloneFactory internal immutable iCloneFactory;

/// Construct a new `CloneFactory` instance for testing.
constructor() {
_iCloneFactory = new CloneFactory();
iCloneFactory = new CloneFactory();
}

/// The bytecode of the implementation contract is irrelevant to the child.
Expand All @@ -52,7 +52,7 @@ contract CloneFactoryCloneTest is Test {
function testCloneBytecode(bytes memory data) external {
TestCloneable implementation = new TestCloneable();

address child = _iCloneFactory.clone(address(implementation), data);
address child = iCloneFactory.clone(address(implementation), data);

(bool result, address proxyImplementation) = LibExtrospectERC1167Proxy.isERC1167Proxy(child.code);
assertEq(result, true);
Expand All @@ -63,7 +63,7 @@ contract CloneFactoryCloneTest is Test {
function testCloneInitializeData(bytes memory data) external {
TestCloneable implementation = new TestCloneable();

address child = _iCloneFactory.clone(address(implementation), data);
address child = iCloneFactory.clone(address(implementation), data);
assertEq(TestCloneable(child).sData(), data);
}

Expand All @@ -73,7 +73,7 @@ contract CloneFactoryCloneTest is Test {
TestCloneable implementation = new TestCloneable();

vm.recordLogs();
address child = _iCloneFactory.clone(address(implementation), data);
address child = iCloneFactory.clone(address(implementation), data);
Vm.Log[] memory entries = vm.getRecordedLogs();

assertEq(entries.length, 1);
Expand All @@ -86,7 +86,7 @@ contract CloneFactoryCloneTest is Test {
/// for unrelated reasons so we can't directly assert the error message.
function testCloneUninitializableFails(address implementation, bytes memory data) external {
vm.expectRevert();
_iCloneFactory.clone(implementation, data);
iCloneFactory.clone(implementation, data);
}

/// In the case an implementation is initialized but returns a failure code,
Expand All @@ -96,13 +96,13 @@ contract CloneFactoryCloneTest is Test {
TestCloneableFailure implementation = new TestCloneableFailure();

vm.expectRevert(abi.encodeWithSelector(InitializationFailed.selector));
_iCloneFactory.clone(address(implementation), abi.encode(notSuccess));
iCloneFactory.clone(address(implementation), abi.encode(notSuccess));
}

/// If the implementation has zero code size then this is always an error.
function testZeroImplementationCodeSizeError(address implementation, bytes memory data) public {
vm.assume(implementation.code.length == 0);
vm.expectRevert(abi.encodeWithSelector(ZeroImplementationCodeSize.selector));
_iCloneFactory.clone(implementation, data);
iCloneFactory.clone(implementation, data);
}
}

0 comments on commit fef6918

Please sign in to comment.