Skip to content

Commit

Permalink
[transactional tests] Stabilize fake ID generation (MystenLabs#10382)
Browse files Browse the repository at this point in the history
## Description 

- Switched to single gas coin per account, which means a new coin is not
generated each transaction
- Created a per-task indexing for fake objects, which is what I should
have done in the first place

## Test Plan 

- Rewrote the tests 

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
tnowacki authored Apr 7, 2023
1 parent bd7d5d6 commit d0d0dc7
Show file tree
Hide file tree
Showing 230 changed files with 1,591 additions and 1,481 deletions.
12 changes: 6 additions & 6 deletions crates/sui-adapter-transactional-tests/tests/call/simple.exp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
processed 4 tasks

task 1 'publish'. lines 6-28:
created: object(104)
mutated: object(103)
created: object(1,0)
mutated: object(0,0)

task 2 'run'. lines 30-30:
created: object(106)
mutated: object(105)
created: object(2,0)
mutated: object(0,0)

task 3 'view-object'. lines 32-32:
Owner: Account Address ( A )
Version: 2
Contents: Test::M1::Object {id: sui::object::UID {id: sui::object::ID {bytes: fake(106)}}, value: 0u64}
Version: 3
Contents: Test::M1::Object {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,0)}}, value: 0u64}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ module Test::M1 {

//# run Test::M1::create --args 0 @A

//# view-object 106
//# view-object 2,0
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
processed 5 tasks

task 1 'consensus-commit-prologue'. lines 6-6:
mutated: 0x6
mutated: 0x0000000000000000000000000000000000000000000000000000000000000006

task 2 'view-object'. lines 8-8:
Owner: Shared
Version: 2
Contents: sui::clock::Clock {id: sui::object::UID {id: sui::object::ID {bytes: 0x6}}, timestamp_ms: 43u64}
Contents: sui::clock::Clock {id: sui::object::UID {id: sui::object::ID {bytes: 0x0000000000000000000000000000000000000000000000000000000000000006}}, timestamp_ms: 43u64}

task 3 'consensus-commit-prologue'. lines 10-10:
mutated: 0x6
mutated: 0x0000000000000000000000000000000000000000000000000000000000000006

task 4 'view-object'. lines 12-12:
Owner: Shared
Version: 3
Contents: sui::clock::Clock {id: sui::object::UID {id: sui::object::ID {bytes: 0x6}}, timestamp_ms: 45u64}
Contents: sui::clock::Clock {id: sui::object::UID {id: sui::object::ID {bytes: 0x0000000000000000000000000000000000000000000000000000000000000006}}, timestamp_ms: 45u64}
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@
processed 17 tasks

init:
A: object(103), B: object(104)
A: object(0,0), B: object(0,1)

task 1 'publish'. lines 9-52:
created: object(106)
mutated: object(105)
created: object(1,0)
mutated: object(0,2)

task 2 'run'. lines 54-54:
created: object(108)
mutated: object(107)
created: object(2,0)
mutated: object(0,0)

task 3 'view-object'. lines 56-56:
Owner: Account Address ( A )
Version: 2
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(108)}}}
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,0)}}}

task 4 'run'. lines 58-58:
created: object(110), object(111)
mutated: object(108), object(109)
created: object(4,0), object(4,1)
mutated: object(0,0), object(2,0)

task 5 'run'. lines 60-60:
mutated: object(108), object(112)
deleted: object(110), object(111)
mutated: object(0,0), object(2,0)
deleted: object(4,0), object(4,1)

task 6 'view-object'. lines 62-66:
Owner: Account Address ( A )
Version: 4
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(108)}}}
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,0)}}}

task 7 'run'. lines 68-68:
created: object(114)
mutated: object(113)
created: object(7,0)
mutated: object(0,0)

task 8 'view-object'. lines 70-70:
Owner: Account Address ( A )
Version: 2
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(114)}}}
Version: 5
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(7,0)}}}

task 9 'run'. lines 72-72:
created: object(116), object(117)
mutated: object(114), object(115)
created: object(9,0), object(9,1)
mutated: object(0,0), object(7,0)

task 10 'run'. lines 74-74:
mutated: object(114), object(116), object(117), object(118)
mutated: object(0,0), object(7,0), object(9,0), object(9,1)

task 11 'view-object'. lines 76-80:
Owner: Account Address ( A )
Version: 4
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(114)}}}
Version: 7
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(7,0)}}}

task 12 'run'. lines 82-82:
created: object(120)
mutated: object(119)
created: object(12,0)
mutated: object(0,0)

task 13 'view-object'. lines 84-84:
Owner: Account Address ( A )
Version: 2
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(120)}}}
Version: 8
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(12,0)}}}

task 14 'run'. lines 86-86:
created: object(122), object(123)
mutated: object(120), object(121)
created: object(14,0), object(14,1)
mutated: object(0,0), object(12,0)

task 15 'run'. lines 88-88:
created: object(125)
mutated: object(120), object(122), object(124)
wrapped: object(123)
created: object(15,0)
mutated: object(0,0), object(12,0), object(14,0)
wrapped: object(14,1)

task 16 'view-object'. lines 90-90:
Owner: Account Address ( A )
Version: 4
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(120)}}}
Version: 10
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(12,0)}}}
Original file line number Diff line number Diff line change
Expand Up @@ -53,38 +53,38 @@ module test::m {

//# run test::m::mint --sender A

//# view-object 108
//# view-object 2,0

//# run test::m::add --sender A --args object(108) 1
//# run test::m::add --sender A --args object(2,0) 1

//# run test::m::remove --sender A --args object(108) 1
//# run test::m::remove --sender A --args object(2,0) 1

//# view-object 108
//# view-object 2,0

//
// Test remove and add
//

//# run test::m::mint --sender A

//# view-object 114
//# view-object 7,0

//# run test::m::add --sender A --args object(114) 1
//# run test::m::add --sender A --args object(7,0) 1

//# run test::m::remove_and_add --sender A --args object(114) 1
//# run test::m::remove_and_add --sender A --args object(7,0) 1

//# view-object 114
//# view-object 7,0

//
// Test remove and wrap
//

//# run test::m::mint --sender A

//# view-object 120
//# view-object 12,0

//# run test::m::add --sender A --args object(120) 1
//# run test::m::add --sender A --args object(12,0) 1

//# run test::m::remove_and_wrap --sender A --args object(120) 1
//# run test::m::remove_and_wrap --sender A --args object(12,0) 1

//# view-object 120
//# view-object 12,0
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
processed 6 tasks

init:
A: object(103), B: object(104)
A: object(0,0), B: object(0,1)

task 1 'publish'. lines 9-38:
created: object(106)
mutated: object(105)
created: object(1,0)
mutated: object(0,2)

task 2 'run'. lines 40-40:
created: object(108)
mutated: object(107)
created: object(2,0)
mutated: object(0,0)

task 3 'run'. lines 42-42:
created: object(110), object(111)
mutated: object(108), object(109)
created: object(3,0), object(3,1)
mutated: object(0,0), object(2,0)

task 4 'view-object'. lines 44-44:
Owner: Account Address ( A )
Version: 3
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(108)}}}
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,0)}}}

task 5 'run'. lines 46-46:
created: object(113)
mutated: object(112)
wrapped: object(108)
created: object(5,0)
mutated: object(0,0)
wrapped: object(2,0)
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ module test::m {

//# run test::m::mint --sender A

//# run test::m::add --sender A --args object(108) 0
//# run test::m::add --sender A --args object(2,0) 0

//# view-object 108
//# view-object 2,0

//# run test::m::wrap --sender A --args object(108)
//# run test::m::wrap --sender A --args object(2,0)
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
processed 3 tasks

init:
A: object(103), B: object(104)
A: object(0,0), B: object(0,1)

task 1 'publish'. lines 9-32:
created: object(106)
mutated: object(105)
created: object(1,0)
mutated: object(0,2)

task 2 'run'. lines 34-34:
created: object(108), object(109), object(110)
mutated: object(107)
created: object(2,0), object(2,1), object(2,2)
mutated: object(0,0)
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
processed 6 tasks

init:
A: object(103), B: object(104)
A: object(0,0), B: object(0,1)

task 1 'publish'. lines 9-33:
created: object(106)
mutated: object(105)
created: object(1,0)
mutated: object(0,2)

task 2 'run'. lines 35-35:
created: object(108)
mutated: object(107)
created: object(2,0)
mutated: object(0,0)

task 3 'run'. lines 37-37:
created: object(110), object(111)
mutated: object(108), object(109)
created: object(3,0), object(3,1)
mutated: object(0,0), object(2,0)

task 4 'view-object'. lines 39-39:
Owner: Account Address ( A )
Version: 3
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(108)}}}
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,0)}}}

task 5 'run'. lines 41-41:
mutated: object(112)
deleted: object(108)
mutated: object(0,0)
deleted: object(2,0)
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ module test::m {

//# run test::m::mint --sender A

//# run test::m::add --sender A --args object(108) 0
//# run test::m::add --sender A --args object(2,0) 0

//# view-object 108
//# view-object 2,0

//# run test::m::delete --sender A --args object(108)
//# run test::m::delete --sender A --args object(2,0)
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
processed 7 tasks

init:
A: object(103), B: object(104)
A: object(0,0), B: object(0,1)

task 1 'publish'. lines 9-58:
created: object(106)
mutated: object(105)
created: object(1,0)
mutated: object(0,2)

task 2 'run'. lines 59-59:
created: object(108)
mutated: object(107)
created: object(2,0)
mutated: object(0,0)

task 3 'run'. lines 61-61:
created: object(110), object(111)
mutated: object(108), object(109)
created: object(3,0), object(3,1)
mutated: object(0,0), object(2,0)

task 4 'view-object'. lines 63-63:
Owner: Account Address ( A )
Version: 3
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(108)}}}
Contents: test::m::S {id: sui::object::UID {id: sui::object::ID {bytes: fake(2,0)}}}

task 5 'run'. lines 65-65:
mutated: object(108), object(112)
deleted: object(110), object(111)
mutated: object(0,0), object(2,0)
deleted: object(3,0), object(3,1)

task 6 'run'. lines 67-67:
mutated: object(113)
deleted: object(108)
mutated: object(0,0)
deleted: object(2,0)
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ module test::m {
}
//# run test::m::mint --sender A

//# run test::m::add --sender A --args object(108) 0
//# run test::m::add --sender A --args object(2,0) 0

//# view-object 108
//# view-object 2,0

//# run test::m::remove --sender A --args object(108) 0
//# run test::m::remove --sender A --args object(2,0) 0

//# run test::m::delete --sender A --args object(108)
//# run test::m::delete --sender A --args object(2,0)
Loading

0 comments on commit d0d0dc7

Please sign in to comment.