-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Allow null TransactionReceipt per documentation #4841
Conversation
Pull Request Test Coverage Report for Build 2005946998
💛 - Coveralls |
|
When running dtslint locally (as well as in that failing check), I'm getting some errors in
The first and last of those, combined with the or pipe, is TransactionReceipt, so this should be a match, but it seems like either the TransactionReceipt type is not getting correctly imported or the types are getting rearranged in the expectation and this rearrangement is what's causing the issue - a problem in the test framework rather than the code change. Unfortunately I can't quite figure out which with the remaining time today. However, swapping the order of the two types in the expectation statement doesn't fix it. |
|
On further investigation trying to simplify the issue, it appears that the types referred to in $ExpectType lines come from a completely different source than the imports at the top of the file. The imports and the tests associated with them can be completely removed and it's still getting those expected type definitions from somewhere, other than the types defined in the current repository. More specifically, it's pulling those types from the node_modules/web3-core folder inside the web3-eth-ens directory. This may be related to the pre-existing circular dependency warning
It appears this may be getting resolved by having circularity broken in a way that makes it impossible to update types without having tests fail because the type being tested to in the current repo differs from the type as published on NPM. I can see in web3-eth-ens/package.json that web3-eth is a devDependency, probably because the type definition for the Ens constructor takes an Eth object imported from web3-eth. That eth object is stored and used for a call to I can also see that web3-eth-ens is a dependency of web3-eth because setProvider() updates a contained ens object to null out the detected address and last sync check. It's not clear to me what this contained ens object is used for or why it's there, and I suspect the circularity might be resolvable by removing the ENS references in web3-eth. However, I don't think that should have to be within the scope of this PR. |
|
@wbt Please resolve the conflicts for |
|
I did so by moving this under the list for 1.7.2. However, it's hard to predict that part as it depends on how long reviews take, especially if getting this reviewed depends on some solution to #4845 being developed first to be able to get CI input from current code instead of an npm cache. |
jdevcs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wbt Build / lint is failing with:
/packages/web3-eth-ens/types/tests/ens-test.ts:48:1 ERROR: 48:1 expect TypeScript@local expected type to be: PromiEvent<TransactionReceipt | TransactionRevertInstructionError> got: PromiEvent<{ status: boolean; transactionHash: string; transactionIndex: number; blockHash: string; blockNumber: number; from: string; to: string; contractAddress?: string | undefined; cumulativeGasUsed: number; gasUsed: number; effectiveGasPrice: number; logs: Log[]; logsBloom: string; events?: { [eventName: string]: EventLog; } | undefined; } | TransactionRevertInstructionError | null> ERROR: 50:1 expect TypeScript@local expected type to be: PromiEvent<TransactionReceipt | TransactionRevertInstructionError> got: PromiEvent<{ status: boolean; transactionHash: string; transactionIndex: number; blockHash: string; blockNumber: number; from: string; to: string; contractAddress?: string | undefined; cumulativeGasUsed: number; gasUsed: number; effectiveGasPrice: number; logs: Log[]; logsBloom: string; events?: { [eventName: string]: EventLog; } | undefined; } | TransactionRevertInstructionError | null> ERROR: 52:1 expect TypeScript@local expected type to be: PromiEvent<TransactionReceipt | TransactionRevertInstructionError> got: PromiEvent<{ status: boolean; transactionHash: string; transactionIndex: number; blockHash: string; blockNumber: number; from: string; to: string; contractAddress?: string | undefined; cumulativeGasUsed: number; gasUsed: number; effectiveGasPrice: number; logs: Log[]; logsBloom: string; events?: { [eventName: string]: EventLog; } | undefined; } | TransactionRevertInstructionError | null> ERROR: 55:1 expect TypeScript@local expected type to be: PromiEvent<TransactionReceipt | TransactionRevertInstructionError> ......
|
@jdevcs Did you see the comment above explaining this? |
|
This PR has been automatically marked as stale beacause it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
|
I don't think this should be marked as stale just because of the difficulty of getting a human to look at code. |
|
This PR has been automatically marked as stale beacause it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
|
I still don't think this should be marked as stale just because of the difficulty of getting a human to look at code. |
|
This PR has been automatically marked as stale beacause it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
|
I still don't think this should be marked as stale just because of the difficulty of getting a human to look at code. |
|
This PR has been automatically marked as stale beacause it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
|
This PR has been automatically marked as stale beacause it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
|
As mentioned here, it would be ideal to merge this for the sake of correctness, but I think this could be a frustrating breaking change for Typescript users as this provides a minor benefit to them, but would force them to update their previously working code. This issue is handled in the rewrite, @wbt Sorry this has taken so long, thank you for your continued contributions to the project |
Description
Documentation states that the transaction receipt could be null if no receipt was found.
An alternative would be to change this line to add
| nulljust before>;but the proposed solution is more general as the issue may be in other places.Type of change
Checklist:
npm run dtslintwith success and extended the tests and types if necessary.npm run test:unitwith success.npm run test:covand my test cases cover all the lines and branches of the added code. [There aren't lines of added code and this command is broken.]npm run buildwith success.dist/web3.min.jsin a browser. [This doesn't make changes in compiled code.]CHANGELOG.mdfile in the root folder.