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

refactor: get_node_info rpc for more useful configs #674

Merged
merged 5 commits into from
May 6, 2022

Conversation

RetricSu
Copy link
Contributor

@RetricSu RetricSu commented Apr 25, 2022

this pr refactor gw_get_node_info to expose more useful configs, these configs are all public, but currently, we require other services who want to talk to godwoken to set those configs manually by themself, and it often goes wrong in such process. with this pr, we can also enable web3 to simplify env configs

gw_get_node_info Rpc Example
{
    "id": 2,
    "jsonrpc": "2.0",
    "method": "gw_get_node_info",
    "params": []
}

result

{
    "jsonrpc": "2.0",
    "result": {
        "mode": "fullnode",
        "version": "1.1.0 02b63ce",
        "backends": [
            {
                "validator_code_hash": "0xbf1e540c239d9e9c894e76ba6142cee4d7755f590101a23b208e0439f4f09482",
                "generator_code_hash": "0x277d0449708812cbaa1639e591fd42b813abec4f048c12788dcb5d382a25579a",
                "validator_script_type_hash": "0x32923ebad8e5417ae072decc89774324ec4a623f57af5cee6e2901d29d8e6691",
                "backend_type": "meta"
            },
            {
                "validator_code_hash": "0x6af4952d926eae8d39b4b490212d6cfc1777fe95fadd3ab066bbb74ad85c1fd3",
                "generator_code_hash": "0x80f0b383aa89afd4668136435de90f82e57d8e53f10434bc2b1f9b7c427cab2e",
                "validator_script_type_hash": "0x9b599c7df5d7b813f7f9542a5c8a0c12b65261a081b1dba02c2404802f772a15",
                "backend_type": "polyjuice"
            },
            {
                "validator_code_hash": "0x5259a0b93696417a36eb5ba81798f0ee15c533ec25395b44577147afa69913c3",
                "generator_code_hash": "0xd975d1f46eaa510d523a5099c9b811251f905a98017fd5b781552975ab660262",
                "validator_script_type_hash": "0x59ecd45fc257a761d992507ef2e1acccf43221567f6cf3b1fc6fb9352a7a0ca3",
                "backend_type": "eth_addr_reg"
            },
            {
                "validator_code_hash": "0x4ad65c2ed87b4f505fad38b067bf53ff45940ea9984d3626e658a04b92f11b12",
                "generator_code_hash": "0x0861ce251b687940e32bef980fe785a27a79415dfa8ec4de6db3155d1ce3187d",
                "validator_script_type_hash": "0x696447c51fdb84d0e59850b26bc431425a74daaac070f2b14f5602fbb469912a",
                "backend_type": "sudt"
            }
        ],
        "eoa_scripts": [
            {
                "type_hash": "0x1272c80507fe5e6cf33cf3e5da6a5f02430de40abb14410ea0459361bf74ebe0",
                "script": {
                    "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                    "hash_type": "type",
                    "args": "0xb89f105b435c234d2eda67e260c5fdeda1fea26f463592be726530f81b15b96e"
                },
                "eoa_type": "eth"
            }
        ],
        "gw_scripts": [
            {
                "type_hash": "0xcddb997266a74a5e940a240d63ef8aa89d116999044e421dc337ead16ea870eb",
                "script": {
                    "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                    "hash_type": "type",
                    "args": "0x144214d720d6394cd3310bb728da1b2440cfcceca75655c9dcc9febbe17a8733"
                },
                "script_type": "deposit"
            },
            {
                "type_hash": "0xa069d8ba7175c8e9eca9d9fe2bc176483a41f67255f89ed5633c79470b7710e5",
                "script": {
                    "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                    "hash_type": "type",
                    "args": "0x74a79f8cac0b5d09302fa1b536dda7f5be072947f553fcad35e961b9e81aaebb"
                },
                "script_type": "withdraw"
            },
            {
                "type_hash": "0x825fba7d47ae770681e056183681a81310ab19200d82924d786e2cfe23b79cd3",
                "script": {
                    "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                    "hash_type": "type",
                    "args": "0x04d949721408b3102ab677ad3822f0c13b74cc9db5fd0a2a4e99db4284baa232"
                },
                "script_type": "stake_lock"
            },
            {
                "type_hash": "0xdef2218cdcda1c9b77c2a1c54dd6635eedccea507dbe5f377f8a1981d6bb6256",
                "script": {
                    "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                    "hash_type": "type",
                    "args": "0xe4e240a9fc8232f8200168ab7be230c108c04668e01fb15c35cd621a443f2dbe"
                },
                "script_type": "custodian_lock"
            },
            {
                "type_hash": "0xa069d8ba7175c8e9eca9d9fe2bc176483a41f67255f89ed5633c79470b7710e5",
                "script": {
                    "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                    "hash_type": "type",
                    "args": "0x7692146339b938f145f0edc8cdb77453e4e142d08538e92dd1590a7edd62cbe2"
                },
                "script_type": "challenge_lock"
            },
            {
                "type_hash": "0x6283a479a3cf5d4276cd93594de9f1827ab9b55c7b05b3d28e4c2e0a696cfefd",
                "script": {
                    "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                    "hash_type": "type",
                    "args": "0x57fdfd0617dcb74d1287bb78a7368a3a4bf9a790cfdcf5c1a105fd7cb406de0d"
                },
                "script_type": "l1_sudt"
            },
            {
                "type_hash": "0x696447c51fdb84d0e59850b26bc431425a74daaac070f2b14f5602fbb469912a",
                "script": {
                    "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                    "hash_type": "type",
                    "args": "0x693105c2af2a0331fe48065360300f043e492814516914b2d71779215360cb5d"
                },
                "script_type": "l2_sudt"
            },
            {
                "type_hash": "0x889cca40b2197ef887e3904ae1c415984f797ec823b8ac9182a1487b634a31ad",
                "script": {
                    "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                    "hash_type": "type",
                    "args": "0x98fb3542973e32ba43ea6f1cf44cca71569ef4592e80d70b9c890ce1a005b3c9"
                },
                "script_type": "omni_lock"
            }
        ],
        "rollup_cell": {
            "type_hash": "0x4ed4a999f0046230d67503c07f1e64f2b2ad1440f758ebfc97282be40f74673c",
            "script": {
                "code_hash": "0x8bdbffb1a94bbe35fa411ed36899a5d7e50591e30ad7b08211def22eedac27e4",
                "hash_type": "type",
                "args": "0xfdac8f898714a6ebfc14a7b883b65f175f9e8e4aa4f465b4ef3d528eb7c53cf8"
            }
        },
        "rollup_config": {
            "required_staking_capacity": "0x2540be400",
            "challenge_maturity_blocks": "0x64",
            "finality_blocks": "0x3",
            "reward_burn_rate": "0x32",
            "chain_id": "0xe8160100"
        }
    },
    "id": 2
}

crates/jsonrpc-types/src/godwoken.rs Show resolved Hide resolved
@keroro520 keroro520 dismissed their stale review April 26, 2022 03:02

historical legacy

keroro520
keroro520 previously approved these changes Apr 26, 2022
@Flouse Flouse requested review from jjyr, blckngm, magicalne and zeroqn and removed request for blckngm April 28, 2022 10:28
@Flouse Flouse merged commit 9c0a2d9 into godwokenrises:develop May 6, 2022
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.

6 participants