-
Notifications
You must be signed in to change notification settings - Fork 39
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
Call the built-in Metadata
contract causes an error.
#1457
Comments
In the issue body, I told one of my opinion:
Now I withdraw my previous opinion. We could NOT provide any interface of the Metadata contract. One of those reasons is: If the interface is valid, then all axon/builtin-contract/metadata/contracts/metadata.sol Lines 57 to 58 in 6fe5777
That means this mapping should be refreshed after any hardfork and fill all new-added fields to all previous items. |
The all data stored for this contract are incompatible with EVM state storage. Here I just give one example: axon/core/executor/src/system_contract/metadata/store.rs Lines 93 to 96 in 6fe5777
The key for the following mapping should be axon/builtin-contract/metadata/contracts/metadata.sol Lines 57 to 58 in 6fe5777
The slot here should be
I guess a SummaryThis also is a reason for "why we could NOT provide any interface of the Metadata contract".
References |
The system contracts do not allow other sol contracts to be called directly, because they are all |
|
After #1449The latest interfaces of Metadata contract is axon/builtin-contract/system-contract/contracts/metadata/Metadata.sol Lines 54 to 67 in 4c43ed4
|
|
Current Behavior
Summary
Call the built-in
Metadata
contract causes an error:How to reproduce?
Create a interface file for
Metadata
contract.Base on the built-in
Metadata
contract SOL file.Base on the internal
Metadata
contract ABI file.Call the method
getMetadata(uint64 epoch)
from another contract.References:
Method signature in the built-in
Metadata
contract SOL file.axon/builtin-contract/metadata/contracts/metadata.sol
Line 139 in 71f5bad
Method signature in the internal
Metadata
contract ABI file.axon/core/executor/src/system_contract/metadata/abi/metadata_abi.json
Lines 141 to 148 in 71f5bad
There are several issues:
Why the error message contains "CKB-VM"?
I didn't call any contract which uses CKB-VM.
How to call
Metadata
contract in Solidity scripts with the provided method?The provided method is:
axon/core/executor/src/precompiles/metadata.rs
Lines 11 to 17 in 71f5bad
p.s. Axon should NOT force users to write assembly.
Should there be some tests before new changes on the built-in
Metadata
contract? (ref: refactor!: insert metadata directly and remove genesis transactions #1454)Did I miss some things?
I didn't find any tests under the
test
directory for the built-inMetadata
contract.I'm neither an expert on JavaScript nor an expert on Solidity.
Also, I haven't understood the storage model of Axon completely, yet.
I hope someone can add such tests (or examples) to increase confidence for the changes of the built-in
Metadata
contract.Provide an interface SOL file for the built-in
Metadata
contract, and use unit tests to make sure it will be updated when the contract is changed.Axon should NOT let users to write the interface manually.
It's better than provide a contract SOL file without code for implementation. (ref: refactor: change metadata system contract and add annotation #1449)
Expected Behavior
.
The text was updated successfully, but these errors were encountered: