Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix (#patch); euler-finance; fix oneshot cancelled error #1174

Closed
wants to merge 6 commits into from

Conversation

tnkrxyz
Copy link
Collaborator

@tnkrxyz tnkrxyz commented Oct 9, 2022

This is a quick fix for the error from euler finance subgraph deployment on recent blocks:

Subgraph failed with non-deterministic error: failed to process trigger: block #15700199 (0x1567…983b), transaction 102d9eb3d096d5cfc74ba56ea7c3b0ebfc30454d7f3d000fd42c1307f746c2cf: Mapping terminated before passing in trigger: send failed because receiver is gone, retry_delay_s: 1800, attempt: 95

and the underlying error msg

"message": "failed to process trigger: block #15700199 (0x1567…983b), transaction 102d9eb3d096d5cfc74ba56ea7c3b0ebfc30454d7f3d000fd42c1307f746c2cf: Mapping terminated before handling trigger: oneshot canceled"

Ready to review/merge if verified working https://thegraph.com/hosted-service/subgraph/tnkrxyz/euler?version=pending&selected=logs

@tnkrxyz
Copy link
Collaborator Author

tnkrxyz commented Oct 10, 2022

The fix solves the "oneshot cancelled" error, but the revenues are wrong without fixing the implementation to get interest revenue from AssetStatus event as discussed in #1139

@tnkrxyz tnkrxyz force-pushed the euler-oneshot-fix branch 2 times, most recently from 89e62a5 to 73694e7 Compare October 13, 2022 07:10
@tnkrxyz
Copy link
Collaborator Author

tnkrxyz commented Oct 14, 2022

lint issues will be fixed in a separate PR

@tnkrxyz
Copy link
Collaborator Author

tnkrxyz commented Oct 14, 2022

It is finally working: https://thegraph.com/hosted-service/subgraph/tnkrxyz/euler?version=pending&selected=logs (with grafting) and https://thegraph.com/hosted-service/subgraph/tnkrxyz/test-subgraph?version=pending&selected=logs (fresh deployment without grafting)
but the grafting doesn't work because the new implementation needs to know the previous reserveBalances. The difference in syncing time with and without grafting isn't much difference any way.

@tnkrxyz tnkrxyz marked this pull request as ready for review October 14, 2022 10:53
@tnkrxyz tnkrxyz requested a review from melotik October 14, 2022 10:53
const totalBorrows = event.params.totalBorrows;
const reserveBalance = event.params.reserveBalance;
const interestAccumulator = event.params.interestAccumulator;
//const interstRate = event.params.interestRate;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line

}

export function handleGovSetAssetConfig(event: GovSetAssetConfig): void {
updateLendingFactors(event);
updateLendingFactors(event);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fine, but generally you don't want to make formatting changes to lines of code outside of the scope of the PR.

This will be better when we have a standard format across the whole repo, but something to keep in mind.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly just because it makes the PR more messy

Copy link
Collaborator Author

@tnkrxyz tnkrxyz Oct 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I use prettier addon for vscode to automatically format the file when I save. I will revert the format changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to revert if it gets too messy


if (protocolUtility.lastBlockNumber >= blockNumber - 120 ) {
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like there is still a lot of cleaning up of comments before it is ready to merge

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove the commented lines

const token = getOrCreateToken(underlying);
const assetStatus = getOrCreateAssetStatus(marketId);

assert(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you using asserts here?

I think we should stick with the error checking patterns that we use throughout the repo

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix

let protocolUtility = getOrCreateProtocolUtility(blockNumber);
let markets = protocolUtility.markets;
const marketIndex = markets.indexOf(marketId);
assert(marketIndex >= 0, `[updateProtocolAndMarkets]marketId=${marketId} not in protocolUtility.markets`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix

@tnkrxyz
Copy link
Collaborator Author

tnkrxyz commented Oct 15, 2022

@dmelotik based on our discussion on discord, I will commit the minimal fix in a separate PR (and test it with even small chunk size). We can assess which one to merge.

@tnkrxyz
Copy link
Collaborator Author

tnkrxyz commented Oct 16, 2022

@dmelotik based on our discussion on discord, I will commit the minimal fix in a separate PR (and test it with even small chunk size). We can assess which one to merge.

The deployment of the minimal fix with even smaller chunk size (2 markets) still failed. And it makes me think I probably mis-diagnosed the root cause. The problem is still within the loop, but one of the markets (specifically, 0xc00e94cb662c3520282e6f5717214004a7f26888) is causing the error at block 15700199, instead of the size of the loop. I will hold off moving forward with this PR and hope to figure out why the market is causing the error and fix the problem there.

@tnkrxyz
Copy link
Collaborator Author

tnkrxyz commented Oct 17, 2022

Close this PR as it is replaced by #1213

@tnkrxyz tnkrxyz closed this Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants