Skip to content

Fix Filecoin FEVM token sync status handling for enabled tokens #959

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Jon-edge
Copy link
Contributor

@Jon-edge Jon-edge commented Jul 11, 2025

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

@Jon-edge Jon-edge changed the title Fix Filecoin token sync status handling for enabled tokens Fix Filecoin FEVM token sync status handling for enabled tokens Jul 11, 2025
@Jon-edge Jon-edge force-pushed the jon/fix/filecoin-sync branch from 122bcca to 5cd305e Compare July 11, 2025 21:02
Copy link
Contributor

@peachbits peachbits left a comment

Choose a reason for hiding this comment

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

It looks like token transactions were never added to this plugin. Let's add that instead

https://filfox.info/api/v1/docs/static/index.html#/default/AddressController_tokenTransferList

@Jon-edge Jon-edge force-pushed the jon/fix/filecoin-sync branch from 5cd305e to 0632b00 Compare July 17, 2025 01:35
cursor[bot]

This comment was marked as outdated.

@Jon-edge Jon-edge force-pushed the jon/fix/filecoin-sync branch from 0632b00 to 9cb10a6 Compare July 17, 2025 22:24
cursor[bot]

This comment was marked as outdated.

const ourReceiveAddresses = []

// Token transfers don't have network fees in the same way as regular messages
const networkFee = '0'
Copy link
Contributor

Choose a reason for hiding this comment

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

Transfers have fees but the fees aren't visible in the transfers endpoint. https://filfox.info/api/v1/docs/static/index.html#/default/MessageController_info can get fees from a single transaction or https://filfox.info/api/v1/docs/static/index.html#/default/AddressController_messageTransferList produces a list of messages and the fee can be calculated (that endpoint shows total moved so you would have to subtract the amount to the recipient)

@@ -51,11 +57,25 @@ export class FilfoxAdapter extends NetworkAdapter<FilfoxAdapterConfig> {
const { publicAddress: addressString } =
await this.ethEngine.getFreshAddress()

const handleScanProgress = (progress: number): void => {
this.logError(
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 leftover debug logging, remove or comment out

@@ -139,6 +177,197 @@ export class FilfoxAdapter extends NetworkAdapter<FilfoxAdapterConfig> {
this.ethEngine.sendTransactionEvents()
}

// Initialize sync status for all enabled tokens to 0
private initializeSyncStatusForAllTokens(): void {
this.logError(
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 leftover debug logging, remove or comment out

let highestProcessedBlockHeight = startBlock

// Initialize sync status for all enabled tokens
this.initializeSyncStatusForAllTokens()
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this. Generally, sync status is used to describe the progress of initial sync and doesn't need to be reported once an asset reaches one. This change seems to make this.ethEngine.updateOnAddressesChecked() on line 89 run more frequently and for no benefit because once this.addressesChecked === true that line of code doesn't even do anything.

What's the point of doing this every time checkTransactions is called? It seems like

}

// Skip transfers prior to the startBlock (avoids reprocessing during resync)
if (tokenTransfer.height <= startBlock) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this check is duplicated and can be moved to where tokenTransfer is first defined

continue
}

// Skip transfers prior to the last sync height
Copy link
Contributor

Choose a reason for hiding this comment

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

this check is duplicated and can be moved to where tokenTransfer is first defined

'FilfoxAdapter token transfers scanning failed',
error instanceof Error ? error : new Error(String(error))
)
// If token transfer scanning fails, mark all tokens as complete to avoid blocking sync
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we try again if the fetch fails instead of faking the sync ratio?

cursor[bot]

This comment was marked as outdated.

@Jon-edge Jon-edge force-pushed the jon/fix/filecoin-sync branch from 5fc8fa7 to 9c45b00 Compare July 18, 2025 06:28
cursor[bot]

This comment was marked as outdated.

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.

2 participants