Skip to content

Commit ce45e15

Browse files
author
Mark A. Greenslade
committed
1. Auction withdraw bid updated.
1 parent 2bb4e17 commit ce45e15

5 files changed

Lines changed: 19 additions & 26 deletions

File tree

stests/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# ╚═════╝░░░░╚═╝░░░╚══════╝╚═════╝░░░░╚═╝░░░╚═════╝░
88

99
__title__ = "stests"
10-
__version__ = "1.2.6"
10+
__version__ = "1.2.7"
1111
__author__ = "Casper Labs AG, Zug, Switzerland"
1212
__license__ = "CasperLabs Open Source License (COSL)"
1313
__copyright__ = "Copyright 2020 Casper Labs"

stests/chain/set_auction_bid_submit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def execute(info: DeployDispatchInfo, amount: int, delegation_rate: int, verbose
4040
if verbose:
4141
log_event(
4242
EventType.WFLOW_DEPLOY_DISPATCHED,
43-
f"{info.node.address} :: {deploy_hash} :: auction add-bid :: {amount} CSPR :: from node {info.node.index} ",
43+
f"{info.node.address} :: {deploy_hash} :: auction add-bid :: {amount} CSPR :: by node {info.node.index} ",
4444
info.node,
4545
deploy_hash=deploy_hash,
4646
)
Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from stests.chain import set_deploy
22
from stests.chain.utils import execute_cli
33
from stests.chain.utils import DeployDispatchInfo
4+
from stests.core.logging import log_event
45
from stests.events import EventType
56

67

@@ -13,25 +14,33 @@
1314

1415

1516
@execute_cli(_CLIENT_METHOD, EventType.WFLOW_DEPLOY_DISPATCH_FAILURE)
16-
def execute(info: DeployDispatchInfo, amount: int) -> str:
17+
def execute(info: DeployDispatchInfo, amount: int, verbose: bool = True) -> str:
1718
"""Withdraws a bid from network's validator slot auction contract.
1819
1920
:param info: Information required when dispatching a deploy.
2021
:param amount: Amount to withdraw from auction bid (motes).
22+
:param verbose: Flag inidcating whether event will be logged.
2123
2224
:returns: Deploy hash.
2325
2426
"""
25-
main_purse_uref = "TODO"
26-
27-
return set_deploy.execute(
27+
deploy_hash = set_deploy.execute(
2828
info.network,
2929
info.node,
3030
info.dispatcher,
3131
_CONTRACT_FNAME,
3232
[
3333
"--session-arg", f"amount:u512='{amount}'",
3434
"--session-arg", f"public_key:public_key='{info.dispatcher.account_key}'",
35-
"--session-arg", f"unbond_purse:uref='{main_purse_uref}'",
3635
]
3736
)
37+
38+
if verbose:
39+
log_event(
40+
EventType.WFLOW_DEPLOY_DISPATCHED,
41+
f"{info.node.address} :: {deploy_hash} :: auction withdraw-bid :: {amount} CSPR :: by node {info.node.index} ",
42+
info.node,
43+
deploy_hash=deploy_hash,
44+
)
45+
46+
return deploy_hash

stests/generators/wg_200/p1s1_submit_bid.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
from stests import chain
22
from stests.core import cache
33
from stests.core import factory
4-
from stests.core.types.chain import AccountType
54
from stests.core.types.chain import DeployType
65
from stests.core.types.orchestration import ExecutionContext
7-
from stests.generators.utils import verification
86
from stests.generators.utils.infra import get_network_node
97

10-
import time
118

129

1310
# Step label.
Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
from stests import chain
22
from stests.core import cache
33
from stests.core import factory
4-
from stests.core.types.chain import AccountType
54
from stests.core.types.chain import DeployType
65
from stests.core.types.orchestration import ExecutionContext
7-
from stests.generators.utils import verification
86
from stests.generators.utils.infra import get_network_node
97

108

9+
1110
# Step label.
1211
LABEL = "auction-bid-withdraw"
1312

@@ -24,11 +23,8 @@ def execute(ctx: ExecutionContext):
2423
# Set target network / node.
2524
network, node = get_network_node(ctx)
2625

27-
# Set validator account.
28-
validator = factory.create_account_for_run(ctx, _USER_ACCOUNT_INDEX, "WG-200")
29-
3026
# Submit deploy.
31-
dispatch_info = chain.DeployDispatchInfo(validator, network, node)
27+
dispatch_info = chain.DeployDispatchInfo(node.account, network, node)
3228
deploy_hash, dispatch_duration, dispatch_attempts = \
3329
chain.set_auction_bid_withdraw(
3430
dispatch_info,
@@ -38,19 +34,10 @@ def execute(ctx: ExecutionContext):
3834
# Update cache: deploy.
3935
cache.state.set_deploy(factory.create_deploy_for_run(
4036
ctx=ctx,
41-
account=validator,
37+
account=node.account,
4238
node=node,
4339
deploy_hash=deploy_hash,
4440
dispatch_attempts=dispatch_attempts,
4541
dispatch_duration=dispatch_duration,
4642
typeof=DeployType.AUCTION_BID_WITHDRAW
4743
))
48-
49-
50-
def verify(ctx: ExecutionContext):
51-
"""Step execution verifier.
52-
53-
:param ctx: Execution context information.
54-
55-
"""
56-
verification.verify_deploy_count(ctx, 1)

0 commit comments

Comments
 (0)