Skip to content

Commit

Permalink
Upgrade tests infrastructure (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-CZ committed Sep 11, 2024
1 parent e75df19 commit 48fc1fc
Show file tree
Hide file tree
Showing 17 changed files with 6,501 additions and 20,837 deletions.
5 changes: 0 additions & 5 deletions .babelrc

This file was deleted.

6 changes: 0 additions & 6 deletions .eslintignore

This file was deleted.

21 changes: 0 additions & 21 deletions .eslintrc

This file was deleted.

32 changes: 21 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
.idea/
node_modules
.idea
.deps
build
coverage
coverage.json
/.coverage_artifacts/
/.coverage_contracts/
/coverageEnv/
/coverageEnv/
artifacts/
cache/
.env
contracts/artifacts
internal/rpc/contracts
.deploys
.states

node_modules
.env

# solidity-coverage files
/coverage
/coverage.json

# Hardhat files
/cache
/artifacts

# TypeChain files
/typechain
/typechain-types
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ all: build

.PHONY: build
build:
docker run --rm --user $$(id -u):$$(id -g) -v $(PWD):/src -w /src node:16.19.1 bash -c \
'export NPM_CONFIG_PREFIX=~; npm install --no-save; npm install --no-save [email protected]; npm run build'
docker run --rm --user $$(id -u):$$(id -g) -v $(PWD):/src -w /src node:20.17.0 bash -c \
'export NPM_CONFIG_PREFIX=~; npm install --no-save; npm run build'

.PHONY: checksum
checksum:
for f in ./build/contracts/*.json; do echo -n "$$f "; jq -j .deployedBytecode $$f | shasum; done

.PHONY: test
test:
docker run --rm --user $$(id -u):$$(id -g) -v $(PWD):/src -w /src node:16.19.1 bash -c \
'export NPM_CONFIG_PREFIX=~; npm install --no-save; npm install --no-save [email protected]; npm run test'
docker run --rm --user $$(id -u):$$(id -g) -v $(PWD):/src -w /src node:20.17.0 bash -c \
'export NPM_CONFIG_PREFIX=~; npm install --no-save npm run test'

6 changes: 3 additions & 3 deletions contracts/sfc/NodeDriver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ contract NodeDriver is Initializable {
evmWriter.copyCode(acc, from);
}

function swapCode(address acc, address with) external onlyBackend {
evmWriter.swapCode(acc, with);
function swapCode(address acc, address where) external onlyBackend {
evmWriter.swapCode(acc, where);
}

function setStorage(address acc, bytes32 key, bytes32 value) external onlyBackend {
Expand Down Expand Up @@ -279,7 +279,7 @@ interface EVMWriter {

function copyCode(address acc, address from) external;

function swapCode(address acc, address with) external;
function swapCode(address acc, address where) external;

function setStorage(address acc, bytes32 key, bytes32 value) external;

Expand Down
2 changes: 1 addition & 1 deletion contracts/sfc/SFC.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract SFC is SFCBase, Version {
}
}

fallback() payable external {
fallback() external payable {
require(msg.data.length != 0, "transfers not allowed");
_delegate(libAddress);
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/StubEvmWriter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ contract StubEvmWriter is EVMWriter {

function copyCode(address acc, address from) external {}

function swapCode(address acc, address with) external {}
function swapCode(address acc, address where) external {}

function setStorage(address acc, bytes32 key, bytes32 value) external {}

Expand Down
23 changes: 23 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export default [
{
globals: {
"artifacts": true,
"contract": true,
"web3": true,
"assert": true,
"it": true,
"before": true,
"beforeEach": true,
"describe": true
},
rules: {
"strict": 0,
"indent": ["error", 4],
"func-names": "off",
"max-len": "off",
"no-underscore-dangle": "off"
},
ignores: ["tmp/*", "build/*", "node_modules/*", "contracts/*"]
}
]

60 changes: 0 additions & 60 deletions hardhat.config.js

This file was deleted.

25 changes: 25 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { HardhatUserConfig } from "hardhat/config";
import * as dotenv from 'dotenv';
import "@nomicfoundation/hardhat-toolbox";
import 'hardhat-contract-sizer';
import 'solidity-coverage'

dotenv.config();

const config: HardhatUserConfig = {
solidity: {
version: '0.8.19',
settings: {
evmVersion: 'london',
optimizer: {
enabled: true,
runs: 200,
},
},
},
contractSizer: {
runOnCompile: true,
},
};

export default config;
Loading

0 comments on commit 48fc1fc

Please sign in to comment.