Canto-Network / Canto

Layer-1 blockchain powered by Free Public Infrastructure
GNU Lesser General Public License v3.0
83 stars 75 forks source link

newBlockHeader subscription is missing info #98

Open jjordan-quantum opened 1 year ago

jjordan-quantum commented 1 year ago

When I request the latest block over RPC, it has all the correct fields as below:

{
  baseFeePerGas: 1000000000000,
  difficulty: '0',
  extraData: '0x',
  gasLimit: 30000000,
  gasUsed: 750000,
  hash: '0xda8268a9869632e722abb26216bfdcc9b8062cb3448ba79e2fd48e83793cd7e7',
  logsBloom: '0x4020000001000000000001000000082002000000001040000000000c0000010000000000000080000000000000000000000400000000008002500000000000800080000000100000000000080000002000000000000004000020000004000000000080000204014000000000000008000000820000080010000000100000000040000100000000000000000000000000000010002010002000000040040000c0000008200000010000000000000008000040040000000001008000000080080000000002000000000000080400020000001400000000000000288020000020000000000002000000000000000000004000200002000000000000000000000042',
  miner: '0x0C047b0f49264c27cd14CD786dcFF2b9300BCE88',
  mixHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
  nonce: '0x0000000000000000',
  number: 3585853,
  parentHash: '0xd7ce2353e97bd6444c030369999273e1790e0a90902a187d6392b9f082744223',
  receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
  sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
  size: 11462,
  stateRoot: '0xc2b76515117f4a1fb7f36314aef3eefe98a9b5732b7dc327be3c19439d5d7e0b',
  timestamp: 1680230823,
  totalDifficulty: '0',
  transactions: [
    '0x706331a1f7657b2816ad6d9f756b6e50a0e31df037eb6b165cce7bafc23fc3ab'
  ],
  transactionsRoot: '0x820b437eff7ac6aab60cc981faddb51b9a4be3803a7764c27dcde2897e54448b',
  uncles: []
}

But when I receive the same block via newBlockHeader subscription (over ws), I receive the following, which is missing some fields:

{
  parentHash: '0xd7ce2353e97bd6444c030369999273e1790e0a90902a187d6392b9f082744223',
  sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
  miner: '0x782d7Ec4dE015B2aA4b559CA57bF0B8a12a7FBD5',
  stateRoot: '0xc2b76515117f4a1fb7f36314aef3eefe98a9b5732b7dc327be3c19439d5d7e0b',
  transactionsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
  receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
  logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
  difficulty: '0',
  number: 3585853,
  gasLimit: 0,
  gasUsed: 0,
  timestamp: 1680230823,
  extraData: '0x',
  mixHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
  nonce: '0x0000000000000000',
  baseFeePerGas: 1000000000,
  hash: '0xd0bea4f6055eb18d118a7acb4edc6d6cbee3574ffe8ceb1058a6155c504442a9',
  size: undefined
}

Is there a setting I need to change or this is a bug? Currently using v5.0.0, running full node.

jjordan-quantum commented 1 year ago

Also noticed that the pending transaction subscription over ws seems to be streaming hashes for confirmed txns. I am assuming this is the case, bc once the hash is received and I fetch the txn from the node, it already has a block number / transaction index. Typically I would expect these fields to be null for a pending txn.

And the hashes seem to be received at almost the same time as the block in which they were mined. So I guess the 'pendingTransactions' subscription is actually just streaming hashes as they appear in blocks?

fwhappy commented 1 year ago

@jjordan-quantum Did you find a way to get pending transactions?