Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

v1: simplify Web3 configuration #200

Closed
3 of 6 tasks
Flouse opened this issue Mar 8, 2022 · 1 comment · Fixed by #239
Closed
3 of 6 tasks

v1: simplify Web3 configuration #200

Flouse opened this issue Mar 8, 2022 · 1 comment · Fixed by #239
Assignees
Labels
enhancement New feature or request v1

Comments

@Flouse
Copy link
Collaborator

Flouse commented Mar 8, 2022

  • deprecate COMPATIBLE_CHAIN_ID
    fetch COMPATIBLE_CHAIN_ID from RollupConfig

  • deprecate DEFAULT_FROM_ADDRESS and DEFAULT_FROM_ID
    scan Godwoken accounts and get the first EOA account as DEFAUT_RROM_ID

  • try to get other configs from Godwoken RPC and simplify the configurations in Web3.env

  • provide unsatisfy chain config info Godowken v1: refactor getChainInfo RPC #194


  • new configs:
    • MINIMAL_GAS_PRICE for a Polyjuice transaction -> avoid DDoS
    • MINIMAL_FEE for a Godwoken transaction -> avoid DDoS

Refs

@Flouse Flouse added enhancement New feature or request v1 labels Mar 8, 2022
@Flouse Flouse changed the title v1: simplify configuration v1: simplify Web3 configuration Mar 8, 2022
@RetricSu RetricSu self-assigned this Mar 21, 2022
@RetricSu
Copy link
Contributor

RetricSu commented Apr 25, 2022

poly_getChainInfo will be deprecated, instead one shall get all the desire config information by poly_version

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

result

{
    "jsonrpc": "2.0",
    "id": 2,
    "result": {
        "versions": {
            "web3Version": "1.0.0-rc1",
            "web3IndexerVersion": "1.0.0-rc1",
            "godwokenVersion": "1.1.0 02b63ce"
        },
        "nodeInfo": {
            "nodeMode": "fullnode",
            "rollupCell": {
                "typeHash": "0x4ed4a999f0046230d67503c07f1e64f2b2ad1440f758ebfc97282be40f74673c",
                "script": {
                    "code_hash": "0x8bdbffb1a94bbe35fa411ed36899a5d7e50591e30ad7b08211def22eedac27e4",
                    "hash_type": "type",
                    "args": "0xfdac8f898714a6ebfc14a7b883b65f175f9e8e4aa4f465b4ef3d528eb7c53cf8"
                }
            },
            "rollupConfig": {
                "requiredStakingCapacity": "0x2540be400",
                "challengeMaturityBlocks": "0x64",
                "finalityBlocks": "0x3",
                "rewardBurnRate": "0x32",
                "chainId": "0x116e8"
            },
            "gwScripts": {
                "deposit": {
                    "typeHash": "0xcddb997266a74a5e940a240d63ef8aa89d116999044e421dc337ead16ea870eb",
                    "script": {
                        "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                        "hash_type": "type",
                        "args": "0x144214d720d6394cd3310bb728da1b2440cfcceca75655c9dcc9febbe17a8733"
                    },
                    "scriptType": "deposit"
                },
                "withdraw": {
                    "typeHash": "0xa069d8ba7175c8e9eca9d9fe2bc176483a41f67255f89ed5633c79470b7710e5",
                    "script": {
                        "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                        "hash_type": "type",
                        "args": "0x74a79f8cac0b5d09302fa1b536dda7f5be072947f553fcad35e961b9e81aaebb"
                    },
                    "scriptType": "withdraw"
                },
                "stateValidator": {
                    "typeHash": "0x8bdbffb1a94bbe35fa411ed36899a5d7e50591e30ad7b08211def22eedac27e4",
                    "script": {
                        "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                        "hash_type": "type",
                        "args": "0x999363d38ac555fcb1008164a4d0a18f3abf03f7edb8e4db0cbe287662926b9d"
                    },
                    "scriptType": "state_validator"
                },
                "stakeLock": {
                    "typeHash": "0x825fba7d47ae770681e056183681a81310ab19200d82924d786e2cfe23b79cd3",
                    "script": {
                        "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                        "hash_type": "type",
                        "args": "0x04d949721408b3102ab677ad3822f0c13b74cc9db5fd0a2a4e99db4284baa232"
                    },
                    "scriptType": "stake_lock"
                },
                "custodianLock": {
                    "typeHash": "0xdef2218cdcda1c9b77c2a1c54dd6635eedccea507dbe5f377f8a1981d6bb6256",
                    "script": {
                        "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                        "hash_type": "type",
                        "args": "0xe4e240a9fc8232f8200168ab7be230c108c04668e01fb15c35cd621a443f2dbe"
                    },
                    "scriptType": "custodian_lock"
                },
                "challengeLock": {
                    "typeHash": "0xa069d8ba7175c8e9eca9d9fe2bc176483a41f67255f89ed5633c79470b7710e5",
                    "script": {
                        "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                        "hash_type": "type",
                        "args": "0x7692146339b938f145f0edc8cdb77453e4e142d08538e92dd1590a7edd62cbe2"
                    },
                    "scriptType": "challenge_lock"
                },
                "l1Sudt": {
                    "typeHash": "0x6283a479a3cf5d4276cd93594de9f1827ab9b55c7b05b3d28e4c2e0a696cfefd",
                    "script": {
                        "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                        "hash_type": "type",
                        "args": "0x57fdfd0617dcb74d1287bb78a7368a3a4bf9a790cfdcf5c1a105fd7cb406de0d"
                    },
                    "scriptType": "l1_sudt"
                },
                "l2Sudt": {
                    "typeHash": "0x696447c51fdb84d0e59850b26bc431425a74daaac070f2b14f5602fbb469912a",
                    "script": {
                        "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                        "hash_type": "type",
                        "args": "0x693105c2af2a0331fe48065360300f043e492814516914b2d71779215360cb5d"
                    },
                    "scriptType": "l2_sudt"
                },
                "omniLock": {
                    "typeHash": "0x889cca40b2197ef887e3904ae1c415984f797ec823b8ac9182a1487b634a31ad",
                    "script": {
                        "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                        "hash_type": "type",
                        "args": "0x98fb3542973e32ba43ea6f1cf44cca71569ef4592e80d70b9c890ce1a005b3c9"
                    },
                    "scriptType": "omni_lock"
                }
            },
            "eoaScripts": {
                "eth": {
                    "typeHash": "0x1272c80507fe5e6cf33cf3e5da6a5f02430de40abb14410ea0459361bf74ebe0",
                    "script": {
                        "code_hash": "0x00000000000000000000000000000000000000000000000000545950455f4944",
                        "hash_type": "type",
                        "args": "0xb89f105b435c234d2eda67e260c5fdeda1fea26f463592be726530f81b15b96e"
                    },
                    "eoaType": "eth"
                }
            },
            "backends": {
                "sudt": {
                    "validatorCodeHash": "0x4ad65c2ed87b4f505fad38b067bf53ff45940ea9984d3626e658a04b92f11b12",
                    "generatorCodeHash": "0x0861ce251b687940e32bef980fe785a27a79415dfa8ec4de6db3155d1ce3187d",
                    "validatorScriptTypeHash": "0x696447c51fdb84d0e59850b26bc431425a74daaac070f2b14f5602fbb469912a"
                },
                "meta": {
                    "validatorCodeHash": "0xbf1e540c239d9e9c894e76ba6142cee4d7755f590101a23b208e0439f4f09482",
                    "generatorCodeHash": "0x277d0449708812cbaa1639e591fd42b813abec4f048c12788dcb5d382a25579a",
                    "validatorScriptTypeHash": "0x32923ebad8e5417ae072decc89774324ec4a623f57af5cee6e2901d29d8e6691"
                },
                "polyjuice": {
                    "validatorCodeHash": "0x6af4952d926eae8d39b4b490212d6cfc1777fe95fadd3ab066bbb74ad85c1fd3",
                    "generatorCodeHash": "0x80f0b383aa89afd4668136435de90f82e57d8e53f10434bc2b1f9b7c427cab2e",
                    "validatorScriptTypeHash": "0x9b599c7df5d7b813f7f9542a5c8a0c12b65261a081b1dba02c2404802f772a15"
                },
                "ethAddrReg": {
                    "validatorCodeHash": "0x5259a0b93696417a36eb5ba81798f0ee15c533ec25395b44577147afa69913c3",
                    "generatorCodeHash": "0xd975d1f46eaa510d523a5099c9b811251f905a98017fd5b781552975ab660262",
                    "validatorScriptTypeHash": "0x59ecd45fc257a761d992507ef2e1acccf43221567f6cf3b1fc6fb9352a7a0ca3"
                }
            },
            "accounts": {
                "polyjuiceCreator": {
                    "id": "0x4",
                    "scriptHash": "0xea1c5c05fa4ce945e7c9875f3c59a9b819eb476349a139dfc3add37da6ce217b"
                },
                "ethAddrReg": {
                    "id": "0x2",
                    "scriptHash": "0xb5f81e2d10af9600194606989583ae8cc3fcb822a24fdea95f42da5ea18606da"
                },
                "defaultFrom": {
                    "id": "0x3",
                    "scriptHash": "0x6b2e2f4bb2e3e88144b3d71e1575b275cc24a1b8b8363675762aa56379fc6d0c"
                }
            },
            "web3ChainId": "0x116e8"
        }
    }
}

@RetricSu RetricSu linked a pull request Apr 26, 2022 that will close this issue
@RetricSu RetricSu closed this as completed May 9, 2022
Flouse added a commit to godwokenrises/godwoken-kicker that referenced this issue May 17, 2022
Flouse added a commit to godwokenrises/godwoken-kicker that referenced this issue May 17, 2022
Flouse added a commit to godwokenrises/godwoken-kicker that referenced this issue May 17, 2022
Flouse added a commit to godwokenrises/godwoken-kicker that referenced this issue May 17, 2022
keroro520 pushed a commit to godwokenrises/godwoken-kicker that referenced this issue May 20, 2022
Flouse added a commit to godwokenrises/godwoken-info that referenced this issue May 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request v1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants