Open telezhnaya opened 2 years ago
@telezhnaya could you check please, I've made near-lake-indexer to run against that block again.
@khorolets ideally, we should have looked at what was the state of those files before rewriting and why near-lake-framework-rs passed incomplete StreamMessage down the line 🧐
@khorolets we still have this problem
OK, I've checked. I want to pass it on to you @telezhnaya I've found the ExecutionOutcome
for that Receipt
in the block 22635169
May I ask you to find out why the heck the ExecutionOutcome
for Receipt
6QKTEHsLihDgVrdtWYbURA28zF29Xdw5dnfWbDVWHPv4
is stored as executed_in_block_hash
of
68v7s5fg8inLQ2VVnFvZ375bbbx1akU4kbH8ezo6RyFg
in Indexer for Explore Database if it was executed in 5WEpxdCAouEwxtbPrBuVmztX9X4cbnbfgWrnTHbvUWM8
? O_o
Are you sure it's for me? We just listen to the blockchain, we don't create this data from nowhere Maybe we need to summon someone from the core team?
@telezhnaya My main concern is why we have stored that piece of data in indexer for explorer db the way we have. Let's not bother protocol team unless we have any evidence.
I am going to check the archival indexer data to narrow down the questions who's mistake is that and will update you.
My checks on the archival node with Indexer Framework prove that ExecutionOutcome
for that receipt is included in block 22635169
.
Since the data reflected by Lake Indexer is correct I am closing this issue and I am going to open an issue on Indexer for Explorer project to figure out the reason the record in the database is incorrect.
I feel it's still an issue for this project. Indexer balances, where I've found this issue initially, has no dependency to indexer-for-explorer. I mentioned indexer-for-explorer here just because it's the convenient way to look at the data.
Inside lake, we have json with block 22633808, where one field explicitly says "hey, we have the other useful data in the other field", and the second field is empty
I disagree. Lake indexer doesn't say we have execution outcome for this receipt in that block. Have a look at my comment with attached logs from Indexer Framework. The block you refer to just doesn't contain ExecutionOutcome
.
At json about block 22633808, we see this
StateChangeWithCauseView {
cause: ReceiptProcessing {
receipt_hash: `6QKTEHsLihDgVrdtWYbURA28zF29Xdw5dnfWbDVWHPv4`,
},
value: AccountUpdate {
account_id: AccountId(
"aspaceodyssey2001.near",
),
account: AccountView {
amount: 5087754972079500200000000,
locked: 0,
code_hash: `11111111111111111111111111111111`,
storage_usage: 182,
storage_paid_at: 0,
},
},
},
The fee was taken. As I understand the blockchain logic, it means that the receipt should be executed in the same block.
Wow, it looks like it's not the fee.
I'm naive and I still believe indexer-for-explorer data
According to that, 3.08 NEAR came to aspaceodyssey2001.near
at block 22633808.
So I'm totally lost.
Do you have any idea why may we have such balance change?
I need to handle such situations at https://github.com/near/near-indexer-balances
The more confusing for me is why such a situation is so unique
For future me: 3.08 is found by writing the query (the timestamps picked up randomly)
select * from account_changes
where account_changes.affected_account_id = 'aspaceodyssey2001.near' and
account_changes.changed_in_block_timestamp > 1604411776828600726
and account_changes.changed_in_block_timestamp <= 1605411776828600726;
plus some calc (5087754972079500200000000 - 2000000000000000000000000) / 10**24
@khorolets @telezhnaya This was an instance of duplicate transaction execution. Blocks #22633807
and #22635168
contain transaction J4CZZQrZK6kYPVLkrdbTEpcqhUNZiRxktbMzHviqeGgf
. The implicit account was initially created by a transfer call at block #22633373
, then it was deleted with a transaction at block #22633807
(unfortunately, Indexer for Explorer Postgres does not reflect it, so you will have to make a chunks
RPC call, see below), and then the account was re-created at block #22634878
with a new transfer, and then the previous account deletion transaction got re-played (due to the nonce tracking issue; after the account was re-created, the nonce got reset to zero and now exactly the same transaction became valid again as its nonce is greater than the current one [zero]) and was executed again at block #22635168
, which deleted the implicit account again and transferred all the tokens to aspaceodyssey2001.near
(I can only hope that the tokens anyway were designated to be transferred to that account as otherwise it would lead to someone transferring more tokens than intended)
http post https://archival-rpc.mainnet.near.org jsonrpc=2.0 method=chunk params:='{"block_id": 22633807, "shard_id": 0}' id=dontcare
http post https://archival-rpc.mainnet.near.org jsonrpc=2.0 method=chunk params:='{"block_id": 22635168, "shard_id": 0}' id=dontcare
then it was deleted with a transaction at block #22633807 (unfortunately, Indexer for Explorer Postgres does not reflect it, so you will have to make a chunks RPC call, see below)
Here are the transaction and the receipt you're referring to, I believe: https://explorer.near.org/blocks/CVMvbRjcTJ4cbJsn2fNqWQgXmUffWsJs2pg2chRRnSDf
Thank you @frol for digging into it. Your input is very useful!
We're trying to understand the data flow behind these actions. Talking about blocks #22633807
and #22633808
. We see the:
Transaction
with DeleteAccount
in #22633807
Transaction
is converted into Receipt
FA9zcm7WkWxdjkub7WFiKkQdnnQrcEmBht94VFzXfkm1
Receipt
FA9zcm7WkWxdjkub7WFiKkQdnnQrcEmBht94VFzXfkm1
is immediately executed in the same block. And it contains status: SuccessValue(``)
and receipt_ids: [ '6QKTEHsLihDgVrdtWYbURA28zF29Xdw5dnfWbDVWHPv4' ]
Receipt
6QKTEHsLihDgVrdtWYbURA28zF29Xdw5dnfWbDVWHPv4
is included in the very next block #22633808
. But receipt_execution_outcomes: []
is empty for the block #22633808
, though StateChangeWithCauseView
with cause ReceiptProcessing
for the Receipt
6QKTEHsLihDgVrdtWYbURA28zF29Xdw5dnfWbDVWHPv4
is present.
At the same time, Indexer for Explorer says the Receipt
6QKTEHsLihDgVrdtWYbURA28zF29Xdw5dnfWbDVWHPv4
is executed in block #22633808
. I've managed to find the ExecutionOutcome
with Lake and Indexer Frameworks in block #22635169
.
So my main assumption is that we might have introduced some changes to the Indexer Framework that we are no longer able to collect the Receipt
6QKTEHsLihDgVrdtWYbURA28zF29Xdw5dnfWbDVWHPv4
for block #22633808
while it should be there (it used to be there where we were indexing that block with Indexer for Explorer).
What do you think?
So my main assumption is that we might have introduced some changes to the Indexer Framework that we are no longer able to collect the Receipt 6QKTEHsLihDgVrdtWYbURA28zF29Xdw5dnfWbDVWHPv4 for block #22633808 while it should be there (it used to be there where we were indexing that block with Indexer for Explorer).
This is an unpleasant mystery. I have no better guesses, but I don't see how that could have happened.
While investigating https://github.com/telezhnaya/indexer_balances/issues/1, I've found the issue We have the receipt in this block, but we don't have execution_outcome
Please check why
receipt_execution_outcomes
is empty for block 22633808