XinFinOrg / XDPoSChain

Customer centric, Hybrid & Interoperable XinFin Network
https://www.xinfin.org
GNU Lesser General Public License v3.0
50 stars 59 forks source link

BlockSigner smart contract can't be called #547

Open morteza94 opened 1 month ago

morteza94 commented 1 month ago

the xdc0000000000000000000000000000000000000089 address is the address for the BlockSigner contract. But the bytecode for this contract is not present on the latest blocks therefore it cannot be called from another smart contract or web3 clients. But the bytecode does exist on the first few blocks.

gzliudan commented 1 month ago

Test command:

RPC="https://arpc.xinfin.network/"
RPC="https://earpc.apothem.network/"

curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
  "jsonrpc": "2.0",
  "id": 8001,
  "method": "eth_getCode",
  "params": [
    "'"${ADDRESS}"'",
    "'"$(printf 0x%x ${NUMBER})"'"
  ]
}' | jq

when NUMBER=2999999

{
  "jsonrpc": "2.0",
  "id": 8001,
  "result": "0x6060604052600436106100565763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663e341eaa4811461005b578063e7ec6aef14610076578063f4145a83146100df575b600080fd5b341561006657600080fd5b610074600435602435610104565b005b341561008157600080fd5b61008c600435610227565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156100cb5780820151838201526020016100b3565b505050509050019250505060405180910390f35b34156100ea57600080fd5b6100f26102ac565b60405190815260200160405180910390f35b438290101561011257600080fd5b600280546101289184910263ffffffff6102b216565b43111561013457600080fd5b600082815260016020819052604090912080549091810161015583826102c8565b5060009182526020808320919091018390558282528190526040902080546001810161018183826102c8565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff19163373ffffffffffffffffffffffffffffffffffffffff8116919091179091557f62855fa22e051687c32ac285857751f6d3f2c100c72756d8d30cb7ecb1f64f5490838360405173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091526040808301919091526060909101905180910390a15050565b61022f6102f1565b600082815260208181526040918290208054909290918281020190519081016040528092919081815260200182805480156102a057602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610275575b50505050509050919050565b60025481565b6000828201838110156102c157fe5b9392505050565b8154818355818115116102ec576000838152602090206102ec918101908301610303565b505050565b60206040519081016040526000815290565b61032191905b8082111561031d5760008155600101610309565b5090565b905600a165627a7a72305820a8ceddaea8e4ae00991e2ae81c8c88e160dd8770f255523282c24c2df4c30ec70029"
}

when NUMBER=3000000

{
  "jsonrpc": "2.0",
  "id": 8001,
  "result": "0x"
}
gzliudan commented 1 month ago

This contract is deleted at block 3000000 by below code:

https://github.com/XinFinOrg/XDPoSChain/blob/master/core/state_processor.go#L148-L150

    if common.TIPSigning.Cmp(header.Number) == 0 {
        statedb.DeleteAddress(common.HexToAddress(common.BlockSigners))
    }

since:

var TIPSigning = big.NewInt(3000000)
s1na commented 1 month ago

Is it not because it was replaced by native Go code? https://github.com/XinFinOrg/XDPoSChain/blob/f041ad5a9b32e30af53ea0a5105b22d827045b51/core/state_processor.go#L449