update fork

This commit is contained in:
0xmuralik
2022-10-10 16:08:33 +05:30
parent 632d53e34a
commit 56d59feaa0
383 changed files with 36784 additions and 21462 deletions
+2 -1
View File
File diff suppressed because one or more lines are too long
+394 -87
View File
@@ -1,10 +1,10 @@
swagger: '2.0'
info:
title: Ethermint Chain - Legacy REST and gRPC Gateway docs
description: 'A REST interface for state queries, legacy transactions'
description: A REST interface for state queries, legacy transactions
version: 1.0.0
paths:
'/ethermint/evm/v1/account/{address}':
/ethermint/evm/v1/account/{address}:
get:
summary: Account queries an Ethereum account.
operationId: Account
@@ -224,7 +224,7 @@ paths:
type: string
tags:
- Query
'/ethermint/evm/v1/balances/{address}':
/ethermint/evm/v1/balances/{address}:
get:
summary: |-
Balance queries the balance of a the EVM denomination for a single
@@ -439,7 +439,215 @@ paths:
type: string
tags:
- Query
'/ethermint/evm/v1/codes/{address}':
/ethermint/evm/v1/base_fee:
get:
summary: >-
BaseFee queries the base fee of the parent block of the current block,
it's similar to feemarket module's method, but also checks london
hardfork status.
operationId: BaseFee
responses:
'200':
description: A successful response.
schema:
type: object
properties:
base_fee:
type: string
description: BaseFeeResponse returns the EIP1559 base fee.
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
description: >-
A URL/resource name that uniquely identifies the type of
the serialized
protocol buffer message. This string must contain at
least
one "/" character. The last segment of the URL's path
must represent
the fully qualified name of the type (as in
`path/google.protobuf.Duration`). The name should be in
a canonical form
(e.g., leading "." is not accepted).
In practice, teams usually precompile into the binary
all types that they
expect it to use in the context of Any. However, for
URLs which use the
scheme `http`, `https`, or no scheme, one can optionally
set up a type
server that maps type URLs to message definitions as
follows:
* If no scheme is provided, `https` is assumed.
* An HTTP GET on the URL must yield a
[google.protobuf.Type][]
value in binary format, or produce an error.
* Applications are allowed to cache lookup results based
on the
URL, or have them precompiled into a binary to avoid any
lookup. Therefore, binary compatibility needs to be preserved
on changes to types. (Use versioned type names to manage
breaking changes.)
Note: this functionality is not currently available in
the official
protobuf release, and it is not used for type URLs
beginning with
type.googleapis.com.
Schemes other than `http`, `https` (or the empty scheme)
might be
used with implementation specific semantics.
value:
type: string
format: byte
description: >-
Must be a valid serialized protocol buffer of the above
specified type.
description: >-
`Any` contains an arbitrary serialized protocol buffer
message along with a
URL that describes the type of the serialized message.
Protobuf library provides support to pack/unpack Any values
in the form
of utility functions or additional generated methods of the
Any type.
Example 1: Pack and unpack a message in C++.
Foo foo = ...;
Any any;
any.PackFrom(foo);
...
if (any.UnpackTo(&foo)) {
...
}
Example 2: Pack and unpack a message in Java.
Foo foo = ...;
Any any = Any.pack(foo);
...
if (any.is(Foo.class)) {
foo = any.unpack(Foo.class);
}
Example 3: Pack and unpack a message in Python.
foo = Foo(...)
any = Any()
any.Pack(foo)
...
if any.Is(Foo.DESCRIPTOR):
any.Unpack(foo)
...
Example 4: Pack and unpack a message in Go
foo := &pb.Foo{...}
any, err := ptypes.MarshalAny(foo)
...
foo := &pb.Foo{}
if err := ptypes.UnmarshalAny(any, foo); err != nil {
...
}
The pack methods provided by protobuf library will by
default use
'type.googleapis.com/full.type.name' as the type URL and the
unpack
methods only use the fully qualified type name after the
last '/'
in the type URL, for example "foo.bar.com/x/y.z" will yield
type
name "y.z".
JSON
====
The JSON representation of an `Any` value uses the regular
representation of the deserialized, embedded message, with
an
additional field `@type` which contains the type URL.
Example:
package google.profile;
message Person {
string first_name = 1;
string last_name = 2;
}
{
"@type": "type.googleapis.com/google.profile.Person",
"firstName": <string>,
"lastName": <string>
}
If the embedded message type is well-known and has a custom
JSON
representation, that representation will be embedded adding
a field
`value` which holds the custom JSON in addition to the
`@type`
field. Example (for message [google.protobuf.Duration][]):
{
"@type": "type.googleapis.com/google.protobuf.Duration",
"value": "1.212s"
}
tags:
- Query
/ethermint/evm/v1/codes/{address}:
get:
summary: Code queries the balance of all coins for a single account.
operationId: Code
@@ -653,7 +861,7 @@ paths:
type: string
tags:
- Query
'/ethermint/evm/v1/cosmos_account/{address}':
/ethermint/evm/v1/cosmos_account/{address}:
get:
summary: CosmosAccount queries an Ethereum account's Cosmos Address.
operationId: CosmosAccount
@@ -1131,7 +1339,7 @@ paths:
data:
type: string
format: byte
title: 'supplied by the contract, usually ABI-encoded'
title: supplied by the contract, usually ABI-encoded
block_number:
type: string
format: uint64
@@ -1500,11 +1708,28 @@ paths:
title: >-
London switch block (nil = no fork, 0 = already on
london)
arrow_glacier_block:
type: string
title: >-
Eip-4345 (bomb delay) switch block (nil = no fork, 0 =
already activated)
merge_fork_block:
type: string
title: >-
EIP-3675 (TheMerge) switch block (nil = no fork, 0 =
already in merge proceedings)
description: >-
ChainConfig defines the Ethereum ChainConfig parameters
using *sdk.Int values
instead of *big.Int.
allow_unprotected_txs:
type: boolean
description: >-
Allow unprotected transactions defines if replay-protected
(i.e non EIP155
signed) transactions can be executed on the state machine.
title: Params defines the EVM module parameters
description: >-
QueryParamsResponse defines the response type for querying x/evm
@@ -1700,7 +1925,7 @@ paths:
}
tags:
- Query
'/ethermint/evm/v1/storage/{address}/{key}':
/ethermint/evm/v1/storage/{address}/{key}:
get:
summary: Storage queries the balance of all coins for a single account.
operationId: Storage
@@ -2166,13 +2391,13 @@ paths:
required: false
type: boolean
- name: trace_config.limit
description: 'maximum length of output, but zero means unlimited.'
description: maximum length of output, but zero means unlimited.
in: query
required: false
type: integer
format: int32
- name: trace_config.overrides.homestead_block
description: 'Homestead switch block (nil no fork, 0 = already homestead).'
description: Homestead switch block (nil no fork, 0 = already homestead).
in: query
required: false
type: string
@@ -2213,12 +2438,12 @@ paths:
required: false
type: string
- name: trace_config.overrides.byzantium_block
description: 'Byzantium switch block (nil no fork, 0 = already on byzantium).'
description: Byzantium switch block (nil no fork, 0 = already on byzantium).
in: query
required: false
type: string
- name: trace_config.overrides.constantinople_block
description: 'Constantinople switch block (nil no fork, 0 = already activated).'
description: Constantinople switch block (nil no fork, 0 = already activated).
in: query
required: false
type: string
@@ -2228,7 +2453,7 @@ paths:
required: false
type: string
- name: trace_config.overrides.istanbul_block
description: 'Istanbul switch block (nil no fork, 0 = already on istanbul).'
description: Istanbul switch block (nil no fork, 0 = already on istanbul).
in: query
required: false
type: string
@@ -2240,12 +2465,26 @@ paths:
required: false
type: string
- name: trace_config.overrides.berlin_block
description: 'Berlin switch block (nil = no fork, 0 = already on berlin).'
description: Berlin switch block (nil = no fork, 0 = already on berlin).
in: query
required: false
type: string
- name: trace_config.overrides.london_block
description: 'London switch block (nil = no fork, 0 = already on london).'
description: London switch block (nil = no fork, 0 = already on london).
in: query
required: false
type: string
- name: trace_config.overrides.arrow_glacier_block
description: >-
Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already
activated).
in: query
required: false
type: string
- name: trace_config.overrides.merge_fork_block
description: >-
EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already in
merge proceedings).
in: query
required: false
type: string
@@ -2562,12 +2801,6 @@ paths:
in: query
required: false
type: string
- name: tx_index
description: transaction index.
in: query
required: false
type: string
format: uint64
- name: trace_config.tracer
description: custom javascript tracer.
in: query
@@ -2604,13 +2837,13 @@ paths:
required: false
type: boolean
- name: trace_config.limit
description: 'maximum length of output, but zero means unlimited.'
description: maximum length of output, but zero means unlimited.
in: query
required: false
type: integer
format: int32
- name: trace_config.overrides.homestead_block
description: 'Homestead switch block (nil no fork, 0 = already homestead).'
description: Homestead switch block (nil no fork, 0 = already homestead).
in: query
required: false
type: string
@@ -2651,12 +2884,12 @@ paths:
required: false
type: string
- name: trace_config.overrides.byzantium_block
description: 'Byzantium switch block (nil no fork, 0 = already on byzantium).'
description: Byzantium switch block (nil no fork, 0 = already on byzantium).
in: query
required: false
type: string
- name: trace_config.overrides.constantinople_block
description: 'Constantinople switch block (nil no fork, 0 = already activated).'
description: Constantinople switch block (nil no fork, 0 = already activated).
in: query
required: false
type: string
@@ -2666,7 +2899,7 @@ paths:
required: false
type: string
- name: trace_config.overrides.istanbul_block
description: 'Istanbul switch block (nil no fork, 0 = already on istanbul).'
description: Istanbul switch block (nil no fork, 0 = already on istanbul).
in: query
required: false
type: string
@@ -2678,12 +2911,26 @@ paths:
required: false
type: string
- name: trace_config.overrides.berlin_block
description: 'Berlin switch block (nil = no fork, 0 = already on berlin).'
description: Berlin switch block (nil = no fork, 0 = already on berlin).
in: query
required: false
type: string
- name: trace_config.overrides.london_block
description: 'London switch block (nil = no fork, 0 = already on london).'
description: London switch block (nil = no fork, 0 = already on london).
in: query
required: false
type: string
- name: trace_config.overrides.arrow_glacier_block
description: >-
Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already
activated).
in: query
required: false
type: string
- name: trace_config.overrides.merge_fork_block
description: >-
EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already in
merge proceedings).
in: query
required: false
type: string
@@ -2716,7 +2963,7 @@ paths:
format: date-time
tags:
- Query
'/ethermint/evm/v1/validator_account/{cons_address}':
/ethermint/evm/v1/validator_account/{cons_address}:
get:
summary: >-
ValidatorAccount queries an Ethereum account's from a validator
@@ -3397,7 +3644,7 @@ paths:
type: boolean
tags:
- Query
'/cosmos/auth/v1beta1/accounts/{address}':
/cosmos/auth/v1beta1/accounts/{address}:
get:
summary: Account returns account details based on address.
operationId: AuthAccount
@@ -4001,7 +4248,7 @@ paths:
}
tags:
- Query
'/cosmos/bank/v1beta1/balances/{address}':
/cosmos/bank/v1beta1/balances/{address}:
get:
summary: AllBalances queries the balance of all coins for a single account.
operationId: AllBalances
@@ -4135,7 +4382,7 @@ paths:
type: boolean
tags:
- Query
'/cosmos/bank/v1beta1/balances/{address}/{denom}':
/cosmos/bank/v1beta1/balances/{address}/{denom}:
get:
summary: Balance queries the balance of a single coin for a single account.
operationId: BankBalance
@@ -4383,7 +4630,7 @@ paths:
type: boolean
tags:
- Query
'/cosmos/bank/v1beta1/denoms_metadata/{denom}':
/cosmos/bank/v1beta1/denoms_metadata/{denom}:
get:
summary: DenomsMetadata queries the client metadata of a given coin denomination.
operationId: DenomMetadata
@@ -4681,7 +4928,7 @@ paths:
type: boolean
tags:
- Query
'/cosmos/bank/v1beta1/supply/{denom}':
/cosmos/bank/v1beta1/supply/{denom}:
get:
summary: SupplyOf queries the supply of a single coin.
operationId: SupplyOf
@@ -4797,7 +5044,7 @@ paths:
format: byte
tags:
- Query
'/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards':
/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards:
get:
summary: |-
DelegationTotalRewards queries the total rewards accrued by a each
@@ -4890,7 +5137,7 @@ paths:
type: string
tags:
- Query
'/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards/{validator_address}':
/cosmos/distribution/v1beta1/delegators/{delegator_address}/rewards/{validator_address}:
get:
summary: DelegationRewards queries the total rewards accrued by a delegation.
operationId: DelegationRewards
@@ -4957,7 +5204,7 @@ paths:
type: string
tags:
- Query
'/cosmos/distribution/v1beta1/delegators/{delegator_address}/validators':
/cosmos/distribution/v1beta1/delegators/{delegator_address}/validators:
get:
summary: DelegatorValidators queries the validators of a delegator.
operationId: DistDelegatorValidators
@@ -5007,7 +5254,7 @@ paths:
type: string
tags:
- Query
'/cosmos/distribution/v1beta1/delegators/{delegator_address}/withdraw_address':
/cosmos/distribution/v1beta1/delegators/{delegator_address}/withdraw_address:
get:
summary: DelegatorWithdrawAddress queries withdraw address of a delegator.
operationId: DelegatorWithdrawAddress
@@ -5102,7 +5349,7 @@ paths:
format: byte
tags:
- Query
'/cosmos/distribution/v1beta1/validators/{validator_address}/commission':
/cosmos/distribution/v1beta1/validators/{validator_address}/commission:
get:
summary: ValidatorCommission queries accumulated commission for a validator.
operationId: ValidatorCommission
@@ -5167,7 +5414,7 @@ paths:
type: string
tags:
- Query
'/cosmos/distribution/v1beta1/validators/{validator_address}/outstanding_rewards':
/cosmos/distribution/v1beta1/validators/{validator_address}/outstanding_rewards:
get:
summary: ValidatorOutstandingRewards queries rewards of a validator address.
operationId: ValidatorOutstandingRewards
@@ -5239,7 +5486,7 @@ paths:
type: string
tags:
- Query
'/cosmos/distribution/v1beta1/validators/{validator_address}/slashes':
/cosmos/distribution/v1beta1/validators/{validator_address}/slashes:
get:
summary: ValidatorSlashes queries slash events of a validator.
operationId: ValidatorSlashes
@@ -5536,7 +5783,7 @@ paths:
format: byte
tags:
- Query
'/cosmos/gov/v1beta1/params/{params_type}':
/cosmos/gov/v1beta1/params/{params_type}:
get:
summary: Params queries all parameters of the gov module.
operationId: GovParams
@@ -6380,7 +6627,7 @@ paths:
type: boolean
tags:
- Query
'/cosmos/gov/v1beta1/proposals/{proposal_id}':
/cosmos/gov/v1beta1/proposals/{proposal_id}:
get:
summary: Proposal queries proposal details based on ProposalID.
operationId: Proposal
@@ -6843,7 +7090,7 @@ paths:
format: uint64
tags:
- Query
'/cosmos/gov/v1beta1/proposals/{proposal_id}/deposits':
/cosmos/gov/v1beta1/proposals/{proposal_id}/deposits:
get:
summary: Deposits queries all deposits of a single proposal.
operationId: Deposits
@@ -7158,7 +7405,7 @@ paths:
type: boolean
tags:
- Query
'/cosmos/gov/v1beta1/proposals/{proposal_id}/deposits/{depositor}':
/cosmos/gov/v1beta1/proposals/{proposal_id}/deposits/{depositor}:
get:
summary: >-
Deposit queries single deposit information based proposalID,
@@ -7406,7 +7653,7 @@ paths:
type: string
tags:
- Query
'/cosmos/gov/v1beta1/proposals/{proposal_id}/tally':
/cosmos/gov/v1beta1/proposals/{proposal_id}/tally:
get:
summary: TallyResult queries the tally of a proposal vote.
operationId: TallyResult
@@ -7631,7 +7878,7 @@ paths:
format: uint64
tags:
- Query
'/cosmos/gov/v1beta1/proposals/{proposal_id}/votes':
/cosmos/gov/v1beta1/proposals/{proposal_id}/votes:
get:
summary: Votes queries votes of a given proposal.
operationId: Votes
@@ -7975,9 +8222,9 @@ paths:
type: boolean
tags:
- Query
'/cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter}':
/cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter}:
get:
summary: 'Vote queries voted information based on proposalID, voterAddr.'
summary: Vote queries voted information based on proposalID, voterAddr.
operationId: Vote
responses:
'200':
@@ -8250,7 +8497,7 @@ paths:
type: string
tags:
- Query
'/cosmos/staking/v1beta1/delegations/{delegator_addr}':
/cosmos/staking/v1beta1/delegations/{delegator_addr}:
get:
summary: >-
DelegatorDelegations queries all delegations of a given delegator
@@ -8586,7 +8833,7 @@ paths:
type: boolean
tags:
- Query
'/cosmos/staking/v1beta1/delegators/{delegator_addr}/redelegations':
/cosmos/staking/v1beta1/delegators/{delegator_addr}/redelegations:
get:
summary: Redelegations queries redelegations of given address.
operationId: Redelegations
@@ -8992,7 +9239,7 @@ paths:
type: boolean
tags:
- Query
'/cosmos/staking/v1beta1/delegators/{delegator_addr}/unbonding_delegations':
/cosmos/staking/v1beta1/delegators/{delegator_addr}/unbonding_delegations:
get:
summary: >-
DelegatorUnbondingDelegations queries all unbonding delegations of a
@@ -9330,7 +9577,7 @@ paths:
type: boolean
tags:
- Query
'/cosmos/staking/v1beta1/delegators/{delegator_addr}/validators':
/cosmos/staking/v1beta1/delegators/{delegator_addr}/validators:
get:
summary: |-
DelegatorValidators queries all validators info for given delegator
@@ -9926,7 +10173,7 @@ paths:
type: boolean
tags:
- Query
'/cosmos/staking/v1beta1/delegators/{delegator_addr}/validators/{validator_addr}':
/cosmos/staking/v1beta1/delegators/{delegator_addr}/validators/{validator_addr}:
get:
summary: |-
DelegatorValidator queries validator info for given delegator validator
@@ -10450,7 +10697,7 @@ paths:
type: string
tags:
- Query
'/cosmos/staking/v1beta1/historical_info/{height}':
/cosmos/staking/v1beta1/historical_info/{height}:
get:
summary: HistoricalInfo queries the historical info for given height.
operationId: HistoricalInfo
@@ -12092,7 +12339,7 @@ paths:
type: boolean
tags:
- Query
'/cosmos/staking/v1beta1/validators/{validator_addr}':
/cosmos/staking/v1beta1/validators/{validator_addr}:
get:
summary: Validator queries validator info for given validator address.
operationId: Validator
@@ -12609,7 +12856,7 @@ paths:
type: string
tags:
- Query
'/cosmos/staking/v1beta1/validators/{validator_addr}/delegations':
/cosmos/staking/v1beta1/validators/{validator_addr}/delegations:
get:
summary: ValidatorDelegations queries delegate info for given validator.
operationId: ValidatorDelegations
@@ -12940,7 +13187,7 @@ paths:
type: boolean
tags:
- Query
'/cosmos/staking/v1beta1/validators/{validator_addr}/delegations/{delegator_addr}':
/cosmos/staking/v1beta1/validators/{validator_addr}/delegations/{delegator_addr}:
get:
summary: Delegation queries delegate info for given validator delegator pair.
operationId: Delegation
@@ -13203,7 +13450,7 @@ paths:
type: string
tags:
- Query
'/cosmos/staking/v1beta1/validators/{validator_addr}/delegations/{delegator_addr}/unbonding_delegation':
/cosmos/staking/v1beta1/validators/{validator_addr}/delegations/{delegator_addr}/unbonding_delegation:
get:
summary: |-
UnbondingDelegation queries unbonding info for given validator delegator
@@ -13469,7 +13716,7 @@ paths:
type: string
tags:
- Query
'/cosmos/staking/v1beta1/validators/{validator_addr}/unbonding_delegations':
/cosmos/staking/v1beta1/validators/{validator_addr}/unbonding_delegations:
get:
summary: >-
ValidatorUnbondingDelegations queries unbonding delegations of a
@@ -13811,7 +14058,7 @@ definitions:
properties:
homestead_block:
type: string
title: 'Homestead switch block (nil no fork, 0 = already homestead)'
title: Homestead switch block (nil no fork, 0 = already homestead)
dao_fork_block:
type: string
title: TheDAO hard-fork switch block (nil no fork)
@@ -13838,16 +14085,16 @@ definitions:
title: EIP158 HF block
byzantium_block:
type: string
title: 'Byzantium switch block (nil no fork, 0 = already on byzantium)'
title: Byzantium switch block (nil no fork, 0 = already on byzantium)
constantinople_block:
type: string
title: 'Constantinople switch block (nil no fork, 0 = already activated)'
title: Constantinople switch block (nil no fork, 0 = already activated)
petersburg_block:
type: string
title: Petersburg switch block (nil same as Constantinople)
istanbul_block:
type: string
title: 'Istanbul switch block (nil no fork, 0 = already on istanbul)'
title: Istanbul switch block (nil no fork, 0 = already on istanbul)
muir_glacier_block:
type: string
title: >-
@@ -13855,10 +14102,20 @@ definitions:
activated)
berlin_block:
type: string
title: 'Berlin switch block (nil = no fork, 0 = already on berlin)'
title: Berlin switch block (nil = no fork, 0 = already on berlin)
london_block:
type: string
title: 'London switch block (nil = no fork, 0 = already on london)'
title: London switch block (nil = no fork, 0 = already on london)
arrow_glacier_block:
type: string
title: >-
Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already
activated)
merge_fork_block:
type: string
title: >-
EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already in merge
proceedings)
description: >-
ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int
values
@@ -13886,7 +14143,7 @@ definitions:
data:
type: string
format: byte
title: 'supplied by the contract, usually ABI-encoded'
title: supplied by the contract, usually ABI-encoded
block_number:
type: string
format: uint64
@@ -14123,7 +14380,7 @@ definitions:
data:
type: string
format: byte
title: 'supplied by the contract, usually ABI-encoded'
title: supplied by the contract, usually ABI-encoded
block_number:
type: string
format: uint64
@@ -14205,7 +14462,7 @@ definitions:
properties:
homestead_block:
type: string
title: 'Homestead switch block (nil no fork, 0 = already homestead)'
title: Homestead switch block (nil no fork, 0 = already homestead)
dao_fork_block:
type: string
title: TheDAO hard-fork switch block (nil no fork)
@@ -14232,16 +14489,16 @@ definitions:
title: EIP158 HF block
byzantium_block:
type: string
title: 'Byzantium switch block (nil no fork, 0 = already on byzantium)'
title: Byzantium switch block (nil no fork, 0 = already on byzantium)
constantinople_block:
type: string
title: 'Constantinople switch block (nil no fork, 0 = already activated)'
title: Constantinople switch block (nil no fork, 0 = already activated)
petersburg_block:
type: string
title: Petersburg switch block (nil same as Constantinople)
istanbul_block:
type: string
title: 'Istanbul switch block (nil no fork, 0 = already on istanbul)'
title: Istanbul switch block (nil no fork, 0 = already on istanbul)
muir_glacier_block:
type: string
title: >-
@@ -14249,15 +14506,32 @@ definitions:
activated)
berlin_block:
type: string
title: 'Berlin switch block (nil = no fork, 0 = already on berlin)'
title: Berlin switch block (nil = no fork, 0 = already on berlin)
london_block:
type: string
title: 'London switch block (nil = no fork, 0 = already on london)'
title: London switch block (nil = no fork, 0 = already on london)
arrow_glacier_block:
type: string
title: >-
Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already
activated)
merge_fork_block:
type: string
title: >-
EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already in
merge proceedings)
description: >-
ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int
values
instead of *big.Int.
allow_unprotected_txs:
type: boolean
description: >-
Allow unprotected transactions defines if replay-protected (i.e non
EIP155
signed) transactions can be executed on the state machine.
title: Params defines the EVM module parameters
ethermint.evm.v1.QueryAccountResponse:
type: object
@@ -14284,6 +14558,12 @@ definitions:
description: >-
QueryBalanceResponse is the response type for the Query/Balance RPC
method.
ethermint.evm.v1.QueryBaseFeeResponse:
type: object
properties:
base_fee:
type: string
description: BaseFeeResponse returns the EIP1559 base fee.
ethermint.evm.v1.QueryCodeResponse:
type: object
properties:
@@ -14349,7 +14629,7 @@ definitions:
properties:
homestead_block:
type: string
title: 'Homestead switch block (nil no fork, 0 = already homestead)'
title: Homestead switch block (nil no fork, 0 = already homestead)
dao_fork_block:
type: string
title: TheDAO hard-fork switch block (nil no fork)
@@ -14376,7 +14656,7 @@ definitions:
title: EIP158 HF block
byzantium_block:
type: string
title: 'Byzantium switch block (nil no fork, 0 = already on byzantium)'
title: Byzantium switch block (nil no fork, 0 = already on byzantium)
constantinople_block:
type: string
title: >-
@@ -14387,7 +14667,7 @@ definitions:
title: Petersburg switch block (nil same as Constantinople)
istanbul_block:
type: string
title: 'Istanbul switch block (nil no fork, 0 = already on istanbul)'
title: Istanbul switch block (nil no fork, 0 = already on istanbul)
muir_glacier_block:
type: string
title: >-
@@ -14395,15 +14675,32 @@ definitions:
activated)
berlin_block:
type: string
title: 'Berlin switch block (nil = no fork, 0 = already on berlin)'
title: Berlin switch block (nil = no fork, 0 = already on berlin)
london_block:
type: string
title: 'London switch block (nil = no fork, 0 = already on london)'
title: London switch block (nil = no fork, 0 = already on london)
arrow_glacier_block:
type: string
title: >-
Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already
activated)
merge_fork_block:
type: string
title: >-
EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already
in merge proceedings)
description: >-
ChainConfig defines the Ethereum ChainConfig parameters using
*sdk.Int values
instead of *big.Int.
allow_unprotected_txs:
type: boolean
description: >-
Allow unprotected transactions defines if replay-protected (i.e
non EIP155
signed) transactions can be executed on the state machine.
title: Params defines the EVM module parameters
description: >-
QueryParamsResponse defines the response type for querying x/evm
@@ -14480,7 +14777,7 @@ definitions:
limit:
type: integer
format: int32
title: 'maximum length of output, but zero means unlimited'
title: maximum length of output, but zero means unlimited
overrides:
title: >-
Chain overrides, can be used to execute a trace using future fork
@@ -14489,7 +14786,7 @@ definitions:
properties:
homestead_block:
type: string
title: 'Homestead switch block (nil no fork, 0 = already homestead)'
title: Homestead switch block (nil no fork, 0 = already homestead)
dao_fork_block:
type: string
title: TheDAO hard-fork switch block (nil no fork)
@@ -14516,16 +14813,16 @@ definitions:
title: EIP158 HF block
byzantium_block:
type: string
title: 'Byzantium switch block (nil no fork, 0 = already on byzantium)'
title: Byzantium switch block (nil no fork, 0 = already on byzantium)
constantinople_block:
type: string
title: 'Constantinople switch block (nil no fork, 0 = already activated)'
title: Constantinople switch block (nil no fork, 0 = already activated)
petersburg_block:
type: string
title: Petersburg switch block (nil same as Constantinople)
istanbul_block:
type: string
title: 'Istanbul switch block (nil no fork, 0 = already on istanbul)'
title: Istanbul switch block (nil no fork, 0 = already on istanbul)
muir_glacier_block:
type: string
title: >-
@@ -14533,10 +14830,20 @@ definitions:
activated)
berlin_block:
type: string
title: 'Berlin switch block (nil = no fork, 0 = already on berlin)'
title: Berlin switch block (nil = no fork, 0 = already on berlin)
london_block:
type: string
title: 'London switch block (nil = no fork, 0 = already on london)'
title: London switch block (nil = no fork, 0 = already on london)
arrow_glacier_block:
type: string
title: >-
Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already
activated)
merge_fork_block:
type: string
title: >-
EIP-3675 (TheMerge) switch block (nil = no fork, 0 = already in
merge proceedings)
description: >-
ChainConfig defines the Ethereum ChainConfig parameters using *sdk.Int
values
@@ -17468,7 +17775,7 @@ definitions:
properties:
rate:
type: string
description: 'rate is the commission rate charged to delegators, as a fraction.'
description: rate is the commission rate charged to delegators, as a fraction.
max_rate:
type: string
description: >-
@@ -17489,7 +17796,7 @@ definitions:
properties:
rate:
type: string
description: 'rate is the commission rate charged to delegators, as a fraction.'
description: rate is the commission rate charged to delegators, as a fraction.
max_rate:
type: string
description: >-
+5 -17
View File
@@ -6,10 +6,8 @@ import (
"strings"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/input"
"github.com/cosmos/cosmos-sdk/crypto"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/common/hexutil"
ethcrypto "github.com/ethereum/go-ethereum/crypto"
"github.com/spf13/cobra"
@@ -27,19 +25,8 @@ func UnsafeExportEthKeyCommand() *cobra.Command {
Long: `**UNSAFE** Export an Ethereum private key unencrypted to use in dev tooling`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
inBuf := bufio.NewReader(cmd.InOrStdin())
keyringBackend, _ := cmd.Flags().GetString(flags.FlagKeyringBackend)
rootDir, _ := cmd.Flags().GetString(flags.FlagHome)
clientCtx := client.GetClientContextFromCmd(cmd)
kr, err := keyring.New(
sdk.KeyringServiceName(),
keyringBackend,
rootDir,
inBuf,
clientCtx.Codec,
hd.EthSecp256k1Option(),
)
clientCtx := client.GetClientContextFromCmd(cmd).WithKeyringOptions(hd.EthSecp256k1Option())
clientCtx, err := client.ReadPersistentCommandFlags(clientCtx, cmd.Flags())
if err != nil {
return err
}
@@ -47,7 +34,8 @@ func UnsafeExportEthKeyCommand() *cobra.Command {
decryptPassword := ""
conf := true
switch keyringBackend {
inBuf := bufio.NewReader(cmd.InOrStdin())
switch clientCtx.Keyring.Backend() {
case keyring.BackendFile:
decryptPassword, err = input.GetPassword(
"**WARNING this is an unsafe way to export your unencrypted private key**\nEnter key password:",
@@ -62,7 +50,7 @@ func UnsafeExportEthKeyCommand() *cobra.Command {
}
// Exports private key from keybase using password
armor, err := kr.ExportPrivKeyArmor(args[0], decryptPassword)
armor, err := clientCtx.Keyring.ExportPrivKeyArmor(args[0], decryptPassword)
if err != nil {
return err
}
+4 -17
View File
@@ -7,11 +7,8 @@ import (
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/input"
"github.com/cosmos/cosmos-sdk/crypto"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/common"
"github.com/cerc-io/laconicd/crypto/hd"
@@ -29,23 +26,13 @@ func UnsafeImportKeyCommand() *cobra.Command {
}
func runImportCmd(cmd *cobra.Command, args []string) error {
inBuf := bufio.NewReader(cmd.InOrStdin())
keyringBackend, _ := cmd.Flags().GetString(flags.FlagKeyringBackend)
rootDir, _ := cmd.Flags().GetString(flags.FlagHome)
clientCtx := client.GetClientContextFromCmd(cmd)
kb, err := keyring.New(
sdk.KeyringServiceName(),
keyringBackend,
rootDir,
inBuf,
clientCtx.Codec,
hd.EthSecp256k1Option(),
)
clientCtx := client.GetClientContextFromCmd(cmd).WithKeyringOptions(hd.EthSecp256k1Option())
clientCtx, err := client.ReadPersistentCommandFlags(clientCtx, cmd.Flags())
if err != nil {
return err
}
inBuf := bufio.NewReader(cmd.InOrStdin())
passphrase, err := input.GetPassword("Enter passphrase to encrypt your key:", inBuf)
if err != nil {
return err
@@ -57,5 +44,5 @@ func runImportCmd(cmd *cobra.Command, args []string) error {
armor := crypto.EncryptArmorPrivKey(privKey, passphrase, "eth_secp256k1")
return kb.ImportPrivKey(args[0], armor, passphrase)
return clientCtx.Keyring.ImportPrivKey(args[0], armor, passphrase)
}
+5 -18
View File
@@ -6,7 +6,6 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/keys"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/libs/cli"
@@ -49,7 +48,7 @@ The pass backend requires GnuPG: https://gnupg.org/
addCmd := keys.AddKeyCommand()
// update the default signing algorithm value to "eth_secp256k1"
algoFlag := addCmd.Flag("algo")
algoFlag := addCmd.Flag(flags.FlagKeyAlgorithm)
algoFlag.DefValue = string(hd.EthSecp256k1Type)
err := algoFlag.Value.Set(string(hd.EthSecp256k1Type))
if err != nil {
@@ -65,8 +64,8 @@ The pass backend requires GnuPG: https://gnupg.org/
keys.ImportKeyCommand(),
keys.ListKeysCmd(),
keys.ShowKeysCmd(),
flags.LineBreak,
keys.DeleteKeyCommand(),
keys.RenameKeyCommand(),
keys.ParseKeyStringCommand(),
keys.MigrateCommand(),
flags.LineBreak,
@@ -82,23 +81,11 @@ The pass backend requires GnuPG: https://gnupg.org/
}
func runAddCmd(cmd *cobra.Command, args []string) error {
buf := bufio.NewReader(cmd.InOrStdin())
clientCtx := client.GetClientContextFromCmd(cmd)
var (
kr keyring.Keyring
err error
)
dryRun, _ := cmd.Flags().GetBool(flags.FlagDryRun)
if dryRun {
kr, err = keyring.New(sdk.KeyringServiceName(), keyring.BackendMemory, clientCtx.KeyringDir, buf, clientCtx.Codec, hd.EthSecp256k1Option())
clientCtx = clientCtx.WithKeyring(kr)
}
clientCtx := client.GetClientContextFromCmd(cmd).WithKeyringOptions(hd.EthSecp256k1Option())
clientCtx, err := client.ReadPersistentCommandFlags(clientCtx, cmd.Flags())
if err != nil {
return err
}
buf := bufio.NewReader(clientCtx.Input)
return clientkeys.RunAddCmd(clientCtx, cmd, args, buf)
}
+43 -83
View File
@@ -38,70 +38,16 @@ const (
mnemonicEntropySize = 256
)
// AddKeyCommand defines a keys command to add a generated or recovered private key to keybase.
func AddKeyCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "add <name>",
Short: "Add an encrypted private key (either newly generated or recovered), encrypt it, and save to <name> file",
Long: `Derive a new private key and encrypt to disk.
Optionally specify a BIP39 mnemonic, a BIP39 passphrase to further secure the mnemonic,
and a bip32 HD path to derive a specific account. The key will be stored under the given name
and encrypted with the given password. The only input that is required is the encryption password.
If run with -i, it will prompt the user for BIP44 path, BIP39 mnemonic, and passphrase.
The flag --recover allows one to recover a key from a seed passphrase.
If run with --dry-run, a key would be generated (or recovered) but not stored to the
local keystore.
Use the --pubkey flag to add arbitrary public keys to the keystore for constructing
multisig transactions.
You can create and store a multisig key by passing the list of key names stored in a keyring
and the minimum number of signatures required through --multisig-threshold. The keys are
sorted by address, unless the flag --nosort is set.
Example:
keys add mymultisig --multisig "keyname1,keyname2,keyname3" --multisig-threshold 2
`,
Args: cobra.ExactArgs(1),
RunE: runAddCmdPrepare,
}
f := cmd.Flags()
f.StringSlice(flagMultisig, nil, "List of key names stored in keyring to construct a public legacy multisig key")
f.Int(flagMultiSigThreshold, 1, "K out of N required signatures. For use in conjunction with --multisig")
f.Bool(flagNoSort, false, "Keys passed to --multisig are taken in the order they're supplied")
f.String(keys.FlagPublicKey, "", "Parse a public key in JSON format and saves key info to <name> file.")
f.BoolP(flagInteractive, "i", false, "Interactively prompt user for BIP39 passphrase and mnemonic")
f.Bool(flags.FlagUseLedger, false, "Store a local reference to a private key on a Ledger device")
f.Bool(flagRecover, false, "Provide seed phrase to recover existing key instead of creating")
f.Bool(flagNoBackup, false, "Don't print out seed phrase (if others are watching the terminal)")
f.Bool(flags.FlagDryRun, false, "Perform action, but don't add key to local keystore")
f.String(flagHDPath, "", "Manual HD Path derivation (overrides BIP44 config)")
f.Uint32(flagCoinType, sdk.GetConfig().GetCoinType(), "coin type number for HD derivation")
f.Uint32(flagAccount, 0, "Account number for HD derivation")
f.Uint32(flagIndex, 0, "Address index number for HD derivation")
f.String(flags.FlagKeyAlgorithm, string(etherminthd.EthSecp256k1Type), "Key signing algorithm to generate keys for")
return cmd
}
func runAddCmdPrepare(cmd *cobra.Command, args []string) error {
buf := bufio.NewReader(cmd.InOrStdin())
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
return RunAddCmd(clientCtx, cmd, args, buf)
}
/*
RunAddCmd
input
- bip39 mnemonic
- bip39 passphrase
- bip44 path
- local encryption password
- bip39 mnemonic
- bip39 passphrase
- bip44 path
- local encryption password
output
- armor encrypted private key (saved to file)
- armor encrypted private key (saved to file)
*/
func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *bufio.Reader) error {
var err error
@@ -156,9 +102,11 @@ func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf
return err
}
if pks[i], err = k.GetPubKey(); err != nil {
key, err := k.GetPubKey()
if err != nil {
return err
}
pks[i] = key
}
if noSort, _ := cmd.Flags().GetBool(flagNoSort); !noSort {
@@ -168,29 +116,28 @@ func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf
}
pk := multisig.NewLegacyAminoPubKey(multisigThreshold, pks)
info, err := kb.SaveMultisig(name, pk)
k, err := kb.SaveMultisig(name, pk)
if err != nil {
return err
}
return printCreate(cmd, info, false, "", outputFormat)
return printCreate(cmd, k, false, "", outputFormat)
}
}
pubKey, _ := cmd.Flags().GetString(keys.FlagPublicKey)
if pubKey != "" {
var pk cryptotypes.PubKey
err = ctx.Codec.UnmarshalInterfaceJSON([]byte(pubKey), &pk)
if err = ctx.Codec.UnmarshalInterfaceJSON([]byte(pubKey), &pk); err != nil {
return err
}
k, err := kb.SaveOfflineKey(name, pk)
if err != nil {
return err
}
info, err := kb.SaveOfflineKey(name, pk)
if err != nil {
return err
}
return printCreate(cmd, info, false, "", outputFormat)
return printCreate(cmd, k, false, "", outputFormat)
}
coinType, _ := cmd.Flags().GetUint32(flagCoinType)
@@ -208,13 +155,12 @@ func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf
// If we're using ledger, only thing we need is the path and the bech32 prefix.
if useLedger {
bech32PrefixAccAddr := sdk.GetConfig().GetBech32AccountAddrPrefix()
info, err := kb.SaveLedgerKey(name, algo, bech32PrefixAccAddr, coinType, account, index)
k, err := kb.SaveLedgerKey(name, hd.Secp256k1, bech32PrefixAccAddr, coinType, account, index)
if err != nil {
return err
}
return printCreate(cmd, info, false, "", outputFormat)
return printCreate(cmd, k, false, "", outputFormat)
}
// Get bip39 mnemonic
@@ -276,7 +222,7 @@ func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf
}
}
info, err := kb.NewAccount(name, mnemonic, bip39Passphrase, hdPath, algo)
k, err := kb.NewAccount(name, mnemonic, bip39Passphrase, hdPath, algo)
if err != nil {
return err
}
@@ -288,24 +234,27 @@ func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf
mnemonic = ""
}
return printCreate(cmd, info, showMnemonic, mnemonic, outputFormat)
return printCreate(cmd, k, showMnemonic, mnemonic, outputFormat)
}
func printCreate(cmd *cobra.Command, info *keyring.Record, showMnemonic bool, mnemonic, outputFormat string) error {
func printCreate(cmd *cobra.Command, k *keyring.Record, showMnemonic bool, mnemonic, outputFormat string) error {
switch outputFormat {
case OutputFormatText:
cmd.PrintErrln()
printKeyInfo(cmd.OutOrStdout(), info, keyring.MkAccKeyOutput, outputFormat)
if err := printKeyringRecord(cmd.OutOrStdout(), k, keyring.MkAccKeyOutput, outputFormat); err != nil {
return err
}
// print mnemonic unless requested not to.
if showMnemonic {
fmt.Fprintln(cmd.ErrOrStderr(), "\n**Important** write this mnemonic phrase in a safe place.")
fmt.Fprintln(cmd.ErrOrStderr(), "It is the only way to recover your account if you ever forget your password.")
fmt.Fprintln(cmd.ErrOrStderr(), "")
fmt.Fprintln(cmd.ErrOrStderr(), mnemonic)
if _, err := fmt.Fprintf(cmd.ErrOrStderr(),
"\n**Important** write this mnemonic phrase in a safe place.\nIt is the only way to recover your account if you ever forget your password.\n\n%s\n\n", //nolint:lll
mnemonic); err != nil {
return fmt.Errorf("failed to print mnemonic: %v", err)
}
}
case OutputFormatJSON:
out, err := keyring.MkAccKeyOutput(info)
out, err := keyring.MkAccKeyOutput(k)
if err != nil {
return err
}
@@ -327,3 +276,14 @@ func printCreate(cmd *cobra.Command, info *keyring.Record, showMnemonic bool, mn
return nil
}
func validateMultisigThreshold(k, nKeys int) error {
if k <= 0 {
return fmt.Errorf("threshold must be a positive integer")
}
if nKeys < k {
return fmt.Errorf(
"threshold k of n multisignature: %d < %d", nKeys, k)
}
return nil
}
-61
View File
@@ -1,61 +0,0 @@
package keys
import (
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/libs/cli"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/keys"
)
// Commands registers a sub-tree of commands to interact with
// local private key storage.
func Commands(defaultNodeHome string) *cobra.Command {
cmd := &cobra.Command{
Use: "keys",
Short: "Manage your application's keys",
Long: `Keyring management commands. These keys may be in any format supported by the
Tendermint crypto library and can be used by light-clients, full nodes, or any other application
that needs to sign with a private key.
The keyring supports the following backends:
os Uses the operating system's default credentials store.
file Uses encrypted file-based keystore within the app's configuration directory.
This keyring will request a password each time it is accessed, which may occur
multiple times in a single command resulting in repeated password prompts.
kwallet Uses KDE Wallet Manager as a credentials management application.
pass Uses the pass command line utility to store and retrieve keys.
test Stores keys insecurely to disk. It does not prompt for a password to be unlocked
and it should be use only for testing purposes.
kwallet and pass backends depend on external tools. Refer to their respective documentation for more
information:
KWallet https://github.com/KDE/kwallet
pass https://www.passwordstore.org/
The pass backend requires GnuPG: https://gnupg.org/
`,
}
cmd.AddCommand(
keys.MnemonicKeyCommand(),
AddKeyCommand(),
keys.ExportKeyCommand(),
keys.ImportKeyCommand(),
keys.ListKeysCmd(),
keys.ShowKeysCmd(),
flags.LineBreak,
keys.DeleteKeyCommand(),
keys.ParseKeyStringCommand(),
keys.MigrateCommand(),
)
cmd.PersistentFlags().String(flags.FlagHome, defaultNodeHome, "The application home directory")
cmd.PersistentFlags().String(flags.FlagKeyringDir, "", "The client Keyring directory; if omitted, the default 'home' directory will be used")
cmd.PersistentFlags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)")
cmd.PersistentFlags().String(cli.OutputFlag, "text", "Output format (text|json)")
return cmd
}
+25 -28
View File
@@ -4,7 +4,7 @@ import (
"fmt"
"io"
yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"
"github.com/cosmos/cosmos-sdk/client/keys"
cryptokeyring "github.com/cosmos/cosmos-sdk/crypto/keyring"
@@ -14,48 +14,45 @@ import (
const (
OutputFormatText = "text"
OutputFormatJSON = "json"
// defaultKeyDBName is the client's subdirectory where keys are stored.
defaultKeyDBName = "keys"
)
type bechKeyOutFn func(keyInfo *cryptokeyring.Record) (cryptokeyring.KeyOutput, error)
type bechKeyOutFn func(k *cryptokeyring.Record) (cryptokeyring.KeyOutput, error)
func printKeyInfo(w io.Writer, keyInfo *cryptokeyring.Record, bechKeyOut bechKeyOutFn, output string) {
ko, err := bechKeyOut(keyInfo)
func printKeyringRecord(w io.Writer, k *cryptokeyring.Record, bechKeyOut bechKeyOutFn, output string) error {
ko, err := bechKeyOut(k)
if err != nil {
panic(err)
return err
}
switch output {
case OutputFormatText:
printTextInfos(w, []cryptokeyring.KeyOutput{ko})
if err := printTextRecords(w, []cryptokeyring.KeyOutput{ko}); err != nil {
return err
}
case OutputFormatJSON:
out, err := keys.KeysCdc.MarshalJSON(ko)
if err != nil {
panic(err)
return err
}
fmt.Fprintln(w, string(out))
if _, err := fmt.Fprintln(w, string(out)); err != nil {
return err
}
}
return nil
}
func printTextRecords(w io.Writer, kos []cryptokeyring.KeyOutput) error {
out, err := yaml.Marshal(&kos)
if err != nil {
return err
}
if _, err := fmt.Fprintln(w, string(out)); err != nil {
return err
}
}
func printTextInfos(w io.Writer, kos []cryptokeyring.KeyOutput) {
out, err := yaml.Marshal(&kos)
if err != nil {
panic(err)
}
fmt.Fprintln(w, string(out))
}
func validateMultisigThreshold(k, nKeys int) error {
if k <= 0 {
return fmt.Errorf("threshold must be a positive integer")
}
if nKeys < k {
return fmt.Errorf(
"threshold k of n multisignature: %d < %d", nKeys, k)
}
return nil
}
+19 -17
View File
@@ -6,18 +6,17 @@ import (
"bufio"
"encoding/json"
"fmt"
"math/rand"
"net"
"os"
"path/filepath"
"time"
"github.com/ethereum/go-ethereum/common"
tmcfg "github.com/tendermint/tendermint/config"
"github.com/spf13/cobra"
tmconfig "github.com/tendermint/tendermint/config"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
@@ -35,8 +34,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
mintypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
@@ -89,9 +87,12 @@ type startArgs struct {
func addTestnetFlagsToCmd(cmd *cobra.Command) {
cmd.Flags().Int(flagNumValidators, 4, "Number of validators to initialize the testnet with")
cmd.Flags().StringP(flagOutputDir, "o", "./localnet-setup", "Directory to store initialization data for the testnet")
cmd.Flags().StringP(flagOutputDir, "o", "./.testnets", "Directory to store initialization data for the testnet")
cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created")
cmd.Flags().String(sdkserver.FlagMinGasPrices, fmt.Sprintf("0.000006%s", ethermint.AttoPhoton), "Minimum gas prices to accept for transactions; All fees in a tx must meet this minimum (e.g. 0.01photino,0.001stake)")
cmd.Flags().String(sdkserver.FlagMinGasPrices,
fmt.Sprintf("0.000006%s",
ethermint.AttoPhoton),
"Minimum gas prices to accept for transactions; All fees in a tx must meet this minimum (e.g. 0.01photino,0.001stake)")
cmd.Flags().String(flags.FlagKeyAlgorithm, string(hd.EthSecp256k1Type), "Key signing algorithm to generate keys for")
}
@@ -116,7 +117,7 @@ func NewTestnetCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBala
func testnetInitFilesCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator) *cobra.Command {
cmd := &cobra.Command{
Use: "init-files",
Short: "Initialize config directories & files for a multi-validator testnet running locally via separate processes (e.g. Docker Compose or similar)",
Short: "Initialize config directories & files for a multi-validator testnet running locally via separate processes (e.g. Docker Compose or similar)", //nolint:lll
Long: `init-files will setup "v" number of directories and populate each with
necessary files (private validator, genesis, config, etc.) for running "v" validator nodes.
@@ -126,7 +127,7 @@ or a similar setup where each node has a manually configurable IP address.
Note, strict routability for addresses is turned off in the config file.
Example:
laconicd testnet init-files --v 4 --output-dir ./.testnets --starting-ip-address 192.168.10.2
evmosd testnet init-files --v 4 --output-dir ./.testnets --starting-ip-address 192.168.10.2
`,
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
@@ -153,8 +154,10 @@ Example:
addTestnetFlagsToCmd(cmd)
cmd.Flags().String(flagNodeDirPrefix, "node", "Prefix the directory name for each node with (node results in node0, node1, ...)")
cmd.Flags().String(flagNodeDaemonHome, "laconicd", "Home directory of the node's daemon configuration")
cmd.Flags().String(flagStartingIPAddress, "192.168.10.1", "Starting IP address (192.168.10.1 results in persistent peers list ID0@192.168.10.1:46656, ID1@192.168.10.2:46656, ...)")
cmd.Flags().String(flagNodeDaemonHome, "evmosd", "Home directory of the node's daemon configuration")
cmd.Flags().String(flagStartingIPAddress,
"192.168.0.1",
"Starting IP address (192.168.0.1 results in persistent peers list ID0@192.168.0.1:46656, ID1@192.168.0.2:46656, ...)")
cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)")
return cmd
@@ -170,7 +173,7 @@ and generate "v" directories, populated with necessary validator configuration f
(private validator, genesis, config, etc.).
Example:
laconicd testnet --v 4 --output-dir ./.testnets
evmosd testnet --v 4 --output-dir ./.testnets
`,
RunE: func(cmd *cobra.Command, _ []string) error {
args := startArgs{}
@@ -212,7 +215,7 @@ func initTestnetFiles(
args initArgs,
) error {
if args.chainID == "" {
args.chainID = fmt.Sprintf("ethermint_%d-1", rand.Int63n(9999999999999)+1)
args.chainID = fmt.Sprintf("ethermint_%d-1", tmrand.Int63n(9999999999999)+1)
}
nodeIDs := make([]string, args.numValidators)
@@ -346,8 +349,7 @@ func initTestnetFiles(
customAppTemplate, customAppConfig := config.AppConfig(ethermint.AttoPhoton)
srvconfig.SetConfigTemplate(customAppTemplate)
customTmConfig := tmcfg.DefaultConfig()
if err := sdkserver.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customTmConfig); err != nil {
if err := sdkserver.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, tmconfig.DefaultConfig()); err != nil {
return err
}
@@ -406,7 +408,7 @@ func initGenFiles(
stakingGenState.Params.BondDenom = coinDenom
appGenState[stakingtypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(&stakingGenState)
var govGenState v1.GenesisState
var govGenState govv1.GenesisState
clientCtx.Codec.MustUnmarshalJSON(appGenState[govtypes.ModuleName], &govGenState)
govGenState.DepositParams.MinDeposit[0].Denom = coinDenom
@@ -456,7 +458,7 @@ func collectGenFiles(
outputDir, nodeDirPrefix, nodeDaemonHome string, genBalIterator banktypes.GenesisBalancesIterator,
) error {
var appState json.RawMessage
genTime := time.Now()
genTime := tmtime.Now()
for i := 0; i < numValidators; i++ {
nodeDirName := fmt.Sprintf("%s%d", nodeDirPrefix, i)