Skip to content

Commit

Permalink
Merge pull request #549 from skalenetwork/feature/add-change-ip-ts-func
Browse files Browse the repository at this point in the history
Update web3 version, add change ip ts func
  • Loading branch information
badrogger authored Jan 4, 2024
2 parents 6211cb6 + 60fa8b7 commit e4c7806
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Launch hardhat node
working-directory: hardhat-node
run: |
docker-compose up -d
docker-compose up -d && sleep 20
- name: Deploy manager
run: |
Expand Down Expand Up @@ -62,6 +62,7 @@ jobs:
matrix:
python-version: [3.11]
env:
ENDPOINT: ${{ secrets.ENDPOINT }}
ETH_PRIVATE_KEY: ${{ secrets.ETH_PRIVATE_KEY }}
MANAGER_TAG: "1.9.0-develop.20"
ALLOCATOR_TAG: "2.2.2-develop.0"
Expand All @@ -84,7 +85,7 @@ jobs:
- name: Launch hardhat node
working-directory: hardhat-node
run: |
docker-compose up -d
docker-compose up -d && sleep 20
- name: Deploy manager contracts
run: |
Expand Down
2 changes: 1 addition & 1 deletion hardhat-node
2 changes: 1 addition & 1 deletion helper-scripts
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

setup(
name='skale.py',
version='6.1',
version='6.2',
description='SKALE client tools',
long_description_markdown_filename='README.md',
author='SKALE Labs',
Expand All @@ -43,9 +43,9 @@
install_requires=[
"asyncio==3.4.3",
"pyyaml==6.0",
"sgx.py==0.9b0",
"sgx.py==0.9dev2",
"redis==4.4.4",
"web3==6.3.0"
"web3==6.13.0"
],

python_requires='>=3.7,<4',
Expand Down
3 changes: 3 additions & 0 deletions skale/contracts/manager/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ def get_validator_node_indices(self, validator_id: int) -> list:
"""
return self.contract.functions.getValidatorNodeIndexes(validator_id).call()

def get_last_change_ip_time(self, node_id: int) -> list:
return self.contract.functions.getLastChangeIpTime(node_id).call()

@transaction_method
def set_node_in_maintenance(self, node_id):
return self.contract.functions.setNodeInMaintenance(node_id)
Expand Down
9 changes: 9 additions & 0 deletions tests/manager/nodes_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,12 @@ def test_change_ip(skale, nodes):
data = skale.nodes.get(node_id)
assert data['ip'] == old_ip
assert data['publicIP'] == old_ip


def test_get_last_change_ip_time(skale, nodes):
node_id = skale.nodes.node_name_to_index(DEFAULT_NODE_NAME)
new_ip = Helper.ip_to_bytes(generate_random_ip())
tx = skale.nodes.change_ip(node_id, new_ip, new_ip, wait_for=True, confirmation_blocks=5)
change_timestamp = skale.nodes.get_last_change_ip_time(node_id)
block = skale.web3.eth.get_block(tx.receipt.blockNumber)
assert change_timestamp == block.timestamp

0 comments on commit e4c7806

Please sign in to comment.