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

"Reset" button in UI #7406

Merged
merged 8 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/services/keystore/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func (ks *eth) Create(chainIDs ...*big.Int) (ethkey.KeyV2, error) {
if err == nil {
ks.notify()
}
ks.logger.Infow(fmt.Sprintf("Created EVM key with ID %s", key.Address.Hex()), "address", key.Address.Hex(), "evmChainIDs", chainIDs)
Copy link
Contributor

Choose a reason for hiding this comment

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

What format does chainIDs get logged in? JSON array?
Might we later get annoyed by the plural key name evmChainIDs when trying to filter logs by keys and evmChainID doesn't match this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, JSON array.

I think the plural is ok.

return key, err
}

Expand Down
10 changes: 10 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
This new, default estimator for Arbitrum networks uses the suggested gas price (up to `ETH_MAX_GAS_PRICE_WEI`, with `1000 gwei` default) as well
as an estimated gas limit (up to `ETH_GAS_LIMIT_MAX`, with `1,000,000,000` default).
- `ETH_GAS_LIMIT_MAX` to put a maximum on the gas limit returned by the `Arbitrum` estimator.
- `/keys` page in Operator UI now exposes several admin commands, namely:
- "abandon" to abandon all current txes
- enable/disable a key for a given chain
- manually set the nonce for a key
See [this PR](https://github.com/smartcontractkit/chainlink/pull/7406) for a screenshot example.

## 1.8.0 - 2022-09-01

Expand All @@ -38,6 +43,11 @@ as an estimated gas limit (up to `ETH_GAS_LIMIT_MAX`, with `1,000,000,000` defau
- `chainlink keys eth chain --address "0xEXAMPLE" --evmChainID 99 --enable`
- Disable a key for a particular chain:
- `chainlink keys eth chain --address "0xEXAMPLE" --evmChainID 99 --disable`
- Abandon all currently pending transactions (use with caution!):
- `chainlink evm keys chain --address "0xEXAMPLE" --evmChainID 99 --abandon`
- Commands can be combined e.g.
- Reset nonce and abandon all currently pending transaction:
- `chainlink evm keys chain --address "0xEXAMPLE" --evmChainID 99 --setNextNonce 42 --abandon`

### Changed

Expand Down
16 changes: 16 additions & 0 deletions operator_ui/@types/core/store/models.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import internal from 'assert'

declare module 'core/store/models' {
import * as common from 'github.com/ethereum/go-ethereum/common'
import * as gorm from 'github.com/jinzhu/gorm'
Expand Down Expand Up @@ -62,6 +64,13 @@ declare module 'core/store/models' {
httpURL: string
wsURL: string
}
export interface EVMKeysChainRequest {
address: string
evmChainID: string
nextNonce: ?integer
abandon: ?boolean
enabled: ?boolean
}

export type Chain = {
config: Record<string, JSONPrimitive>
Expand All @@ -80,6 +89,13 @@ declare module 'core/store/models' {
state: string
}

export type EVMKey = {
evmChainID: string
address: string
disabled: boolean
nonce: integer
}

// We really need to change the API for this. It not only returns levels but
// true/false for IsSQLEnabled
export type LogConfigLevel =
Expand Down
34 changes: 34 additions & 0 deletions operator_ui/src/api/v2/evmKeys.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import * as jsonapi from 'utils/json-api-client'
import { boundMethod } from 'autobind-decorator'
import * as models from 'core/store/models'

export const ENDPOINT = '/v2/keys/evm/chain'

export class EVMKeys {
constructor(private api: jsonapi.Api) {}

@boundMethod
public chain(
request: models.EVMKeysChainRequest,
): Promise<jsonapi.ApiResponse<models.EVMKey>> {
const query = new URLSearchParams()

query.append('address', request.address)
query.append('evmChainID', request.evmChainID)
if (request.nextNonce !== null) {
query.append('nextNonce', request.nextNonce)
}
if (request.abandon !== null) {
query.append('abandon', String(request.abandon))
}
if (request.enabled !== null) {
query.append('enabled', String(request.enabled))
}

const endpoint = ENDPOINT + '?' + query.toString()

return this.api.createResource<models.EVMKeysChainRequest, models.EVMKey>(
endpoint,
)()
}
}
2 changes: 2 additions & 0 deletions operator_ui/src/api/v2/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Api } from 'utils/json-api-client'
import { BulkDeleteRuns } from './bulkDeleteRuns'
import { Chains } from './chains'
import { EVMKeys } from './evmKeys'
import { Jobs } from './jobs'
import { LogConfig } from './logConfig'
import { Nodes } from './nodes'
Expand All @@ -15,4 +16,5 @@ export class V2 {
public nodes = new Nodes(this.api)
public jobs = new Jobs(this.api)
public webauthn = new WebAuthn(this.api)
public evmKeys = new EVMKeys(this.api)
}
Loading