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: blockhash syncing #727

Merged
merged 4 commits into from
Dec 5, 2024
Merged

Conversation

FedericoAmura
Copy link
Contributor

@FedericoAmura FedericoAmura commented Nov 29, 2024

Description

Added some safety measures when syncing blockhash. More specifically:

  • verify fetch response from block-indexer is successful to avoid using error responses with undefined blockhashes
  • use previous-to-last blockhash from public providers on fallback to avoid using a blockhash not yet propagated to nodes
  • use block timestamp instead of user one as that is the one that defines if blockhash is still valid

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Added unit tests for LitCore
  • Local run of CI tests

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

…s. Verify lit block indexer response success. Use a previous block from public providers to avoid using one nodes haven't received yet
Copy link
Collaborator

@Ansonhkg Ansonhkg left a comment

Choose a reason for hiding this comment

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

LGTM - awaiting test results since our CI is broken atm.

@FedericoAmura
Copy link
Contributor Author

LGTM - awaiting test results since our CI is broken atm.

Unfiltered local run against datil-dev passed

testUseEoaSessionSigsToExecuteJsSigning - Passed (4492.59 ms)
testUseEoaSessionSigsToPkpSign - Passed (4216.93 ms)
testUseEoaSessionSigsToExecuteJsSigningInParallel - Passed (4419.70 ms)
testUseEoaSessionSigsToExecuteJsClaimKeys - Passed (4332.09 ms)
testUseEoaSessionSigsToExecuteJsClaimMultipleKeys - Passed (3794.40 ms)
testUseEoaSessionSigsToExecuteJsJsonResponse - Passed (4162.39 ms)
testUseEoaSessionSigsToExecuteJsConsoleLog - Passed (4142.40 ms)
testUseEoaSessionSigsToEncryptDecryptString - Passed (3896.05 ms)
testUseEoaSessionSigsToEncryptDecryptUint8Array - Passed (3835.09 ms)
testUseEoaSessionSigsToEncryptDecryptFile - Passed (4349.61 ms)
testUsePkpSessionSigsToExecuteJsSigning - Passed (5591.88 ms)
testUsePkpSessionSigsToPkpSign - Passed (5535.95 ms)
testUsePkpSessionSigsToExecuteJsSigningInParallel - Passed (5250.42 ms)
testUsePkpSessionSigsToExecuteJsClaimKeys - Passed (5030.21 ms)
testUsePkpSessionSigsToExecuteJsClaimMultipleKeys - Passed (4627.16 ms)
testUsePkpSessionSigsToExecuteJsJsonResponse - Passed (5172.06 ms)
testUsePkpSessionSigsToExecuteJsConsoleLog - Passed (5229.91 ms)
testUsePkpSessionSigsToEncryptDecryptString - Passed (5042.91 ms)
testUsePkpSessionSigsToEncryptDecryptFile - Passed (5184.51 ms)
testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning - Passed (5428.35 ms)
testUseValidLitActionCodeGeneratedSessionSigsToPkpSign - Passed (5972.58 ms)
testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel - Passed (5249.49 ms)
testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys - Passed (4534.42 ms)
testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys - Passed (6137.50 ms)
testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse - Passed (4642.16 ms)
testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog - Passed (5150.75 ms)
testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString - Passed (5715.39 ms)
testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile - Passed (4908.92 ms)
testUseCustomAuthSessionSigsToPkpSignExecuteJs - Passed (7786.51 ms)
testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign - Passed (6033.28 ms)
testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning - Passed (5027.18 ms)
testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs - Passed (8299.77 ms)
testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign - Passed (9213.29 ms)
testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs - Passed (9711.99 ms)
testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs - Passed (9491.76 ms)
testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign - Passed (8901.40 ms)
testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs - Passed (7772.63 ms)
testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign - Passed (8144.72 ms)
testEthAuthSigToEncryptDecryptString - Passed (3719.44 ms)
testSolAuthSigToEncryptDecryptString - Passed (513.11 ms)
testPkpEthersWithEoaSessionSigsToSignWithAuthContext - Passed (5160.78 ms)
testPkpEthersWithEoaSessionSigsToSignMessage - Passed (5086.03 ms)
testPkpEthersWithEoaSessionSigsToEthSign - Passed (4587.78 ms)
testPkpEthersWithEoaSessionSigsToEthSignTransaction - Passed (5586.24 ms)
testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 - Passed (4893.67 ms)
testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 - Passed (4821.41 ms)
testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 - Passed (4755.05 ms)
testPkpEthersWithEoaSessionSigsToEthSignTypedData - Passed (4829.58 ms)
testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil - Passed (5017.61 ms)
testPkpEthersWithPkpSessionSigsToSignMessage - Passed (5482.34 ms)
testPkpEthersWithPkpSessionSigsToSendTx - Passed (8675.38 ms)
testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 - Passed (10408.37 ms)
testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 - Passed (5374.96 ms)
testPkpEthersWithLitActionSessionSigsToSignMessage - Passed (5283.39 ms)
testPkpEthersWithLitActionSessionSigsToEthSign - Passed (5325.11 ms)
testPkpEthersWithLitActionSessionSigsToPersonalSign - Passed (5555.28 ms)
testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 - Passed (5729.90 ms)
testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 - Passed (5650.16 ms)
testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil - Passed (6024.40 ms)
testExecuteJsBroadcastAndCollect - Passed (4798.44 ms)
testExecutJsDecryptAndCombine - Passed (4489.18 ms)
testExecuteJsSignAndCombineEcdsa - Passed (8197.86 ms)

And similar run to CI passed too with Test Report: 11 test(s) (less tests than unfiltered one)

@Ansonhkg Ansonhkg self-requested a review December 4, 2024 19:08
@FedericoAmura FedericoAmura mentioned this pull request Dec 5, 2024
14 tasks
@FedericoAmura FedericoAmura merged commit 6fc8ad3 into master Dec 5, 2024
4 of 5 checks passed
@FedericoAmura FedericoAmura deleted the feature/lit-4046-blockhash-sync-fixes branch December 5, 2024 18:28
This was referenced Dec 5, 2024
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