Skip to content
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

Withdrawals fixes and improvements #7537

Merged
merged 3 commits into from
May 25, 2023
Merged

Withdrawals fixes and improvements #7537

merged 3 commits into from
May 25, 2023

Conversation

sl1depengwyn
Copy link
Collaborator

@sl1depengwyn sl1depengwyn commented May 23, 2023

Close #7531

Motivation

Currently withdrawal amount displayed in wei however it returned in gwei from the node
Also, sum counter does not work properly

Changelog

  • Convert withdrawal amount to wei
  • Add withdrawals_count field to block structure and !remove has_beacon_chain_withdrawals!
  • Fix sum counter

Checklist for your Pull Request (PR)

@sl1depengwyn sl1depengwyn force-pushed the mf-fix-withdrawals branch 3 times, most recently from 3671f88 to 0919631 Compare May 23, 2023 11:50
@sl1depengwyn sl1depengwyn marked this pull request as ready for review May 23, 2023 12:05
@sl1depengwyn sl1depengwyn requested review from nikitosing and vbaranov and removed request for nikitosing May 23, 2023 12:06
Copy link
Member

@vbaranov vbaranov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested with ETH Mainnet and api/v2/blocks/17327530 endpoint returns "withdrawals_count": null for this block. Whereas, this block contains withdrawals and they're visible through UI.

Sample response from that endpoint:

{
    "base_fee_per_gas": "33758890327",
    "burnt_fees": "606951899402500848",
    "burnt_fees_percentage": 95.14810830378532,
    "difficulty": "0",
    "extra_data": "TODO",
    "gas_limit": "30000000",
    "gas_target_percentage": 19.86016,
    "gas_used": "17979024",
    "gas_used_percentage": 59.93008,
    "has_beacon_chain_withdrawals": true,
    "hash": "0x9b6d5f664e297a63b6cc31e6378b3a8cbf99c1a9aa66d9307fad598bc288dd6c",
    "height": 17327530,
    "miner": {
        "hash": "0x5124fcC2B3F99F571AD67D075643C743F38f1C34",
        "implementation_name": null,
        "is_contract": false,
        "is_verified": null,
        "name": null
    },
    "nonce": "0x0000000000000000",
    "parent_hash": "0x0ed71a24746dc58fff1e891cbcaa816dc9ee746cc33cc945b7635dcacdf8cada",
    "priority_fee": "30950325058596733",
    "rewards": [
        {
            "reward": "30950325058596733",
            "type": "Miner Reward"
        }
    ],
    "size": 89727,
    "state_root": "TODO",
    "timestamp": "2023-05-24T07:20:59.000000Z",
    "total_difficulty": "58750003716598352816469",
    "tx_count": 165,
    "tx_fees": "637902224461097581",
    "type": "block",
    "uncles_hashes": [],
    "withdrawals_count": null
}

@sl1depengwyn sl1depengwyn force-pushed the mf-fix-withdrawals branch 2 times, most recently from d7c0f0a to 5cc8dc9 Compare May 25, 2023 12:12
@sl1depengwyn
Copy link
Collaborator Author

I tested with ETH Mainnet and api/v2/blocks/17327530 endpoint returns "withdrawals_count": null for this block. Whereas, this block contains withdrawals and they're visible through UI.

Sample response from that endpoint:

{
    "base_fee_per_gas": "33758890327",
    "burnt_fees": "606951899402500848",
    "burnt_fees_percentage": 95.14810830378532,
    "difficulty": "0",
    "extra_data": "TODO",
    "gas_limit": "30000000",
    "gas_target_percentage": 19.86016,
    "gas_used": "17979024",
    "gas_used_percentage": 59.93008,
    "has_beacon_chain_withdrawals": true,
    "hash": "0x9b6d5f664e297a63b6cc31e6378b3a8cbf99c1a9aa66d9307fad598bc288dd6c",
    "height": 17327530,
    "miner": {
        "hash": "0x5124fcC2B3F99F571AD67D075643C743F38f1C34",
        "implementation_name": null,
        "is_contract": false,
        "is_verified": null,
        "name": null
    },
    "nonce": "0x0000000000000000",
    "parent_hash": "0x0ed71a24746dc58fff1e891cbcaa816dc9ee746cc33cc945b7635dcacdf8cada",
    "priority_fee": "30950325058596733",
    "rewards": [
        {
            "reward": "30950325058596733",
            "type": "Miner Reward"
        }
    ],
    "size": 89727,
    "state_root": "TODO",
    "timestamp": "2023-05-24T07:20:59.000000Z",
    "total_difficulty": "58750003716598352816469",
    "tx_count": 165,
    "tx_fees": "637902224461097581",
    "type": "block",
    "uncles_hashes": [],
    "withdrawals_count": null
}

Thanks, fixed

@vbaranov vbaranov merged commit 845007f into master May 25, 2023
16 checks passed
@vbaranov vbaranov deleted the mf-fix-withdrawals branch May 25, 2023 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add block withdrawals counter to API v2
2 participants