Closed yangby-cryptape closed 10 months ago
reserved system_contract_address
es is defined in
Just return error in eth_getStorageAt
and eth_getProof
when an address is system_contract_address
fix system_contract_dispatch function
It should handle all reserved system_contract_address
es.
- Just return error in
eth_getStorageAt
andeth_getProof
when an address issystem_contract_address
I think this change is not implemented.
curl -X POST localhost:8000 \
--data '{"jsonrpc":"2.0", "method": "eth_getStorageAt", "params": ["0xffffffffffffffffffffffffffffffffffffff04", "0x0", "latest"], "id": 1}' \
--header 'Content-Type: application/json'
# Result
{"jsonrpc":"2.0","id":1,"result":"0x00000000000000000000000000000000000000000000000000000000000004d2"}
Not allow to call system contract address
ref: https://github.com/axonweb3/axon/issues/1561#issuecomment-1814374378
Description
As the following code defined:
https://github.com/axonweb3/axon/blob/6a574cdbe0b0f826968602d253721606f2cd5ded/core/executor/src/system_contract/mod.rs#L42-L47
All addresses between
0xffff..ff00
and0xffff..ffff
are system contracts.But only 3 addresses in them are used.
https://github.com/axonweb3/axon/blob/6a574cdbe0b0f826968602d253721606f2cd5ded/core/executor/src/system_contract/metadata/mod.rs#L29 https://github.com/axonweb3/axon/blob/6a574cdbe0b0f826968602d253721606f2cd5ded/core/executor/src/system_contract/ckb_light_client/mod.rs#L20 https://github.com/axonweb3/axon/blob/6a574cdbe0b0f826968602d253721606f2cd5ded/core/executor/src/system_contract/image_cell/mod.rs#L20
When executing a system contract, only above 3 contracts that have been clearly defined are dispatched to the system contracts process.
https://github.com/axonweb3/axon/blob/6a574cdbe0b0f826968602d253721606f2cd5ded/core/executor/src/lib.rs#L152-L153 https://github.com/axonweb3/axon/blob/6a574cdbe0b0f826968602d253721606f2cd5ded/core/executor/src/system_contract/mod.rs#L204-L223
Other executions which are to the reserved addresses of system contracts are processed as normal executions.
As far as we know, a normal contract and a system contract are very different.
:question: So, my question is: once a reserved system contract is enabled in the future, how to treat the difference between now and then after that?
An example of current Axon:
0xffff..ff04
is an undeployed system contract address.eth_getStorageAt
and the proofs of its storage should be generated witheth_getProof
.axon_getSystemContractStorageAt
and the proofs of its storage should be generated withaxon_getSystemContractProof
.^1Should we apply the same logic to those reserved system contracts now?
Let all system contracts, even reserved system contracts:
axon_getSystemContractStorageAt
and the proofs of its storage should be generated withaxon_getSystemContractProof
.