Skip to content

Commit

Permalink
Merge pull request #160 from skalenetwork/remove-deprecated-actions-c…
Browse files Browse the repository at this point in the history
…ache

Update GitHub Actions workflows
  • Loading branch information
yavrsky authored Dec 26, 2024
2 parents 5452919 + ec471a2 commit d30a22f
Show file tree
Hide file tree
Showing 8 changed files with 333 additions and 657 deletions.
31 changes: 7 additions & 24 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,28 @@ on:
- stable

env:
NODE_VERSION: 16
NODE_VERSION: 20
PYTHON_VERSION: 3.9

jobs:
publish:
runs-on: ubuntu-latest
if: github.event.pull_request.merged

steps:
- uses: actions/checkout@v2

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
if: github.event.pull_request.merged

- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
steps:
- uses: actions/checkout@v4

- name: Install NODE JS
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'

- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'

- name: Install building tools
run: pip3 install -r ./predeployed/scripts/requirements.txt
Expand Down Expand Up @@ -93,7 +76,7 @@ jobs:
release_name: ${{ env.VERSION }}
draft: false
prerelease: ${{ env.PRERELEASE }}

- name: Upload Release Assets
id: upload-release-assets
uses: dwenegar/upload-release-assets@v1
Expand Down
27 changes: 5 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,26 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x]
python-version: ["3.7.x", "3.8.x", "3.9.x"]
node-version: [18.x, 20.x]
python-version: ["3.8.x", "3.9.x", "3.10.x"]

env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

steps:
- uses: actions/checkout@v2

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/checkout@v4

- name: Install NODE JS
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install project
run: yarn install
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
"no-hooks": "git config core.hooksPath .git/hooks",
"fullcheck": "yarn cspell",
"prepare": "yarn compile && yarn hooks"

},
"devDependencies": {
"@types/chai": "^4.3.1",
"@types/mocha": "^9.1.1",
"@types/node": "^18.11.18",
"chai": "^4.3.6",
"cspell": "^5.13.0",
"hardhat": "^2.10.1",
"hardhat": "^2.22.17",
"ts-node": "^10.9.1",
"typescript": "^4.4.3"
},
"dependencies": {
"@openzeppelin/contracts": "^4.3.2"
}
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ def generate_storage(cls, **kwargs) -> Dict[str, str]:
required_confirmations = kwargs.get('required_confirmations', 1)

if len(originator_addresses) > cls.MAX_OWNER_COUNT:
raise Exception('Number of originators must not be more than 50')
raise ValueError('Number of originators must not be more than 50')
if required_confirmations > len(originator_addresses):
raise Exception('Number of required confirmations must be less'
'or equal than number of originators')
raise ValueError('Number of required confirmations must be less'
'or equal than number of originators')

storage: Dict[str, str] = {}
for originator_address in originator_addresses:
if originator_address == cls.ZERO_ADDRESS:
raise Exception('Originator address must not be zero')
raise ValueError('Originator address must not be zero')
is_owner_value_slot = cls.calculate_mapping_value_slot(
cls.IS_OWNER_SLOT,
originator_address,
Expand Down
13 changes: 6 additions & 7 deletions predeployed/test/test_multisigwallet_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_max_owner_count(self, tmpdir):
genesis = self.prepare_genesis()

with self.run_geth(tmpdir, genesis):
assert w3.isConnected()
assert w3.is_connected()

multisig = w3.eth.contract(address=MULTISIGWALLET_ADDRESS, abi=self.get_multisig_abi())
assert multisig.functions.MAX_OWNER_COUNT().call() == self.MAX_OWNER_COUNT
Expand All @@ -33,7 +33,7 @@ def test_is_owner(self, tmpdir):
genesis = self.prepare_genesis()

with self.run_geth(tmpdir, genesis):
assert w3.isConnected()
assert w3.is_connected()

multisig = w3.eth.contract(address=MULTISIGWALLET_ADDRESS, abi=self.get_multisig_abi())
assert multisig.functions.isOwner(self.ORIGINATOR_ADDRESS_0).call()
Expand All @@ -42,7 +42,7 @@ def test_owners(self, tmpdir):
genesis = self.prepare_genesis()

with self.run_geth(tmpdir, genesis):
assert w3.isConnected()
assert w3.is_connected()

multisig = w3.eth.contract(address=MULTISIGWALLET_ADDRESS, abi=self.get_multisig_abi())
assert multisig.functions.owners(0).call() == self.ORIGINATOR_ADDRESS_0
Expand All @@ -51,11 +51,11 @@ def test_default_required(self, tmpdir):
genesis = self.prepare_genesis()

with self.run_geth(tmpdir, genesis):
assert w3.isConnected()
assert w3.is_connected()

multisig = w3.eth.contract(address=MULTISIGWALLET_ADDRESS, abi=self.get_multisig_abi())
assert multisig.functions.required().call() == 1

def test_required_and_is_owners(self, tmpdir):
multisigwallet_generator = MultiSigWalletGenerator()

Expand All @@ -65,7 +65,7 @@ def test_required_and_is_owners(self, tmpdir):
required_confirmations=2))

with self.run_geth(tmpdir, genesis):
assert w3.isConnected()
assert w3.is_connected()

multisig = w3.eth.contract(address=MULTISIGWALLET_ADDRESS, abi=self.get_multisig_abi())
assert multisig.functions.required().call() == 2
Expand All @@ -75,4 +75,3 @@ def test_required_and_is_owners(self, tmpdir):
def test_meta_info(self):
meta = MultiSigWalletGenerator().get_meta()
assert meta['name'] == 'MultiSigWallet'

32 changes: 23 additions & 9 deletions predeployed/test/tools/base_genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,36 @@
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"istanbulBlock": 0,
"petersburgBlock": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"muirGlacierBlock": 0,
"berlinBlock": 0,
"londonBlock": 0
"londonBlock": 0,
"arrowGlacierBlock": 0,
"grayGlacierBlock": 0,
"shanghaiTime": 0,
"cancunTime": 0,
"terminalTotalDifficulty": 0,
"terminalTotalDifficultyPassed": true
},
"nonce": "0x33",
"nonce": "0x0",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x8000000",
"difficulty": "0x100",
"extraData": "0x",
"gasLimit": "0xaf79e0",
"difficulty": "0x0",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0xd2001DAb6898127Be2F167B548691C87251D13C3",
"alloc": {
"0xd2001DAb6898127Be2F167B548691C87251D13C3": {
"balance": "1000000000000000000"
}
}
}
},
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"baseFeePerGas": "0x3b9aca00",
"excessBlobGas": null,
"blobGasUsed": null
}
33 changes: 27 additions & 6 deletions predeployed/test/tools/test_predeployed.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import json
import subprocess
import os
import random
import string


class GethInstance:
class GethInstance:
def __init__(self, geth):
self.geth = geth
def __enter__(self):
Expand Down Expand Up @@ -36,13 +38,32 @@ def run_geth(self, tmpdir, genesis):
assert process.returncode == 0

# run geth
self.geth = subprocess.Popen(['geth', '--datadir', tmpdir, '--dev', '--http'], stderr=subprocess.PIPE, universal_newlines=True)
self.geth = subprocess.Popen(
[
'geth',
'--datadir', tmpdir,
'--dev',
'--http'
],
stderr=subprocess.PIPE,
universal_newlines=True
)

output = []
while True:
assert self.geth.poll() is None
output_line = self.geth.stderr.readline()
if 'HTTP server started' in output_line:
break
return_code = self.geth.poll()
if return_code is None:
output_line = self.geth.stderr.readline()
output.append(output_line)
if 'HTTP server started' in output_line:
break
else:
# geth stopped
for line in output:
print(line)
for line in self.geth.stderr.readlines():
print(line)
raise RuntimeError("Geth was not started")

return GethInstance(self.geth)

Expand Down
Loading

0 comments on commit d30a22f

Please sign in to comment.