feat(toolbox): troubleshooting utilities#995
Merged
benjlevesque merged 5 commits intomasterfrom Nov 29, 2022
Merged
Conversation
benjlevesque
commented
Nov 28, 2022
| import * as yargs from 'yargs'; | ||
| import { modeType } from './logger'; | ||
|
|
||
| const argv = yargs.parseSync(); |
Contributor
Author
There was a problem hiding this comment.
the type of argv changed in recent versions
benjlevesque
commented
Nov 28, 2022
| network, | ||
| signer, | ||
| ) as RequestOpenHashSubmitter; // type mismatch with ethers. | ||
| this.txSubmitter = new EthereumTransactionSubmitter({ network, signer, logger }); |
Contributor
Author
There was a problem hiding this comment.
refactoring to isolate the part where we submit the transaction to the blockchain, for better reusability.
benjlevesque
commented
Nov 28, 2022
| @@ -0,0 +1,75 @@ | |||
| import { BigNumber, ContractTransaction, providers, utils } from 'ethers'; | |||
Contributor
Author
There was a problem hiding this comment.
mostly moving code from ethereum-storage-ethers.
benjlevesque
commented
Nov 28, 2022
| } | ||
|
|
||
| /** Encodes the submission of an IPFS hash, with fees according to `ipfsSize` */ | ||
| async prepareSubmit(ipfsHash: string, ipfsSize: number): Promise<providers.TransactionRequest> { |
Contributor
Author
There was a problem hiding this comment.
this is new. Enables better testability.
benjlevesque
commented
Nov 28, 2022
| return { to: this.hashSubmitter.address, data: tx, value: fee, ...gasFees }; | ||
| } | ||
|
|
||
| private async getGasFees(): Promise<{ |
Contributor
Author
There was a problem hiding this comment.
this is new. Isolate the gas fees logic from main logic
benjlevesque
commented
Nov 28, 2022
| }; | ||
| } | ||
|
|
||
| public async getSize(ipfsHash: string): Promise<number> { |
Contributor
Author
There was a problem hiding this comment.
introduced a new function for reusability
b047494 to
2c4df17
Compare
alexandre-abrioux
approved these changes
Nov 28, 2022
Co-authored-by: Alexandre ABRIOUX <alexandre-abrioux@users.noreply.github.com>
2f692ce to
7d7be74
Compare
olivier7delf
approved these changes
Nov 29, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a few utilities that we missed when troubleshooting an incident today.
To avoiding re-coding core logic parts, I refactored 2 pieces of the
ethereum-storageto expose internals.