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(Dataworker): Dereference originChainId by index, not key #936

Merged
merged 5 commits into from
Sep 14, 2023

Conversation

pxrl
Copy link
Contributor

@pxrl pxrl commented Sep 11, 2023

Temporary fix to resolve an issue with future quoteTimestamps. We need a more robust solution than this in the long run.

Temporary fix to resolve an issue with future quoteTimestamps. We need a
more robust solution than this in the long run.
@pxrl
Copy link
Contributor Author

pxrl commented Sep 11, 2023

Hm; this is actually failing for me in local test, but I believe this fix is just unearthing a separate issue.

@@ -84,17 +84,21 @@ export function updateRunningBalanceForEarlyDeposit(
deposit: typechain.FundsDepositedEvent,
updateAmount: BigNumber
): void {
// deposit.args is a pure array; there are no mapping to be dereferenced.
const originChainId = deposit.args[1].toNumber();
Copy link
Contributor

Choose a reason for hiding this comment

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

We may want to wrap this as Number(String(deposit.args[1])) to ensure that we won't get a null reference. Alternatively - we can ensure that deposit.args[1] !== undefined

Copy link
Contributor

Choose a reason for hiding this comment

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

Will this work on a BN?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think .toString() will work on a BigNumber, not sure about String()

Copy link
Contributor

@james-a-morris james-a-morris left a comment

Choose a reason for hiding this comment

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

LGTM - pending linter

Copy link
Contributor

@mrice32 mrice32 left a comment

Choose a reason for hiding this comment

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

@mrice32 mrice32 merged commit e37ed76 into master Sep 14, 2023
2 checks passed
@mrice32 mrice32 deleted the pxrl/fixEarly branch September 14, 2023 23:22
nicholaspai pushed a commit that referenced this pull request Sep 20, 2023
* fix(Dataworker): Dereference originChainId by index, not key

Temporary fix to resolve an issue with future quoteTimestamps. We need a
more robust solution than this in the long run.

* Extract originToken from array

* lint

* WIP

Signed-off-by: Matt Rice <[email protected]>

---------

Signed-off-by: Matt Rice <[email protected]>
Co-authored-by: Matt Rice <[email protected]>
nicholaspai added a commit that referenced this pull request Sep 28, 2023
…tamps (#944)

* improve(dataworker): Remove `transferThreshold`

Fixes ACX-1537

Removes a lot of code needed to support deprecated config store variable that is always set to 0 in production

* Update Dataworker.ts

* bumpity

* Update Dataworker.ts

* Update package.json

* Update yarn.lock

* wip

* fix(Dataworker): Dereference originChainId by index, not key (#936)

* fix(Dataworker): Dereference originChainId by index, not key

Temporary fix to resolve an issue with future quoteTimestamps. We need a
more robust solution than this in the long run.

* Extract originToken from array

* lint

* WIP

Signed-off-by: Matt Rice <[email protected]>

---------

Signed-off-by: Matt Rice <[email protected]>
Co-authored-by: Matt Rice <[email protected]>

* improve: leverage default TTL & leverage caching (#938)

* improve: leverage default TTL

* improve: set fn signature to default

* feat: add dataworker force bundle range (#912)

* feat: add dataworker force bundle range

* docs: add documentation to example env

* improve: allow for boba

* improve: allow forced proposal range with sending

---------

Co-authored-by: Paul <[email protected]>

* feat: test chain routes (#897)

* feat: Script for automating SpokePool deposits

This is useful for making deposits to the zkSync SpokePool(s) because
zkSync's block explorer doesn't yet support making transactions via
proxy contracts.

* Add yarn script target + tweak usage

* Add basic support for dumping SpokePool config

* lint

* fix: Gracefully handle token searches where token missing

Not all tokens are defined on all chains, so don't try to drop case
unless the token actually exists on a chain.

* Add "fetch" for dumping deposit and fill information

Currently limitations:
 - Does not display updated values (i.e. after a speed-up).
 - Does not display message data.
 - Should normalise from the token decimals for better readability.
 - Does not gracefully handle when the txnHash is not found.

* lint

* fix conflict

* lint

* chore: allow base-units to easily be sent

* chore: allow token to be passed as origin token addr or symbol

* feat: test chain routes

* nit: improve docs

* docs: add docs

* improve: account for checksummed value

Co-authored-by: Paul <[email protected]>

* improve: remove unneeded flag

Co-authored-by: Paul <[email protected]>

* improve: docs

Co-authored-by: Paul <[email protected]>

* improve: do not hardcode amounts

* improve: modification

* improve: dynamically compute price

---------

Co-authored-by: Paul <[email protected]>
Co-authored-by: nicholaspai <[email protected]>

* WIP

* Update yarn.lock

* Revert "WIP"

This reverts commit 381e5bf.

* feat: Add protection against computing LP fees for future quote timestamps

This resolves the [reverted SDK PR](across-protocol/sdk#399) and re-introduces protection from deposit quote timestamps that are impossible to compute.

This PR essentially moves that protection to the production version of Hub and Spoke clients so that the unit tests can continue to work and not have to add additional logic to set quote times correctly. Ideally in the future we set the quote times how they would in production but for now this solution results in a much smaller code diff

* lint

* fix

* lint

* Update HubPoolClient.ts

* refactor: Import getNetworkName from sdk (#945)

* chore: bump sdk to latest (#943)

* chore: bump sdk to latest

* chore: bump version

* chore: bump sdk

---------

Signed-off-by: Matt Rice <[email protected]>
Co-authored-by: Paul <[email protected]>
Co-authored-by: Matt Rice <[email protected]>
Co-authored-by: James Morris, MS <[email protected]>
nicholaspai added a commit that referenced this pull request Sep 29, 2023
* improve(dataworker): Remove `transferThreshold`

Fixes ACX-1537

Removes a lot of code needed to support deprecated config store variable that is always set to 0 in production

* Update Dataworker.ts

* Update Dataworker.ts

* Update package.json

* Update yarn.lock

* wip

* WIP

* Update yarn.lock

* Revert "WIP"

This reverts commit 381e5bf.

* chore: bump sdk to latest (#943)

* chore: bump sdk to latest

* chore: bump version

* chore: bump sdk

* Update src/dataworker/Dataworker.ts

Co-authored-by: Paul <[email protected]>

* feat: Add protection against computing LP fees for future quote timestamps (#944)

* improve(dataworker): Remove `transferThreshold`

Fixes ACX-1537

Removes a lot of code needed to support deprecated config store variable that is always set to 0 in production

* Update Dataworker.ts

* bumpity

* Update Dataworker.ts

* Update package.json

* Update yarn.lock

* wip

* fix(Dataworker): Dereference originChainId by index, not key (#936)

* fix(Dataworker): Dereference originChainId by index, not key

Temporary fix to resolve an issue with future quoteTimestamps. We need a
more robust solution than this in the long run.

* Extract originToken from array

* lint

* WIP

Signed-off-by: Matt Rice <[email protected]>

---------

Signed-off-by: Matt Rice <[email protected]>
Co-authored-by: Matt Rice <[email protected]>

* improve: leverage default TTL & leverage caching (#938)

* improve: leverage default TTL

* improve: set fn signature to default

* feat: add dataworker force bundle range (#912)

* feat: add dataworker force bundle range

* docs: add documentation to example env

* improve: allow for boba

* improve: allow forced proposal range with sending

---------

Co-authored-by: Paul <[email protected]>

* feat: test chain routes (#897)

* feat: Script for automating SpokePool deposits

This is useful for making deposits to the zkSync SpokePool(s) because
zkSync's block explorer doesn't yet support making transactions via
proxy contracts.

* Add yarn script target + tweak usage

* Add basic support for dumping SpokePool config

* lint

* fix: Gracefully handle token searches where token missing

Not all tokens are defined on all chains, so don't try to drop case
unless the token actually exists on a chain.

* Add "fetch" for dumping deposit and fill information

Currently limitations:
 - Does not display updated values (i.e. after a speed-up).
 - Does not display message data.
 - Should normalise from the token decimals for better readability.
 - Does not gracefully handle when the txnHash is not found.

* lint

* fix conflict

* lint

* chore: allow base-units to easily be sent

* chore: allow token to be passed as origin token addr or symbol

* feat: test chain routes

* nit: improve docs

* docs: add docs

* improve: account for checksummed value

Co-authored-by: Paul <[email protected]>

* improve: remove unneeded flag

Co-authored-by: Paul <[email protected]>

* improve: docs

Co-authored-by: Paul <[email protected]>

* improve: do not hardcode amounts

* improve: modification

* improve: dynamically compute price

---------

Co-authored-by: Paul <[email protected]>
Co-authored-by: nicholaspai <[email protected]>

* WIP

* Update yarn.lock

* Revert "WIP"

This reverts commit 381e5bf.

* feat: Add protection against computing LP fees for future quote timestamps

This resolves the [reverted SDK PR](across-protocol/sdk#399) and re-introduces protection from deposit quote timestamps that are impossible to compute.

This PR essentially moves that protection to the production version of Hub and Spoke clients so that the unit tests can continue to work and not have to add additional logic to set quote times correctly. Ideally in the future we set the quote times how they would in production but for now this solution results in a much smaller code diff

* lint

* fix

* lint

* Update HubPoolClient.ts

* refactor: Import getNetworkName from sdk (#945)

* chore: bump sdk to latest (#943)

* chore: bump sdk to latest

* chore: bump version

* chore: bump sdk

---------

Signed-off-by: Matt Rice <[email protected]>
Co-authored-by: Paul <[email protected]>
Co-authored-by: Matt Rice <[email protected]>
Co-authored-by: James Morris, MS <[email protected]>

---------

Signed-off-by: Matt Rice <[email protected]>
Co-authored-by: James Morris, MS <[email protected]>
Co-authored-by: Paul <[email protected]>
Co-authored-by: Matt Rice <[email protected]>
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.

3 participants