Open pablin-dev opened 1 month ago
Looking into the error case container via docker run -it --entrypoint /bin/bash ghcr.io/lazychain/artela-rollkit-lazy:v0.0.1-beta4
, inside executing /opt/entrypoint.sh
and later looking at the generated genesis.json
via head -n 10 .artroll/config/genesis.json
, it shows
{
"app_name": "\u003cappd\u003e",
"app_version": "",
"genesis_time": "2024-10-16T10:51:12.767288993Z",
"chain_id": "11820",
"initial_height": 1,
"app_hash": null,
"app_state": {
"06-solomachine": null,
"07-tendermint": null,
The app name appear as strange, where it should be "app_name": "artela-rollkitd"
. Seems like the genesis.json is generating wrong?
The good case generates the same
{
"app_name": "\u003cappd\u003e",
"app_version": "",
"genesis_time": "2024-10-16T11:10:15.489180645Z",
"chain_id": "artroll_11820-1",
"initial_height": 1,
"app_hash": null,
"app_state": {
"06-solomachine": null,
"07-tendermint": null,
Manually executing the script step by step:
docker run -it --entrypoint /bin/bash ghcr.io/lazychain/artela-rollkit-lazy:v0.0.1-beta4
artrolld config set client chain-id 11820
artrolld config set client keyring-backend test
artrolld keys add validator --keyring-backend test --algo eth_secp256k1
artrolld init localtestnet --chain-id 11820
add-genesis-account validator "100000000000000000000000000aart" --keyring-backend test
artrolld gentx validator "1000000000000000000000aart" --keyring-backend test --chain-id 11820 --fees "4000000000000000aart"
ADDRESS=$(jq -r '.address' /root/.artroll/config/priv_validator_key.json)
PUB_KEY=$(jq -r '.pub_key' /root/.artroll/config/priv_validator_key.json)
jq --argjson pubKey "$PUB_KEY" '.consensus["validators"]=[{"address": "'$ADDRESS'", "pub_key": $pubKey, "power": "1000000000000000", "name": "Rollkit Sequencer"}]' /root/.artroll/config/genesis.json > temp.json && mv temp.json /root/.artroll/config/genesis.json
artrolld collect-gentxs
{
"moniker": "localtestnet",
"chain_id": "11820",
"node_id": "2b2c486c248b54f18fcc1de96226ecdf8fdbfbc5",
"gentxs_dir": "",
"app_message": {
"06-solomachine": null,
"07-tendermint": null,
"auth": {
"params": {
"max_memo_characters": "256",
"tx_sig_limit": "7",
"tx_size_cost_per_byte": "10",
"sig_verify_cost_ed25519": "590",
"sig_verify_cost_secp256k1": "1000"
},
"accounts": []
},
"authz": {
"authorization": []
},
"bank": {
"params": {
"send_enabled": [],
"default_send_enabled": true
},
"balances": [],
"supply": [],
"denom_metadata": [],
"send_enabled": []
},
"capability": {
"index": "1",
"owners": []
},
"circuit": {
"account_permissions": [],
"disabled_type_urls": []
},
"consensus": null,
"crisis": {
"constant_fee": {
"denom": "stake",
"amount": "1000"
}
},
"distribution": {
"params": {
"community_tax": "0.020000000000000000",
"base_proposer_reward": "0.000000000000000000",
"bonus_proposer_reward": "0.000000000000000000",
"withdraw_addr_enabled": true
},
"fee_pool": {
"community_pool": []
},
"delegator_withdraw_infos": [],
"previous_proposer": "",
"outstanding_rewards": [],
"validator_accumulated_commissions": [],
"validator_historical_rewards": [],
"validator_current_rewards": [],
"delegator_starting_infos": [],
"validator_slash_events": []
},
"evidence": {
"evidence": []
},
"evm": {
"params": {
"evm_denom": "aart",
"enable_create": true,
"enable_call": true,
"extra_eips": [],
"chain_config": {
"homestead_block": "0",
"dao_fork_block": "0",
"dao_fork_support": true,
"eip150_block": "0",
"eip150_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155_block": "0",
"eip158_block": "0",
"byzantium_block": "0",
"constantinople_block": "0",
"petersburg_block": "0",
"istanbul_block": "0",
"muir_glacier_block": "0",
"berlin_block": "0",
"london_block": "0",
"arrow_glacier_block": "0",
"gray_glacier_block": "0",
"merge_netsplit_block": "0",
"shanghai_block": "0",
"cancun_block": "0"
},
"allow_unprotected_txs": false
},
"accounts": []
},
"fee": {
"params": {
"no_base_fee": false,
"base_fee_change_denominator": 8,
"elasticity_multiplier": 2,
"enable_height": "0",
"base_fee": "1000000000",
"min_gas_price": "20000000000.000000000000000000",
"min_gas_multiplier": "0.500000000000000000"
},
"block_gas": "0"
},
"feegrant": {
"allowances": []
},
"feeibc": {
"identified_fees": [],
"fee_enabled_channels": [],
"registered_payees": [],
"registered_counterparty_payees": [],
"forward_relayers": []
},
"genutil": {
"gen_txs": []
},
"gov": {
"starting_proposal_id": "1",
"deposits": [],
"votes": [],
"proposals": [],
"deposit_params": null,
"voting_params": null,
"tally_params": null,
"params": {
"min_deposit": [
{
"denom": "stake",
"amount": "10000000"
}
],
"max_deposit_period": "172800s",
"voting_period": "172800s",
"quorum": "0.334000000000000000",
"threshold": "0.500000000000000000",
"veto_threshold": "0.334000000000000000",
"min_initial_deposit_ratio": "0.000000000000000000",
"proposal_cancel_ratio": "0.500000000000000000",
"proposal_cancel_dest": "",
"expedited_voting_period": "86400s",
"expedited_threshold": "0.667000000000000000",
"expedited_min_deposit": [
{
"denom": "stake",
"amount": "50000000"
}
],
"burn_vote_quorum": false,
"burn_proposal_deposit_prevote": false,
"burn_vote_veto": true,
"min_deposit_ratio": "0.010000000000000000"
},
"constitution": ""
},
"group": {
"group_seq": "0",
"groups": [],
"group_members": [],
"group_policy_seq": "0",
"group_policies": [],
"proposal_seq": "0",
"proposals": [],
"votes": []
},
"ibc": {
"client_genesis": {
"clients": [],
"clients_consensus": [],
"clients_metadata": [],
"params": {
"allowed_clients": [
"*"
]
},
"create_localhost": false,
"next_client_sequence": "0"
},
"connection_genesis": {
"connections": [],
"client_connection_paths": [],
"next_connection_sequence": "0",
"params": {
"max_expected_time_per_block": "30000000000"
}
},
"channel_genesis": {
"channels": [],
"acknowledgements": [],
"commitments": [],
"receipts": [],
"send_sequences": [],
"recv_sequences": [],
"ack_sequences": [],
"next_channel_sequence": "0",
"params": {
"upgrade_timeout": {
"height": {
"revision_number": "0",
"revision_height": "0"
},
"timestamp": "600000000000"
}
}
}
},
"interchainaccounts": {
"controller_genesis_state": {
"active_channels": [],
"interchain_accounts": [],
"ports": [],
"params": {
"controller_enabled": true
}
},
"host_genesis_state": {
"active_channels": [],
"interchain_accounts": [],
"port": "icahost",
"params": {
"host_enabled": true,
"allow_messages": [
"*"
]
}
}
},
"mint": {
"minter": {
"inflation": "0.130000000000000000",
"annual_provisions": "0.000000000000000000"
},
"params": {
"mint_denom": "stake",
"inflation_rate_change": "0.130000000000000000",
"inflation_max": "0.200000000000000000",
"inflation_min": "0.070000000000000000",
"goal_bonded": "0.670000000000000000",
"blocks_per_year": "6311520"
}
},
"nft": {
"classes": [],
"entries": []
},
"params": null,
"runtime": null,
"slashing": {
"params": {
"signed_blocks_window": "100",
"min_signed_per_window": "0.500000000000000000",
"downtime_jail_duration": "600s",
"slash_fraction_double_sign": "0.050000000000000000",
"slash_fraction_downtime": "0.010000000000000000"
},
"signing_infos": [],
"missed_blocks": []
},
"staking": {
"params": {
"unbonding_time": "1814400s",
"max_validators": 100,
"max_entries": 7,
"historical_entries": 10000,
"bond_denom": "stake",
"min_commission_rate": "0.000000000000000000"
},
"last_total_power": "0",
"last_validator_powers": [],
"validators": [],
"delegations": [],
"unbonding_delegations": [],
"redelegations": [],
"exported": false
},
"transfer": {
"port_id": "transfer",
"denom_traces": [],
"params": {
"send_enabled": true,
"receive_enabled": true
},
"total_escrowed": []
},
"upgrade": {},
"vesting": {}
}
}
Note:
"crisis": {
"constant_fee": {
"denom": "stake",
"amount": "1000"
}
},
stake
token?Using only the following setup on entrpoint.sh
artrolld config set client chain-id 11820
artrolld config set client keyring-backend test
artrolld keys add validator --keyring-backend test --algo eth_secp256k1
artrolld init localtestnet --chain-id 11820
add-genesis-account validator "100000000000000000000000000aart" --keyring-backend test
artrolld gentx validator "1000000000000000000000aart" --keyring-backend test --chain-id 11820 --fees "4000000000000000aart"
ADDRESS=$(jq -r '.address' /root/.artroll/config/priv_validator_key.json)
PUB_KEY=$(jq -r '.pub_key' /root/.artroll/config/priv_validator_key.json)
jq --argjson pubKey "$PUB_KEY" '.consensus["validators"]=[{"address": "'$ADDRESS'", "pub_key": $pubKey, "power": "1000000000000000", "name": "Rollkit Sequencer"}]' /root/.artroll/config/genesis.json > temp.json && mv temp.json /root/.artroll/config/genesis.json
artrolld collect-gentxs
gives panic: failed to execute DeliverTx for
{
"body": {
"messages": [
{
"@type": "/cosmos.staking.v1beta1.MsgCreateValidator",
"description": {
"moniker": "localtestnet",
"identity": "",
"website": "",
"security_contact": "",
"details": ""
},
"commission": {
"rate": "0.100000000000000000",
"max_rate": "0.200000000000000000",
"max_change_rate": "0.010000000000000000"
},
"min_self_delegation": "1",
"delegator_address": "",
"validator_address": "artvaloper10se9k6f20ck3hph0hklf6869w40kjpm8c95u4t",
"pubkey": {
"@type": "/cosmos.crypto.ed25519.PubKey",
"key": "Bwhf36fg/uefcpBPCrc+nYj9HQxIln4FC2Rrb8DP9dA="
},
"value": {
"denom": "aart",
"amount": "1000000000000000000000"
}
}
],
"memo": "95400d19973d8e6bffaeeddebe467f59ce272671@192.168.1.203:26656",
"timeout_height": "0",
"extension_options": [],
"non_critical_extension_options": []
},
"auth_info": {
"signer_infos": [
{
"public_key": {
"@type": "/artela.crypto.ethsecp256k1.PubKey",
"key": "A0Yk36P/LE4r1391YcJAxOwXEwbo6q43/M/T0JIZjBGI"
},
"mode_info": {
"single": {
"mode": "SIGN_MODE_DIRECT"
}
},
"sequence": "0"
}
],
"fee": {
"amount": [
{
"denom": "aart",
"amount": "4000000000000000"
}
],
"gas_limit": "200000",
"payer": "",
"granter": ""
},
"tip": null
},
"signatures": [
"0bMA1s0QJfD/fIsbLBsKwgh57n9xFwi/l0wSQxcWixUV/kkfm3L29nhHzn84/Dxaqe2hKTSuknjfWNBY98oAIQA="
]
}
recovered: 11820: []: invalid chain ID [/app/ethereum/types/chain_id.go:45]
matches := artelaChainID.FindStringSubmatch(chainID)
if matches == nil || len(matches) != 4 || matches[1] == "" {
return nil, errorsmod.Wrapf(ErrInvalidChainID, "%s: %v", chainID, matches)
}
var (
regexChainID = `[a-z]{1,}`
regexEIP155Separator = `_{1}`
regexEIP155 = `[1-9][0-9]*`
regexEpochSeparator = `-{1}`
regexEpoch = `[1-9][0-9]*`
artelaChainID = regexp.MustCompile(fmt.Sprintf(`^(%s)%s(%s)%s(%s)$`,
regexChainID,
regexEIP155Separator,
regexEIP155,
regexEpochSeparator,
regexEpoch))
)
So, regular expression ^([a-z]{1,})_{1}([1-9][0-9]*)-{1}([1-9][0-9]*)$
Test | Target String | MatchString() | FindAllString() | FindAllStringIndex() | FindAllStringSubmatch() |
---|---|---|---|---|---|
1 | artroll_11820-1 | true | [artroll_11820-1] | [0]: 0, 15 | [0]: [artroll_11820-1, artroll, 11820, 1] |
2 | 0 | false | nil | nil | nil |
3 | 11822 | false | nil | nil | nil |
4 | 1137 | false | nil | nil | nil |
5 | a_1137-1 | true | [a_1137-1] | [0]: 0, 8 | [0]: [a_1137-1, a, 1137, 1] |
Hi, since Artela is an EVM-compatible Cosmos chain, the chain ID in its genesis is in Cosmos format. However, you can still send transactions to the chain with id artroll_11820-1
using the Ethereum chain ID 11820
. I'd like to know why you want to change the chain ID from artroll_11820-1
to 11820
?
I think if we can change from "artroll11820-1" to "artroll-11820-1", metamask would work. Metamask doesnt like the "" character. The other way would be ask metamask team to change his sanity check.
Setting it to artroll_11820-1
should also work with MetaMask. In MetaMask, use the chainId 11820
but not artroll_11820-1
.
In fact, when artroll starts, it extracts the middle part, 11820, as the EVM-compatible chainId. When MetaMask connects to artroll's JSON-RPC (8545), it can read the chainId as 11820.
I confirm that that works. You can close the issue. Thank you!
Problem
When changing the blockchain
chainId
to integrate it into Metamask/leap wallet, an error occur:Reproduce
Initial conditions
git clone git@github.com:Lazychain/artela-rollkit.git && cd artela-rollkit && git checkout v0.0.3-alpha
.kurtosis clean --all && docker rmi ghcr.io/lazychain/artela-rollkit-lazy:v0.0.1-beta4
Good case
kurtosis clean --all && kurtosis run --enclave kurtosis-lazy main.star --args-file "args.json"
.At the end, last transaction should show developer wallet balance with 1000000aart tokens.
Error case
chainId
on root project fileentrypoint.sh
fromCHAINID="artroll_11820-1"
toCHAINID="11820"
.docker compose build
( to store the new entrypoint.sh into the docker image).kurtosis clean --all && kurtosis run --enclave kurtosis-lazy main.star --args-file "args.json"
.Note: the
entrypoint.sh
runs the go executable generatedartrolld start --rollkit.aggregator --rollkit.da_address $DA_ADDRESS