Skip to content

Commit

Permalink
indexer: affected objects include created+wrapped/unwrapped+deleted (#…
Browse files Browse the repository at this point in the history
…19618)

## Description

Broaden the definition of "affected object" to include objects that a
transaction creates and then immediately wraps, or objects that it
unwraps and then immediately deletes. This ensures that a transaction
will show up in the response to an `affectedObject` query if and only if
the Object's ID shows up in its `objectChanges` response.

## Test plan

Updated GraphQL E2E test:

```
sui$ cargo nextest run -p sui-graphql-e2e-tests \
  --features staging -- affected_object
```

## Stack

- #19474 
- #19614 
- #19615 
- #19616 
- #19617

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [x] Indexer: A transaction's "affected objects" include objects that
it created and wrapped, or unwrapped.
- [x] JSON-RPC: A transaction's "affected objects" include objects that
it created and wrapped, or unwrapped.
- [x] GraphQL: A transaction's "affected objects" include objects that
it created and wrapped, or unwrapped.
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
amnn authored Sep 30, 2024
1 parent 9c6029b commit f30dfc9
Show file tree
Hide file tree
Showing 5 changed files with 244 additions and 70 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
processed 15 tasks
processed 23 tasks

init:
A: object(0,0)
Expand Down Expand Up @@ -33,67 +33,130 @@ created: object(4,0)
mutated: object(0,0)
gas summary: computation_cost: 1000000, storage_cost: 2295200, storage_rebate: 978120, non_refundable_storage_fee: 9880

task 5, lines 70-71:
task 5, lines 70-73:
//# programmable --sender A --inputs 4 @A
//> P::M::new(Input(0));
//> P::M::wrap(Result(0));
//> TransferObjects([Result(1)], Input(1))
created: object(5,0)
mutated: object(0,0)
gas summary: computation_cost: 1000000, storage_cost: 2546000, storage_rebate: 978120, non_refundable_storage_fee: 9880

task 6, lines 75-76:
//# programmable --sender A --inputs object(2,0)
//> P::M::inc(Input(0))
mutated: object(0,0), object(2,0)
gas summary: computation_cost: 1000000, storage_cost: 2295200, storage_rebate: 2272248, non_refundable_storage_fee: 22952

task 6, lines 73-75:
task 7, lines 78-79:
//# programmable --sender A --inputs object(5,0)
//> P::M::incw(Input(0))
mutated: object(0,0), object(5,0)
gas summary: computation_cost: 1000000, storage_cost: 2546000, storage_rebate: 2520540, non_refundable_storage_fee: 25460

task 8, lines 81-83:
//# programmable --sender A --inputs object(2,0) @A
//> P::M::wrap(Input(0));
//> TransferObjects([Result(0)], Input(1))
created: object(6,0)
created: object(8,0)
mutated: object(0,0)
wrapped: object(2,0)
gas summary: computation_cost: 1000000, storage_cost: 2546000, storage_rebate: 2272248, non_refundable_storage_fee: 22952

task 7, lines 77-78:
//# programmable --sender A --inputs object(6,0)
task 9, lines 85-86:
//# programmable --sender A --inputs object(8,0)
//> P::M::incw(Input(0))
mutated: object(0,0), object(6,0)
mutated: object(0,0), object(8,0)
gas summary: computation_cost: 1000000, storage_cost: 2546000, storage_rebate: 2520540, non_refundable_storage_fee: 25460

task 8, lines 80-82:
//# programmable --sender A --inputs object(6,0) @A
task 10, lines 88-90:
//# programmable --sender A --inputs object(8,0) @A
//> P::M::unwrap(Input(0));
//> TransferObjects([Result(0)], Input(1))
mutated: object(0,0)
unwrapped: object(2,0)
deleted: object(6,0)
deleted: object(8,0)
gas summary: computation_cost: 1000000, storage_cost: 2295200, storage_rebate: 2520540, non_refundable_storage_fee: 25460

task 9, lines 84-85:
task 11, lines 92-93:
//# programmable --sender A --inputs object(3,0) object(2,0)
//> P::M::transfer(Input(0), Input(1))
mutated: object(0,0), object(2,0), object(3,0)
gas summary: computation_cost: 1000000, storage_cost: 3602400, storage_rebate: 3566376, non_refundable_storage_fee: 36024

task 10, lines 87-88:
task 12, lines 95-96:
//# programmable --sender A --inputs receiving(2,0)
//> P::M::drop_receiving(Input(0))
mutated: object(0,0)
gas summary: computation_cost: 1000000, storage_cost: 988000, storage_rebate: 978120, non_refundable_storage_fee: 9880

task 11, lines 90-92:
task 13, lines 98-100:
//# programmable --sender A --inputs object(4,0) receiving(2,0) @A
//> P::M::receive(Input(0), Input(1));
//> TransferObjects([Result(0)], Input(2))
Error: Transaction Effects Status: Move Runtime Abort. Location: sui::transfer::receive_impl (function index 12) at offset 0, Abort Code: 3
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: sui, name: Identifier("transfer") }, function: 12, instruction: 0, function_name: Some("receive_impl") }, 3), source: Some(VMError { major_status: ABORTED, sub_status: Some(3), message: None, exec_state: None, location: Module(ModuleId { address: sui, name: Identifier("transfer") }), indices: [], offsets: [(FunctionDefinitionIndex(12), 0)] }), command: Some(0) } }

task 12, lines 94-96:
task 14, lines 102-104:
//# programmable --sender A --inputs object(3,0) receiving(2,0) @A
//> P::M::receive(Input(0), Input(1));
//> TransferObjects([Result(0)], Input(2))
mutated: object(0,0), object(2,0), object(3,0)
gas summary: computation_cost: 1000000, storage_cost: 3602400, storage_rebate: 3566376, non_refundable_storage_fee: 36024

task 13, line 98:
task 15, lines 106-107:
//# programmable --sender A --inputs object(2,0)
//> P::M::destroy(Input(0))
mutated: object(0,0)
deleted: object(2,0)
gas summary: computation_cost: 1000000, storage_cost: 988000, storage_rebate: 2272248, non_refundable_storage_fee: 22952

task 16, lines 109-110:
//# programmable --sender A --inputs object(3,0)
//> P::M::destroy(Input(0))
mutated: object(0,0)
deleted: object(3,0)
gas summary: computation_cost: 1000000, storage_cost: 988000, storage_rebate: 2272248, non_refundable_storage_fee: 22952

task 17, lines 112-113:
//# programmable --sender A --inputs object(4,0)
//> P::M::destroy(Input(0))
mutated: object(0,0)
deleted: object(4,0)
gas summary: computation_cost: 1000000, storage_cost: 988000, storage_rebate: 2272248, non_refundable_storage_fee: 22952

task 18, lines 115-117:
//# programmable --sender A --inputs object(5,0) @A
//> P::M::unwrap(Input(0));
//> TransferObjects([Result(0)], Input(1))
mutated: object(0,0)
unwrapped: object(18,0)
deleted: object(5,0)
gas summary: computation_cost: 1000000, storage_cost: 2295200, storage_rebate: 2520540, non_refundable_storage_fee: 25460

task 19, lines 119-121:
//# programmable --sender A --inputs object(18,0) @A
//> P::M::wrap(Input(0));
//> TransferObjects([Result(0)], Input(1))
created: object(19,0)
mutated: object(0,0)
wrapped: object(18,0)
gas summary: computation_cost: 1000000, storage_cost: 2546000, storage_rebate: 2272248, non_refundable_storage_fee: 22952

task 20, lines 123-125:
//# programmable --sender A --inputs object(19,0)
//> P::M::unwrap(Input(0));
//> P::M::destroy(Result(0))
mutated: object(0,0)
deleted: object(19,0)
unwrapped_then_deleted: object(18,0)
gas summary: computation_cost: 1000000, storage_cost: 988000, storage_rebate: 2520540, non_refundable_storage_fee: 25460

task 21, line 127:
//# create-checkpoint
Checkpoint created: 1

task 14, lines 100-115:
task 22, lines 129-150:
//# run-graphql
Response: {
"data": {
Expand All @@ -109,28 +172,52 @@ Response: {
"digest": "3qPssWeR5bvwaZiwkjbYTkR7ng9XSDp7aaky8A4DJp6S"
},
{
"digest": "9iRKWAoNUXAnBbA2sajqXN7wV4t6XvgHaqhTmMW6TcDi"
"digest": "CU6apQSKPqGNqSxg2D5v3TVFzbDmx4gPhLEaJwiiWqXC"
},
{
"digest": "5E5JyrSFLvhB2EcN74bUk4dEpm23jGP2GRnVK4JCBCTa"
},
{
"digest": "2jmmPvyktGqZcF5KFNmNvyisGwRwkvRWqGzmoY8Mucda"
},
{
"digest": "ELRa9MREFjzU2wuUTN8hkoUQ57FhEiuPCbvWyDEAZLRr"
},
{
"digest": "2AdEFXvVLU8eXS5VamF1Dcn2VfqXdy46BFgiaawaMaTY"
},
{
"digest": "4Wx6uuwb2swwLwYghbFvGyt6ReKiKX7eUsXZY16y23to"
},
{
"digest": "D6NJc8Mg1cqXPXTdVCtVmHbxzyepNBh26K6mfUmW7pxU"
},
{
"digest": "GT6fS3ko7JHfHvFmMg7AdZ2xTf1gjmckvrJSTRXSbLKt"
"digest": "2DXNdmsHtk4YvcJKbb4hKSggWqRwxzXxDyVBzDAdotDZ"
},
{
"digest": "2VpJzfhaw4oHY5LW2SLHsrYVYHHPjotB1fjwbks27VjF"
"digest": "GPSMkMRGn4X9VY41STGdDR8tFC2pneWuCtXkdjqhZiZP"
},
{
"digest": "3sGvS3VJnsdTVLNi14Xe7AaaaqsWwMc8ohbWEb6BNSWV"
"digest": "3bAse3nV4m79aUEq8hAVVeDuJGMs4qtyHQUJUKLoyhnQ"
},
{
"digest": "4yvTSsQXNH9nJeU1yXG66bFBkq9DFdYMNYyanvp8qqLi"
"digest": "2uiRgJ2ddzdhy32JpxBt3gajXNz1GyRr6zQjBgnnzwDW"
},
{
"digest": "CLgQXbBzTdre9fgFkZbN9NzcQe4f3fAsg2NowXFCEpJ5"
"digest": "3vLFyUwCW4jC6kVhqcgtpVpMSVKxX63nNfKqRqQKW1Hg"
},
{
"digest": "B6avepddy14XNQf7Bwv1YL5Kt6JKj4wuFgkwNrGTDa3Y"
"digest": "92UgLjnEiiRkxWuxME8wD3Bh439gMX7RTtRoZm3G29Lx"
},
{
"digest": "HHKfCgrv9gBQ6j3sGK7qDNDahmYzK8Rf3on6JGA4DanS"
"digest": "CqYXBbBtW4nNGp66DtDuEsexmVUgasqRX1cwD2o9mojr"
},
{
"digest": "9A8Nc4qZkEVpRSemjZ7kVJSdTzJbPGxKijPy86ZsWSK3"
},
{
"digest": "Du8zQ2HM6GzfdZDpwobpntZfrQReEqkDyKCeBoXGeEEA"
}
]
},
Expand All @@ -140,32 +227,38 @@ Response: {
"digest": "EAu7t7RFbwASW5ZLxtqa33ody8xidNR3U3KFKBKAFU5q"
},
{
"digest": "9iRKWAoNUXAnBbA2sajqXN7wV4t6XvgHaqhTmMW6TcDi"
"digest": "5E5JyrSFLvhB2EcN74bUk4dEpm23jGP2GRnVK4JCBCTa"
},
{
"digest": "ELRa9MREFjzU2wuUTN8hkoUQ57FhEiuPCbvWyDEAZLRr"
},
{
"digest": "GT6fS3ko7JHfHvFmMg7AdZ2xTf1gjmckvrJSTRXSbLKt"
"digest": "4Wx6uuwb2swwLwYghbFvGyt6ReKiKX7eUsXZY16y23to"
},
{
"digest": "3sGvS3VJnsdTVLNi14Xe7AaaaqsWwMc8ohbWEb6BNSWV"
"digest": "D6NJc8Mg1cqXPXTdVCtVmHbxzyepNBh26K6mfUmW7pxU"
},
{
"digest": "4yvTSsQXNH9nJeU1yXG66bFBkq9DFdYMNYyanvp8qqLi"
"digest": "3bAse3nV4m79aUEq8hAVVeDuJGMs4qtyHQUJUKLoyhnQ"
},
{
"digest": "HHKfCgrv9gBQ6j3sGK7qDNDahmYzK8Rf3on6JGA4DanS"
"digest": "2uiRgJ2ddzdhy32JpxBt3gajXNz1GyRr6zQjBgnnzwDW"
}
]
},
"input2": {
"nodes": [
{
"digest": "9iRKWAoNUXAnBbA2sajqXN7wV4t6XvgHaqhTmMW6TcDi"
"digest": "5E5JyrSFLvhB2EcN74bUk4dEpm23jGP2GRnVK4JCBCTa"
},
{
"digest": "ELRa9MREFjzU2wuUTN8hkoUQ57FhEiuPCbvWyDEAZLRr"
},
{
"digest": "GT6fS3ko7JHfHvFmMg7AdZ2xTf1gjmckvrJSTRXSbLKt"
"digest": "D6NJc8Mg1cqXPXTdVCtVmHbxzyepNBh26K6mfUmW7pxU"
},
{
"digest": "4yvTSsQXNH9nJeU1yXG66bFBkq9DFdYMNYyanvp8qqLi"
"digest": "2uiRgJ2ddzdhy32JpxBt3gajXNz1GyRr6zQjBgnnzwDW"
}
]
},
Expand All @@ -175,16 +268,16 @@ Response: {
"digest": "EAu7t7RFbwASW5ZLxtqa33ody8xidNR3U3KFKBKAFU5q"
},
{
"digest": "9iRKWAoNUXAnBbA2sajqXN7wV4t6XvgHaqhTmMW6TcDi"
"digest": "5E5JyrSFLvhB2EcN74bUk4dEpm23jGP2GRnVK4JCBCTa"
},
{
"digest": "3sGvS3VJnsdTVLNi14Xe7AaaaqsWwMc8ohbWEb6BNSWV"
"digest": "4Wx6uuwb2swwLwYghbFvGyt6ReKiKX7eUsXZY16y23to"
},
{
"digest": "4yvTSsQXNH9nJeU1yXG66bFBkq9DFdYMNYyanvp8qqLi"
"digest": "D6NJc8Mg1cqXPXTdVCtVmHbxzyepNBh26K6mfUmW7pxU"
},
{
"digest": "HHKfCgrv9gBQ6j3sGK7qDNDahmYzK8Rf3on6JGA4DanS"
"digest": "3bAse3nV4m79aUEq8hAVVeDuJGMs4qtyHQUJUKLoyhnQ"
}
]
},
Expand All @@ -194,20 +287,26 @@ Response: {
"digest": "9Gorn5uVdjc7eHBW3WafnpiqQfYg6iPSkxhZ6CbuBqwk"
},
{
"digest": "4yvTSsQXNH9nJeU1yXG66bFBkq9DFdYMNYyanvp8qqLi"
"digest": "D6NJc8Mg1cqXPXTdVCtVmHbxzyepNBh26K6mfUmW7pxU"
},
{
"digest": "3bAse3nV4m79aUEq8hAVVeDuJGMs4qtyHQUJUKLoyhnQ"
},
{
"digest": "HHKfCgrv9gBQ6j3sGK7qDNDahmYzK8Rf3on6JGA4DanS"
"digest": "3vLFyUwCW4jC6kVhqcgtpVpMSVKxX63nNfKqRqQKW1Hg"
}
]
},
"input3": {
"nodes": [
{
"digest": "4yvTSsQXNH9nJeU1yXG66bFBkq9DFdYMNYyanvp8qqLi"
"digest": "D6NJc8Mg1cqXPXTdVCtVmHbxzyepNBh26K6mfUmW7pxU"
},
{
"digest": "HHKfCgrv9gBQ6j3sGK7qDNDahmYzK8Rf3on6JGA4DanS"
"digest": "3bAse3nV4m79aUEq8hAVVeDuJGMs4qtyHQUJUKLoyhnQ"
},
{
"digest": "3vLFyUwCW4jC6kVhqcgtpVpMSVKxX63nNfKqRqQKW1Hg"
}
]
},
Expand All @@ -217,10 +316,10 @@ Response: {
"digest": "9Gorn5uVdjc7eHBW3WafnpiqQfYg6iPSkxhZ6CbuBqwk"
},
{
"digest": "4yvTSsQXNH9nJeU1yXG66bFBkq9DFdYMNYyanvp8qqLi"
"digest": "D6NJc8Mg1cqXPXTdVCtVmHbxzyepNBh26K6mfUmW7pxU"
},
{
"digest": "HHKfCgrv9gBQ6j3sGK7qDNDahmYzK8Rf3on6JGA4DanS"
"digest": "3bAse3nV4m79aUEq8hAVVeDuJGMs4qtyHQUJUKLoyhnQ"
}
]
},
Expand All @@ -230,14 +329,20 @@ Response: {
"digest": "3qPssWeR5bvwaZiwkjbYTkR7ng9XSDp7aaky8A4DJp6S"
},
{
"digest": "B6avepddy14XNQf7Bwv1YL5Kt6JKj4wuFgkwNrGTDa3Y"
"digest": "GPSMkMRGn4X9VY41STGdDR8tFC2pneWuCtXkdjqhZiZP"
},
{
"digest": "92UgLjnEiiRkxWuxME8wD3Bh439gMX7RTtRoZm3G29Lx"
}
]
},
"input4": {
"nodes": [
{
"digest": "B6avepddy14XNQf7Bwv1YL5Kt6JKj4wuFgkwNrGTDa3Y"
"digest": "GPSMkMRGn4X9VY41STGdDR8tFC2pneWuCtXkdjqhZiZP"
},
{
"digest": "92UgLjnEiiRkxWuxME8wD3Bh439gMX7RTtRoZm3G29Lx"
}
]
},
Expand All @@ -247,7 +352,37 @@ Response: {
"digest": "3qPssWeR5bvwaZiwkjbYTkR7ng9XSDp7aaky8A4DJp6S"
},
{
"digest": "B6avepddy14XNQf7Bwv1YL5Kt6JKj4wuFgkwNrGTDa3Y"
"digest": "GPSMkMRGn4X9VY41STGdDR8tFC2pneWuCtXkdjqhZiZP"
}
]
},
"affect5": {
"nodes": [
{
"digest": "CU6apQSKPqGNqSxg2D5v3TVFzbDmx4gPhLEaJwiiWqXC"
},
{
"digest": "CqYXBbBtW4nNGp66DtDuEsexmVUgasqRX1cwD2o9mojr"
},
{
"digest": "9A8Nc4qZkEVpRSemjZ7kVJSdTzJbPGxKijPy86ZsWSK3"
},
{
"digest": "Du8zQ2HM6GzfdZDpwobpntZfrQReEqkDyKCeBoXGeEEA"
}
]
},
"input5": {
"nodes": [
{
"digest": "9A8Nc4qZkEVpRSemjZ7kVJSdTzJbPGxKijPy86ZsWSK3"
}
]
},
"change5": {
"nodes": [
{
"digest": "CqYXBbBtW4nNGp66DtDuEsexmVUgasqRX1cwD2o9mojr"
}
]
}
Expand Down
Loading

0 comments on commit f30dfc9

Please sign in to comment.