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

Use acp 118 handler #1359

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

Use acp 118 handler #1359

wants to merge 35 commits into from

Conversation

ceyonur
Copy link
Collaborator

@ceyonur ceyonur commented Oct 9, 2024

This pull request introduces several changes to the plugin/evm/vm.go and related files to improve caching, message handling, and testing in the warp backend. The idea is to merge caches in favor of Cached ACP-118 handler. It also refactors warp backend and implements acp118 verifier interface.

Dependency Updates

  • Updated the version of github.com/ava-labs/avalanchego in go.mod to the latest release. ([go.modL8-R8](https://github.com/ava-labs/subnet-evm/pull/1359/files#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6L8-R8))

Caching and Initialization Enhancements

  • Added new imports for cache and metercacher modules in plugin/evm/vm.go to support enhanced caching mechanisms. ([plugin/evm/vm.goR19-R22](https://github.com/ava-labs/subnet-evm/pull/1359/files#diff-3be5ea9687f8af021d9baaa6584d174a7975b181b604e1a759e4ad2e40136912R19-R22))
  • Replaced the direct use of warpSignatureCacheSize with a meteredCache for caching warp signatures. This change improves cache management and monitoring. ([plugin/evm/vm.goR491-R532](https://github.com/ava-labs/subnet-evm/pull/1359/files#diff-3be5ea9687f8af021d9baaa6584d174a7975b181b604e1a759e4ad2e40136912R491-R532))
  • Refactored the Initialize method to include the creation and setup of meteredCache and added logic to clear the warp database if configured. ([plugin/evm/vm.goR491-R532](https://github.com/ava-labs/subnet-evm/pull/1359/files#diff-3be5ea9687f8af021d9baaa6584d174a7975b181b604e1a759e4ad2e40136912R491-R532))
  • Removed the initializeHandlers method and integrated its logic directly into the Initialize method, simplifying the initialization process. ([plugin/evm/vm.goL619-L632](https://github.com/ava-labs/subnet-evm/pull/1359/files#diff-3be5ea9687f8af021d9baaa6584d174a7975b181b604e1a759e4ad2e40136912L619-L632))

Testing Improvements

  • Added new imports in plugin/evm/vm_warp_test.go to support enhanced testing capabilities. ([[1]](https://github.com/ava-labs/subnet-evm/pull/1359/files#diff-816005c76cbcf9a7b2e47bb3b79f791507ae3b21594cfbbad80318ce065d2e2dR17), [[2]](https://github.com/ava-labs/subnet-evm/pull/1359/files#diff-816005c76cbcf9a7b2e47bb3b79f791507ae3b21594cfbbad80318ce065d2e2dR39))
  • Modified tests to use a fixed-size byte array for known signatures to ensure consistency in test results. ([[1]](https://github.com/ava-labs/subnet-evm/pull/1359/files#diff-816005c76cbcf9a7b2e47bb3b79f791507ae3b21594cfbbad80318ce065d2e2dR756-R765), [[2]](https://github.com/ava-labs/subnet-evm/pull/1359/files#diff-816005c76cbcf9a7b2e47bb3b79f791507ae3b21594cfbbad80318ce065d2e2dR814-R823))
  • Added a new test TestClearWarpDB to verify the functionality of clearing the warp database and ensuring messages are correctly pruned when configured. ([plugin/evm/vm_warp_test.goR858-R914](https://github.com/ava-labs/subnet-evm/pull/1359/files#diff-816005c76cbcf9a7b2e47bb3b79f791507ae3b21594cfbbad80318ce065d2e2dR858-R914))

Backend Refactoring

  • Updated imports in warp/backend.go to include new dependencies for enhanced caching and message verification. ([warp/backend.goR14-R26](https://github.com/ava-labs/subnet-evm/pull/1359/files#diff-be66b853aa52c434887db29553e039e5536b325b159de2d4df44d2e8fb345930R14-R26))
  • Refactored the Backend interface and its implementation to use a unified signatureCache instead of separate caches for message and block signatures. This change simplifies the caching logic and improves maintainability. ([[1]](https://github.com/ava-labs/subnet-evm/pull/1359/files#diff-be66b853aa52c434887db29553e039e5536b325b159de2d4df44d2e8fb345930L40-R49), [[2]](https://github.com/ava-labs/subnet-evm/pull/1359/files#diff-be66b853aa52c434887db29553e039e5536b325b159de2d4df44d2e8fb345930L62-R62))
  • Removed the Clear method from the backend and integrated its functionality into the VM initialization process. ([warp/backend.goL117-L123](https://github.com/ava-labs/subnet-evm/pull/1359/files#diff-be66b853aa52c434887db29553e039e5536b325b159de2d4df44d2e8fb345930L117-L123))
  • Added a new signMessage method to encapsulate the signing logic and ensure signatures are cached consistently. ([warp/backend.goR199-R208](https://github.com/ava-labs/subnet-evm/pull/1359/files#diff-be66b853aa52c434887db29553e039e5536b325b159de2d4df44d2e8fb345930R199-R208))

Test Cleanup

  • Removed the TestClearDB test from warp/backend_test.go as its functionality is now covered by the new TestClearWarpDB test in plugin/evm/vm_warp_test.go. ([warp/backend_test.goL38-R46](https://github.com/ava-labs/subnet-evm/pull/1359/files#diff-3a69b001767fa655e727b1d3763e0d128c2145db8b6dca70474c22aa08eb2a9fL38-R46))

These changes collectively enhance the performance, reliability, and test coverage of the warp backend in the plugin/evm module.

How this was tested

Added new UTs and improved existing warp tests.

How is this documented

Not needed.

@ceyonur ceyonur changed the base branch from uptime-tracking to always-sign-uptime October 9, 2024 13:47
@ceyonur ceyonur changed the base branch from always-sign-uptime to uptime-tracking October 9, 2024 13:58
@ceyonur ceyonur changed the base branch from uptime-tracking to always-sign-uptime-types October 9, 2024 14:03
@ceyonur ceyonur changed the base branch from always-sign-uptime-types to master October 14, 2024 12:49
@ceyonur ceyonur changed the base branch from master to always-sign-uptime-types October 14, 2024 12:50
Base automatically changed from always-sign-uptime-types to master October 17, 2024 13:31
@ceyonur ceyonur self-assigned this Oct 17, 2024
@ceyonur ceyonur marked this pull request as ready for review October 18, 2024 13:13
@ceyonur ceyonur requested review from darioush and a team as code owners October 18, 2024 13:13
}
}

func (h *verifierStats) IncAddressedCallSignatureValidationFail() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not sure how to use this as there is no "invalid addressedcall msg". They're further parsed for a known payload; and if there is no known payload type, then they're invalid (but again it means they cannot be parsed).

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