forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init: integration tests (ethereum-optimism#344)
Co-authored-by: Javed Khan <tuxcanfly@gmail.com>
- Loading branch information
Showing
21 changed files
with
9,772 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Devnet integration tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'staging' | ||
- 'feat/*' | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
compose-devnet: | ||
runs-on: ubuntu-latest | ||
name: Run integration tests on devnet | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
cache: 'yarn' | ||
|
||
- run: | | ||
curl -L -o /tmp/foundry.tgz https://github.com/gakonst/foundry/releases/download/nightly-9c2469488c6872e5d17198555f7d8e1a80173151/foundry_nightly_linux_amd64.tar.gz | ||
tar -xzvf /tmp/foundry.tgz | ||
mv forge /usr/local/bin | ||
mv cast /usr/local/bin | ||
name: Install forge | ||
- run: cd packages/contracts && yarn install && yarn build | ||
- run: cd packages/integration-tests && yarn install && yarn build:contracts | ||
|
||
- run: make devnet-up | ||
name: Bring up the stack | ||
|
||
- run: sleep 10 && docker ps && make integration-tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,7 @@ bin | |
|
||
# vim swap files | ||
*.sw* | ||
|
||
integration-tests/cache/ | ||
integration-tests/artifacts/ | ||
**/*.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
artifacts | ||
cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
pragma solidity ^0.8.10; | ||
|
||
contract Counter { | ||
uint256 public value = 0; | ||
|
||
constructor() {} | ||
|
||
function getValue() public view returns (uint256) { | ||
return value; | ||
} | ||
|
||
function incValue() public { | ||
value++; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.9; | ||
|
||
contract ERC20 { | ||
event Transfer(address indexed _from, address indexed _to, uint256 _value); | ||
event Approval(address indexed _owner, address indexed _spender, uint256 _value); | ||
|
||
uint256 constant private MAX_UINT256 = 2**256 - 1; | ||
mapping (address => uint256) public balances; | ||
mapping (address => mapping (address => uint256)) public allowed; | ||
/* | ||
NOTE: | ||
The following variables are OPTIONAL vanities. One does not have to include them. | ||
They allow one to customise the token contract & in no way influences the core functionality. | ||
Some wallets/interfaces might not even bother to look at this information. | ||
*/ | ||
string public name; //fancy name: eg OVM Coin | ||
uint8 public decimals; //How many decimals to show. | ||
string public symbol; //An identifier: eg OVM | ||
uint256 public totalSupply; | ||
|
||
constructor( | ||
uint256 _initialAmount, | ||
string memory _tokenName, | ||
uint8 _decimalUnits, | ||
string memory _tokenSymbol | ||
) public { | ||
balances[msg.sender] = _initialAmount; // Give the creator all initial tokens | ||
totalSupply = _initialAmount; // Update total supply | ||
name = _tokenName; // Set the name for display purposes | ||
decimals = _decimalUnits; // Amount of decimals for display purposes | ||
symbol = _tokenSymbol; // Set the symbol for display purposes | ||
} | ||
|
||
function transfer(address _to, uint256 _value) public returns (bool success) { | ||
require(balances[msg.sender] >= _value, "insufficient balance"); | ||
balances[msg.sender] -= _value; | ||
balances[_to] += _value; | ||
emit Transfer(msg.sender, _to, _value); | ||
return true; | ||
} | ||
|
||
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { | ||
uint256 allowance = allowed[_from][msg.sender]; | ||
require(balances[_from] >= _value && allowance >= _value, "bad allowance"); | ||
balances[_to] += _value; | ||
balances[_from] -= _value; | ||
if (allowance < MAX_UINT256) { | ||
allowed[_from][msg.sender] -= _value; | ||
} | ||
emit Transfer(_from, _to, _value); | ||
return true; | ||
} | ||
|
||
function balanceOf(address _owner) public view returns (uint256 balance) { | ||
return balances[_owner]; | ||
} | ||
|
||
function approve(address _spender, uint256 _value) public returns (bool success) { | ||
allowed[msg.sender][_spender] = _value; | ||
emit Approval(msg.sender, _spender, _value); | ||
return true; | ||
} | ||
|
||
function allowance(address _owner, address _spender) public view returns (uint256 remaining) { | ||
return allowed[_owner][_spender]; | ||
} | ||
|
||
function destroy() public { | ||
selfdestruct(payable(msg.sender)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
pragma solidity 0.8.10; | ||
|
||
interface DepositFeed { | ||
function depositTransaction( | ||
address _to, | ||
uint256 _value, | ||
uint256 _gasLimit, | ||
bool _isCreation, | ||
bytes memory _data | ||
) external payable; | ||
} | ||
|
||
contract MultiDepositor { | ||
DepositFeed df = DepositFeed(0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001); | ||
|
||
function deposit(address to) external payable { | ||
for (uint i = 0; i < 3; i++) { | ||
df.depositTransaction{ value: 1000000000 }( | ||
to, | ||
1000, | ||
3000000, | ||
false, | ||
"" | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
pragma solidity 0.8.10; | ||
|
||
contract Reverter { | ||
string constant public revertMessage = "This is a simple reversion."; | ||
|
||
function doRevert() public pure { | ||
revert(revertMessage); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{ | ||
"private": true, | ||
"name": "@eth-optimism/integration-tests", | ||
"version": "0.5.9", | ||
"description": "[Optimism] Integration tests", | ||
"scripts": { | ||
"lint": "yarn lint:fix && yarn lint:check", | ||
"lint:fix": "yarn lint:check --fix", | ||
"lint:check": "eslint . --max-warnings=0", | ||
"build:contracts": "forge build --root . -c contracts -o artifacts", | ||
"test": "ts-mocha --timeout 30000 test/**/*.spec.ts", | ||
"test:actor": "IS_LIVE_NETWORK=true ts-node actor-tests/lib/runner.ts", | ||
"test:integration:live": "NO_NETWORK=true IS_LIVE_NETWORK=true hardhat --network optimism test", | ||
"clean": "rimraf cache artifacts", | ||
"pre-commit": "lint-staged" | ||
}, | ||
"keywords": [ | ||
"optimism", | ||
"ethereum", | ||
"integration", | ||
"tests" | ||
], | ||
"homepage": "https://github.com/ethereum-optimism/optimism/tree/develop/packages/integration-tests#readme", | ||
"license": "MIT", | ||
"author": "Optimism PBC", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ethereum-optimism/optimism.git" | ||
}, | ||
"devDependencies": { | ||
"@eth-optimism/contracts": "0.5.20", | ||
"@eth-optimism/core-utils": "0.8.3", | ||
"@eth-optimism/sdk": "1.0.4", | ||
"@ethersproject/abstract-provider": "^5.5.1", | ||
"@ethersproject/providers": "^5.5.3", | ||
"@ethersproject/transactions": "^5.5.0", | ||
"@types/chai": "^4.2.18", | ||
"@types/chai-as-promised": "^7.1.4", | ||
"@types/mocha": "^8.2.2", | ||
"@types/rimraf": "^3.0.0", | ||
"@typescript-eslint/eslint-plugin": "^4.26.0", | ||
"@typescript-eslint/parser": "^4.26.0", | ||
"async-mutex": "^0.3.2", | ||
"babel-eslint": "^10.1.0", | ||
"chai": "^4.3.4", | ||
"chai-as-promised": "^7.1.1", | ||
"commander": "^8.3.0", | ||
"dotenv": "^10.0.0", | ||
"envalid": "^7.1.0", | ||
"eslint": "^7.27.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.23.4", | ||
"eslint-plugin-jsdoc": "^35.1.2", | ||
"eslint-plugin-prefer-arrow": "^1.2.3", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"eslint-plugin-react": "^7.24.0", | ||
"eslint-plugin-unicorn": "^32.0.1", | ||
"ethereum-waffle": "^3.3.0", | ||
"ethers": "^5.5.4", | ||
"mocha": "^8.4.0", | ||
"node-fetch": "^2.6.7", | ||
"prom-client": "^14.0.1", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^10.7.0", | ||
"typescript": "^4.3.5" | ||
}, | ||
"dependencies": { | ||
"ts-mocha": "^9.0.2" | ||
} | ||
} |
Oops, something went wrong.