-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix: change type of formats.receipt.root hash -> hex #952
Conversation
- Currently formatter expects a transaction receipt's root property to be a hash, so 32 bytes - However, that does not match definition used in geth, where this maps to the PostState fields within the Receipt struct, thus the current validation appears to be based on convention - This is currently causing issue with transactions submitted to a non-Ethereum, but EVM and JSON-RPC compliant, network - Refs: - https://github.com/ethereum/go-ethereum/blob/ce9a289/core/types/receipt.go#L49-L52 - NomicFoundation/hardhat#694 (comment)
…hin the formatter.hex validator
👋 @ricmoo @alcuadrado I am not sure about the conventions in this project, so I've made some guesses:
LMK if I need to change anything! |
You don't need to worry about committing any build files. The TypeScript is all you need to worry about. The I'll look in to this and read through your links. Thanks! :) |
Ah didn't think to look inside Semi-related: How do I trigger CI on this PR? I noticed that some PRs have them, but some (such as this one) do not.
No problem |
Oh no, don't worry about it. I usually go through a PR and pick and choose the necessary parts. And then I'll run the admin scripts. :) I actually am not sure about the CI. I only really want it running on my own pushes. I obviously don't mind forks running their own actions on their forked repo, but it seems like a weird security issue to let other people's Actions show up on this repo as it could imply endorsement and expose artifacts that could contain malicious code. The GitHub Actions are very weird, in how they selectively choose things and I cannot figure out how/why. It did originally allow another persons Workflow to run under my repos tab, and the name of the workflow is inconsistent on the workflow list... |
OK cool - will leave as is.
Yeah, just checking in case I missed something - I was looking for a contributors' doc or something to that effect, so just asking you instead. |
Good point, I’ll update the “contributing” link in the docs. :) |
Awesome. BTW, any word on the actual contents of this patch? |
I still need to look more into this and research before I can comment on the contents of the patch... I've got a few other higher priority things I want to get to first, but I should have time next week to look into this. :) |
OK sure ... the crux of the change is just 2 lines of code ( |
Small changes can cause non-trivial issues and can have long-term impacts though. ;) |
Very true! |
Bump! Have you had a chance to check this out yet? |
@ricmoo any word? |
@ricmoo any word on this? |
@ricmoo are you looking at this PR? |
Adding this too: The current validation logic is not compliant with EIP658, in which Specific comments in this linked issue |
Taking a look at the JSON-RPC docs, I found these two references, copied below. @ricmoo this means that the implementation is the PR needs to be modified: I have yet to receive a response on this PR, so LMK if this is something you are open to. https://eth.wiki/json-rpc/API#eth_gettransactionreceipt
https://eth.wiki/json-rpc/API#hex-value-encoding
|
I've been trying to reproduce this without luck. Is there any hosted service and a transaction hash you can provide that causes this issue to occur? I don't quite understand your interpretation, I think. For example:
Means that either a) pre-byzatium uses the property I haven't seen anywhere though that allows I don't mind relaxing this requirement (since the TypeScript definitions don't need to change), but I need to be able to reproduce it first. I've found the transaction hash Please send a transaction hash and JSON-RPC url I can use to test against. Thanks! :) |
Great! The way that I'd characterise this is that the Ethereum JSON-RPC docs allows for a looser validation logic than what is presently implemented in ethers.js, so relaxing said validation logic is a good outcome.
Sure, here is an example, for transaction curl \
-X POST \
-H "Content-Type:application/json" \
--data '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xebd560ea53a5853a7c994b1614634d97a75b00171026ad4d16911eacef113496"],"id":1}' \
https://public-node.testnet.rsk.co {
"result" : {
"from" : "0xca49c0dff330bc85b8c43fca88b404d1a0608de2",
"root" : "0x01",
"transactionIndex" : "0x0",
"to" : "0xad29045d80177930253090a76f3be7a5f5ad565e",
"status" : "0x1",
"cumulativeGasUsed" : "0xdbcd",
"blockNumber" : "0x1b207",
"transactionHash" : "0xebd560ea53a5853a7c994b1614634d97a75b00171026ad4d16911eacef113496",
"logs" : [
{
"transactionIndex" : "0x0",
"blockNumber" : "0x1b207",
"transactionHash" : "0xebd560ea53a5853a7c994b1614634d97a75b00171026ad4d16911eacef113496",
"logIndex" : "0x0",
"data" : "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000645a686699000000000000000000000000000000000000000000000221c5d215e15f65bdc0000000000000000000000000000000000000000000000000000000005d5538740000000000000000000000006d71dbf6b75f52d0aabeb8466741a0c1319427e0",
"address" : "0xad29045d80177930253090a76f3be7a5f5ad565e",
"topics" : [
"0x5a68669900000000000000000000000000000000000000000000000000000000",
"0x000000000000000000000000ca49c0dff330bc85b8c43fca88b404d1a0608de2",
"0x000000000000000000000000000000000000000000000221c5d215e15f65bdc0",
"0x000000000000000000000000000000000000000000000000000000005d553874"
],
"blockHash" : "0x3689cbd699762b3eebc24ff2782c662b835e1472338007d1e00c6b11583a1add"
},
{
"transactionIndex" : "0x0",
"transactionHash" : "0xebd560ea53a5853a7c994b1614634d97a75b00171026ad4d16911eacef113496",
"logIndex" : "0x1",
"blockNumber" : "0x1b207",
"blockHash" : "0x3689cbd699762b3eebc24ff2782c662b835e1472338007d1e00c6b11583a1add",
"address" : "0x6d71dbf6b75f52d0aabeb8466741a0c1319427e0",
"data" : "0x000000000000000000000000000000000000000000000221c5d215e15f65bdc0",
"topics" : [
"0x296ba4ca62c6c21c95e828080cb8aec7481b71390585605300a8a76f9e95b527"
]
}
],
"gasUsed" : "0xdbcd",
"logsBloom" : "0x00000010002000000000045000000000000000000000000000000000000000000000000000010010000000000000000000000000000000000000000000000000100000000000000000000000000000000400000000000000000000000000000000000800000000000000000080000000000002000000000001000000000000000000000400000000000000000000010000000000000000002000000020000000000000000000000000000000000000000080000000000480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000",
"contractAddress" : null,
"blockHash" : "0x3689cbd699762b3eebc24ff2782c662b835e1472338007d1e00c6b11583a1add"
},
"jsonrpc" : "2.0",
"id" : 1
} The part that triggers the validation error in ethers.js is Let me know if you need any more info! |
I've got a local fix for this, I'm just testing it now. |
This should be addressed in 5.0.27. Please try it out and let me know if you still have any issues. Thanks! :) |
It sounds like this is working, so I'm going to close this. Please re-open if you have any more issues. Thanks! :) |
Status update: This now works some of the time, but not all of the time. Reopened this old related issue for further investigation - rsksmart/rskj#1328 |
@bguiz can you provide an example transaction which returns |
What
root
ashex
instead ofhash
Formatter
class directlyFormatter
at the moment, so added this in a new test fileWhy
where this maps to the PostState fields within the Receipt struct,
thus the current validation appears to be based on convention
a non-Ethereum, but EVM and JSON-RPC compliant, network
Refs