axonweb3 / axon

Axon is a Layer 2 framework of CKB with native cross-chain and interoperability.
https://axonweb3.io
MIT License
65 stars 39 forks source link

Should we apply the same logic to all reserved system contracts addresses? #1590

Closed yangby-cryptape closed 10 months ago

yangby-cryptape commented 11 months ago

Description


: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:

Should we apply the same logic to those reserved system contracts now?

Let all system contracts, even reserved system contracts:

Flouse commented 10 months ago

My Humble Opinion

  1. reserved system_contract_addresses is defined in

    https://github.com/axonweb3/axon/blob/6a574cdbe0b0f826968602d253721606f2cd5ded/core/executor/src/system_contract/mod.rs#L42-L47

  2. Just return error in eth_getStorageAt and eth_getProof when an address is system_contract_address

  3. fix system_contract_dispatch function It should handle all reserved system_contract_addresses.

Need confirmations before coding

Flouse commented 10 months ago
  • Just return error in eth_getStorageAt and eth_getProof when an address is system_contract_address

I think this change is not implemented.

Test

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"}

Expected result

Not allow to call system contract address

ref: https://github.com/axonweb3/axon/issues/1561#issuecomment-1814374378