Skip to content

Commit 3b55bdc

Browse files
committed
bump order_approval version to 4
1 parent 6826d4c commit 3b55bdc

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

contracts/order/build/order_approval.teal

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
// Versioning
5151

5252
// Update this value by one with each new version
53-
#define VERSION 3
53+
#define VERSION 4
5454

5555

5656
// tl:85: router:
@@ -199,7 +199,7 @@ __func__create_application:
199199

200200
// tl:119: app_global_put(VERSION_KEY, VERSION)
201201
pushbytes VERSION_KEY // "version"
202-
pushint VERSION // 3
202+
pushint VERSION // 4
203203
app_global_put
204204

205205
// create_application(user_address,registry_app_id,vault_app_id)
@@ -305,7 +305,7 @@ __func__post_update:
305305

306306
// This will fail the update if the app is already at the same or higher version
307307
// tl:154: assert(VERSION > app_global_get(VERSION_KEY))
308-
pushint VERSION // 3
308+
pushint VERSION // 4
309309
pushbytes VERSION_KEY // "version"
310310
app_global_get
311311
>
@@ -346,11 +346,11 @@ __func__post_update:
346346
// Always update the version number in global state
347347
// tl:170: app_global_put(VERSION_KEY, VERSION)
348348
pushbytes VERSION_KEY // "version"
349-
pushint VERSION // 3
349+
pushint VERSION // 4
350350
app_global_put
351351
// tl:171: log(ARC28Event("post_update(uint64)", itob(VERSION)))
352352
pushbytes 0xfca63cfe // SHA512_256("post_update(uint64)")[:4]
353-
pushint VERSION // 3
353+
pushint VERSION // 4
354354
itob
355355
concat
356356
log
0 Bytes
Binary file not shown.

contracts/order/order_approval.tl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const int MINUTE = 60
7979
# Versioning
8080

8181
# Update this value by one with each new version
82-
const int VERSION = 3
82+
const int VERSION = 4
8383

8484

8585
router:

tests/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
WEEK = DAY * 7
3131
MAX_UINT64 = 18446744073709551615
3232

33-
CURRENT_VERSION = 3
33+
CURRENT_VERSION = 4

tests/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def create_order_app(self, app_id, app_creator_address):
125125
REGISTRY_APP_ACCOUNT_ADDRESS_KEY: decode_address(self.register_application_address),
126126
VAULT_APP_ID_KEY: self.vault_app_id,
127127
ROUTER_APP_ID_KEY: self.router_app_id,
128-
VERSION_KEY: 1,
128+
VERSION_KEY: CURRENT_VERSION,
129129
}
130130

131131
# Register the app.

tests/test_ordering.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ def test_update_order_app(self):
8080
self.ordering_client = self.create_order_app(self.app_id, self.user_address)
8181
self.ledger.set_account_balance(self.ordering_client.application_address, 10_000_000)
8282

83-
self.assertEqual(self.ledger.get_global_state(self.app_id)[b"version"], 1)
83+
self.assertEqual(self.ledger.get_global_state(self.app_id)[b"version"], CURRENT_VERSION)
8484

8585
# Mock Approve a version
8686
approval_program = TealishProgram('contracts/order/order_approval.tl')
87-
approval_program.tealish_source = approval_program.tealish_source.replace("VERSION = 1", "VERSION = 2")
87+
approval_program.tealish_source = approval_program.tealish_source.replace(f"VERSION = {CURRENT_VERSION}", f"VERSION = {CURRENT_VERSION + 1}")
8888
approval_program.compile()
8989
update_bytecode = approval_program.bytecode
9090

91-
version = CURRENT_VERSION
91+
version = CURRENT_VERSION + 1
9292
key = b"v" + version.to_bytes(8, "big")
9393
approval_hash = calculate_approval_hash(update_bytecode)
9494
struct = AppVersion()
@@ -109,16 +109,16 @@ def test_update_order_app(self):
109109
update_application_event = events[0]
110110

111111
self.assertEqual(update_application_event["user_address"], self.user_address)
112-
self.assertEqual(update_application_event["version"], CURRENT_VERSION)
112+
self.assertEqual(update_application_event["version"], CURRENT_VERSION + 1)
113113

114114
events = decode_logs(verify_update_txn[b'dt'][b'lg'], registry_events)
115115
emited_event = events[0]
116116

117117
self.assertEqual(emited_event['event_name'], 'update_ordering_application')
118118
self.assertEqual(emited_event['order_app_id'], self.app_id)
119-
self.assertEqual(emited_event['version'], CURRENT_VERSION)
119+
self.assertEqual(emited_event['version'], CURRENT_VERSION + 1)
120120

121-
self.assertEqual(self.ledger.get_global_state(self.app_id)[b"version"], CURRENT_VERSION)
121+
self.assertEqual(self.ledger.get_global_state(self.app_id)[b"version"], CURRENT_VERSION + 1)
122122

123123

124124
class PutTriggerOrderTests(OrderProtocolBaseTestCase):

0 commit comments

Comments
 (0)