-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Indexer: Fix wrap-unwrap bug (#5047)
* Indexer: Fix wrap-unwrap bug * Improve string formatting Co-authored-by: Sergiu Popescu <44298302+sergiupopescu199@users.noreply.github.com> * Convert comment to docstring * Added modifications header --------- Co-authored-by: Sergiu Popescu <44298302+sergiupopescu199@users.noreply.github.com>
- Loading branch information
1 parent
4554c4b
commit 52fe96c
Showing
3 changed files
with
301 additions
and
95 deletions.
There are no files selected for viewing
113 changes: 113 additions & 0 deletions
113
crates/iota-graphql-e2e-tests/tests/objects/wrap_unwrap.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
processed 14 tasks | ||
|
||
init: | ||
A: object(0,0) | ||
|
||
task 1, lines 6-30: | ||
//# publish | ||
created: object(1,0) | ||
mutated: object(0,1) | ||
gas summary: computation_cost: 1000000, computation_cost_burned: 1000000, storage_cost: 5624000, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 2, lines 32-34: | ||
//# programmable --sender A --inputs @A | ||
//> 0: P0::m::foo(); | ||
//> TransferObjects([Result(0)], Input(0)) | ||
created: object(2,0) | ||
mutated: object(0,0) | ||
gas summary: computation_cost: 1000000, computation_cost_burned: 1000000, storage_cost: 2196400, storage_rebate: 0, non_refundable_storage_fee: 0 | ||
|
||
task 3, lines 36-38: | ||
//# programmable --sender A --inputs @A object(2,0) | ||
//> 0: P0::m::from_foo(Input(1)); | ||
//> TransferObjects([Result(0)], Input(0)) | ||
created: object(3,0) | ||
mutated: object(0,0) | ||
wrapped: object(2,0) | ||
gas summary: computation_cost: 1000000, computation_cost_burned: 1000000, storage_cost: 2439600, storage_rebate: 2196400, non_refundable_storage_fee: 0 | ||
|
||
task 4, lines 40-42: | ||
//# programmable --sender A --inputs @A object(3,0) | ||
//> 0: P0::m::into_foo(Input(1)); | ||
//> TransferObjects([Result(0)], Input(0)) | ||
mutated: object(0,0) | ||
unwrapped: object(2,0) | ||
deleted: object(3,0) | ||
gas summary: computation_cost: 1000000, computation_cost_burned: 1000000, storage_cost: 2196400, storage_rebate: 2439600, non_refundable_storage_fee: 0 | ||
|
||
task 5, line 44: | ||
//# create-checkpoint | ||
Checkpoint created: 1 | ||
|
||
task 6, lines 46-54: | ||
//# run-graphql | ||
Response: { | ||
"data": { | ||
"object1": { | ||
"digest": "kfqgxZwi4o2rX6KEbFLC9v2vzyt3oBAjTVGrZ4C4h9v" | ||
}, | ||
"object2": { | ||
"digest": null | ||
} | ||
} | ||
} | ||
|
||
task 7, lines 56-58: | ||
//# programmable --sender A --inputs @A | ||
//> 0: P0::m::foo(); | ||
//> TransferObjects([Result(0)], Input(0)) | ||
created: object(7,0) | ||
mutated: object(0,0) | ||
gas summary: computation_cost: 1000000, computation_cost_burned: 1000000, storage_cost: 2196400, storage_rebate: 980400, non_refundable_storage_fee: 0 | ||
|
||
task 8, lines 60-62: | ||
//# programmable --sender A --inputs @A object(7,0) | ||
//> 0: P0::m::from_foo(Input(1)); | ||
//> TransferObjects([Result(0)], Input(0)) | ||
created: object(8,0) | ||
mutated: object(0,0) | ||
wrapped: object(7,0) | ||
gas summary: computation_cost: 1000000, computation_cost_burned: 1000000, storage_cost: 2439600, storage_rebate: 2196400, non_refundable_storage_fee: 0 | ||
|
||
task 9, line 64: | ||
//# create-checkpoint | ||
Checkpoint created: 2 | ||
|
||
task 10, lines 66-74: | ||
//# run-graphql | ||
Response: { | ||
"data": { | ||
"object1": { | ||
"digest": null | ||
}, | ||
"object2": { | ||
"digest": "d27G5A3VoWJfmErshZcy4evrzjBzjAT8cwYzpztVhLw" | ||
} | ||
} | ||
} | ||
|
||
task 11, lines 76-78: | ||
//# programmable --sender A --inputs @A object(8,0) | ||
//> 0: P0::m::into_foo(Input(1)); | ||
//> TransferObjects([Result(0)], Input(0)) | ||
mutated: object(0,0) | ||
unwrapped: object(7,0) | ||
deleted: object(8,0) | ||
gas summary: computation_cost: 1000000, computation_cost_burned: 1000000, storage_cost: 2196400, storage_rebate: 2439600, non_refundable_storage_fee: 0 | ||
|
||
task 12, line 80: | ||
//# create-checkpoint | ||
Checkpoint created: 3 | ||
|
||
task 13, lines 82-90: | ||
//# run-graphql | ||
Response: { | ||
"data": { | ||
"object1": { | ||
"digest": "5JRDDVvrZJ1xrPmSA9ML1KgxCsgRJUSt87gDoob2V7aU" | ||
}, | ||
"object2": { | ||
"digest": null | ||
} | ||
} | ||
} |
91 changes: 91 additions & 0 deletions
91
crates/iota-graphql-e2e-tests/tests/objects/wrap_unwrap.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// Modifications Copyright (c) 2025 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//# init --protocol-version 3 --addresses P0=0x0 --accounts A --simulator | ||
|
||
//# publish | ||
module P0::m { | ||
public struct Foo has key, store { | ||
id: UID, | ||
} | ||
|
||
public struct Bar has key, store { | ||
id: UID, | ||
foo: Foo, | ||
} | ||
|
||
public fun foo(ctx: &mut TxContext): Foo { | ||
Foo { id: object::new(ctx) } | ||
} | ||
|
||
public fun from_foo(foo: Foo, ctx: &mut TxContext): Bar { | ||
Bar { id: object::new(ctx), foo } | ||
} | ||
|
||
public fun into_foo(bar: Bar): Foo { | ||
let Bar { id, foo } = bar; | ||
object::delete(id); | ||
foo | ||
} | ||
} | ||
|
||
//# programmable --sender A --inputs @A | ||
//> 0: P0::m::foo(); | ||
//> TransferObjects([Result(0)], Input(0)) | ||
|
||
//# programmable --sender A --inputs @A object(2,0) | ||
//> 0: P0::m::from_foo(Input(1)); | ||
//> TransferObjects([Result(0)], Input(0)) | ||
|
||
//# programmable --sender A --inputs @A object(3,0) | ||
//> 0: P0::m::into_foo(Input(1)); | ||
//> TransferObjects([Result(0)], Input(0)) | ||
|
||
//# create-checkpoint | ||
|
||
//# run-graphql | ||
{ | ||
object1: object(address: "@{obj_2_0}") { | ||
digest | ||
} | ||
object2: object(address: "@{obj_3_0}") { | ||
digest | ||
} | ||
} | ||
|
||
//# programmable --sender A --inputs @A | ||
//> 0: P0::m::foo(); | ||
//> TransferObjects([Result(0)], Input(0)) | ||
|
||
//# programmable --sender A --inputs @A object(7,0) | ||
//> 0: P0::m::from_foo(Input(1)); | ||
//> TransferObjects([Result(0)], Input(0)) | ||
|
||
//# create-checkpoint | ||
|
||
//# run-graphql | ||
{ | ||
object1: object(address: "@{obj_7_0}") { | ||
digest | ||
} | ||
object2: object(address: "@{obj_8_0}") { | ||
digest | ||
} | ||
} | ||
|
||
//# programmable --sender A --inputs @A object(8,0) | ||
//> 0: P0::m::into_foo(Input(1)); | ||
//> TransferObjects([Result(0)], Input(0)) | ||
|
||
//# create-checkpoint | ||
|
||
//# run-graphql | ||
{ | ||
object1: object(address: "@{obj_7_0}") { | ||
digest | ||
} | ||
object2: object(address: "@{obj_8_0}") { | ||
digest | ||
} | ||
} |
Oops, something went wrong.