Skip to content

Commit

Permalink
Tests: add test check HWM after signing when a chain has been setup
Browse files Browse the repository at this point in the history
  • Loading branch information
spalmer25 committed Feb 5, 2024
1 parent 4ac86f9 commit 31d4c4e
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions test/python/test_instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,65 @@ def test_sign_when_no_chain_setup(
)


def test_sign_when_chain_is_setup(
client: TezosClient,
tezos_navigator: TezosNavigator) -> None:
"""Check that signing when chain has been setup change main HWM."""

account = DEFAULT_ACCOUNT
main_chain_id = "NetXH12AexHqTQa" # Chain = 1

tezos_navigator.setup_app_context(
account,
main_chain_id,
main_hwm=Hwm(0),
test_hwm=Hwm(0)
)

attestation = build_attestation(
1, 0,
main_chain_id
)

client.sign_message(account, attestation)

tezos_navigator.check_app_context(
account,
chain_id=main_chain_id,
main_hwm=Hwm(1, 0),
test_hwm=Hwm(0, 0),
)

attestation = build_attestation(
2, 0,
DEFAULT_CHAIN_ID # Chain = 0
)

client.sign_message(account, attestation)

tezos_navigator.check_app_context(
account,
chain_id=main_chain_id,
main_hwm=Hwm(1, 0),
test_hwm=Hwm(2, 0),
)

attestation = build_attestation(
2, 0,
"NetXH12Af5mrXhq" # Chain = 2
)

with StatusCode.WRONG_VALUES.expected():
client.sign_message(account, attestation)

tezos_navigator.check_app_context(
account,
chain_id=main_chain_id,
main_hwm=Hwm(1, 0),
test_hwm=Hwm(2, 0),
)


# Data generated by the old application itself
HMAC_TEST_SET = [
(DEFAULT_ACCOUNT,
Expand Down

0 comments on commit 31d4c4e

Please sign in to comment.