-
Notifications
You must be signed in to change notification settings - Fork 686
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
Feature: Proposal - Improve BLS12-381 Functions for Compatibility with EIP-2537 #12974
Comments
cc: @olga24912 |
You mention it is impractical, but then in the next paragraph provide an example of it being done. Is impractical here means they are a chore to use in that particular application (vs. impossible?) The reason I ask is because I don't think it is a goal to have host functions do everything in as straightforward way as possible. Rather the only reason they are a part of a host interface at all is because compiling the equivalent code to pure contract WASM makes it prohibitively expensive to run it in terms of gas. As long as the functions allow for accelerating computations in all applicable use-cases, even if using them is a chore, then these host functions serve their principal purpose. On a more pragmatic note, adding new host functions to NEAR is quite a difficult task and changing existing ones is borderline impossible. WASM does not have a concept of optional parameters so extending the existing host functions in a backwards compatible manner is not a thing that we can do. |
“Impractical” in this case is meant in the most literal sense, and it has been explained in detail why. These functions are expected to work just like other host functions we use for Ethereum precompiles: we pass an In Aurora, we implemented our own version of these functions at the smart contract level. While they work correctly, they consume significantly more NEAR gas. Additionally, it’s worth noting that the current ➡ NEP-488 contextThe Host functions are, in fact, an ABI for accessing external functions. You probably meant that changing the ABI would break backward compatibility for contracts that are already using these functions. In that case, there’s a very simple solution to the problem: This is a straightforward task that should take about an hour of work. |
Contact Details
[email protected]
Feature Request
Description
➡ Improve BLS12-381 Functions to Support Ethereum Precompiles (EIP-2537)
The current implementation of
nearcore
includes NEP-488, which provides BLS12-381 host-functions. However, during practical application in the Aurora project, it became evident that these functions are not well-suited for direct use as Ethereum precompiles according to EIP-2537.Problem Statement
EIP-2537 defines a different ABI for input and output when handling BLS12-381 precompiles, which leads to compatibility issues when trying to utilize the existing
nearcore
BLS12-381 functions. These differences introduce multiple challenges and limitations, making it difficult to integrate nearcore’s implementation with Ethereum-based projects like Aurora.EIP-2537 defines a different ABI for
input/output
when handling BLS12-381 precompiles, which creates several integration challenges:➡ Input Transformation: Currently,
nearcore
requires a specialized data transformation before passing parameters to BLS12-381 host functions. This includes:➡ Output Transformation: Similarly, the results must go through reverse transformations, including:
Since these pre/post-processing steps are currently required outside of nearcore’s BLS12-381 implementation, using these functions for EIP-2537 precompiles requires additional custom logic, making them impractical for direct use.
Example of that intagration is
Aurora Engine
BLS12-381 intagrations: aurora-is-near/aurora-engine#999Proposed Solution:
To improve compatibility with EIP-2537 while minimizing API changes, we propose extending the NEP-488 BLS12-381 host functions with an additional parameter:
API Change Proposal:
✅ Add an optional parameter to all BLS12-381 host functions:
This approach ensures minimal API changes while allowing native EIP-2537 compatibility within nearcore itself.
🚀 Impact & Benefits:
Aurora
.Beneficiary
Aurora
Priority
High priority. It's part of upcoming Ethereum Prague hard fork
Contributing
The text was updated successfully, but these errors were encountered: