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

refactor: should reject transactions which have wrong encoded data #1075

Closed
classicalliu opened this issue Jun 8, 2023 · 1 comment · Fixed by #1076
Closed

refactor: should reject transactions which have wrong encoded data #1075

classicalliu opened this issue Jun 8, 2023 · 1 comment · Fixed by #1076
Assignees
Labels
bug Something isn't working

Comments

@classicalliu
Copy link
Contributor

classicalliu commented Jun 8, 2023

Version

  • Godwoken testnet v1

Describe the bug

When sending a tx with r that has leading zeros to eth_sendRawTransaction, it will return a eth_tx_hash, but after the tx committed to block, the eth_tx_hash will change.

The RPC eth_sendRawTransaction's parameter is a signed raw transaction.

It's encoded with some infos contains r and s, it should regard as quantity when encoding, but when encoding with bytes type, the encoded raw tx will be changed, so it will return a wrong eth_tx_hash.

Expected behavior

leading zeroes are not necessary

Should reject those transactions which have wrong encoded data (e.g. with r that has leading zeros).

Correct Example

https://etherscan.io/tx/0x07c7388b03ab8403deeaefc551efbc632f8531f04dc9993a274dbba9bbb98cbf

{
    "jsonrpc": "2.0",
    "id": 2,
    "result": {
        "accessList": [],
        "blockHash": "0x5cd3dd7c16ad4b9531eb3b5720e8018b37925251eb80c68973368150ce057519",
        "blockNumber": "0x109f5f0",
        "chainId": "0x1",
        "from": "0x65b01a62897ec5d1494a91316ce75c3704ab11cb",
        "gas": "0x2ffb8",
        "gasPrice": "0x6cfc915c7",
        "hash": "0x07c7388b03ab8403deeaefc551efbc632f8531f04dc9993a274dbba9bbb98cbf",
        "input": "0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000006480c64700000000000000000000000000000000000000000000000000000000000000020b080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000002c68af0bb1400000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000002c68af0bb1400000000000000000000000000000000000000000004a715ce36374beaa635218d9700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000c3681a720605bd6f8fe9a2fabff6a7cdecdc605d",
        "maxFeePerGas": "0x9898edcf7",
        "maxPriorityFeePerGas": "0x5f5e100",
        "nonce": "0x72",
        "r": "0xd253ee687ab2d9734a5073d64a0ba26bc3bc1cf4582005137bba05ef88616ea8",
        "s": "0x8ba79925267b17403fdf3ab47641b4aa52322dc385429cc92a7003c5d7c2",
        "to": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
        "transactionIndex": "0xd3",
        "type": "0x2",
        "v": "0x0",
        "value": "0x2c68af0bb140000"
    }
}

References

@classicalliu classicalliu added the bug Something isn't working label Jun 8, 2023
@classicalliu classicalliu changed the title [BUG] [BUG] eth tx hash will changed after commit to block Jun 8, 2023
@Flouse Flouse changed the title [BUG] eth tx hash will changed after commit to block refactor: should reject those transactions with r that has leading zeros Jun 8, 2023
@Flouse Flouse changed the title refactor: should reject those transactions with r that has leading zeros refactor: should reject transaction which have wrong encoded data Jun 8, 2023
@Flouse Flouse changed the title refactor: should reject transaction which have wrong encoded data refactor: should reject transactions which have wrong encoded data Jun 8, 2023
@classicalliu classicalliu linked a pull request Jun 9, 2023 that will close this issue
@Flouse
Copy link
Collaborator

Flouse commented Jun 13, 2023

@Flouse Flouse closed this as completed Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants