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

Add txHash to rlp store marshal/unmarshal #528

Merged

Conversation

0xAleksaOpacic
Copy link
Contributor

@0xAleksaOpacic 0xAleksaOpacic commented Apr 28, 2022

Description

Fixed EDGE-531

When subscribing to events, txHash was always 0x00

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

Manual tests

  • I have added a unit test that covers marshalling/unmarshalling for receipts in storage rlp.

  • If someone wants to do manuall tests:

    1. Clone repo https://github.com/Aleksao998/SubscribeToEvents-EVM
    2. Deploy contract (from repo) to polygon-edge network
    3. Change address in main.go
    4. Trigger event from remix
  • Manually tested backward compatibility

@0xAleksaOpacic 0xAleksaOpacic added the hotfix Major bug fix that should be merged ASAP label Apr 29, 2022
@0xAleksaOpacic 0xAleksaOpacic marked this pull request as ready for review April 29, 2022 11:22
jsonrpc/filter_manager.go Outdated Show resolved Hide resolved
types/rlp_unmarshal_storage.go Outdated Show resolved Hide resolved
@Kourin1996
Copy link
Contributor

@Aleksao998 Test failed in my local environment. Please check it?

?       github.com/0xPolygon/polygon-edge/helper/tests  [no test files]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x16899f2]

goroutine 144 [running]:
github.com/0xPolygon/polygon-edge/jsonrpc.(*mockStore).GetBlockByHash(0xc0004a4680, 0x0, 0x0, 0x0, 0x200000000000000, 0xc00012c101, 0x1, 0x1)
        <autogenerated>:1 +0x32
github.com/0xPolygon/polygon-edge/jsonrpc.(*FilterManager).appendLogsToFilters(0xc0000a0120, 0xc0004c9200, 0x1, 0x2, 0x0)
        /Users/kourin/go/src/github.com/0xPolygon/polygon-edge/jsonrpc/filter_manager.go:494 +0x3bc
github.com/0xPolygon/polygon-edge/jsonrpc.(*FilterManager).processEvent(0xc0000a0120, 0xc000020b40, 0x0, 0x0)
        /Users/kourin/go/src/github.com/0xPolygon/polygon-edge/jsonrpc/filter_manager.go:463 +0x149
github.com/0xPolygon/polygon-edge/jsonrpc.(*FilterManager).dispatchEvent(0xc0000a0120, 0xc000020b40, 0x0, 0x0)
        /Users/kourin/go/src/github.com/0xPolygon/polygon-edge/jsonrpc/filter_manager.go:439 +0x39
github.com/0xPolygon/polygon-edge/jsonrpc.(*FilterManager).Run(0xc0000a0120)
        /Users/kourin/go/src/github.com/0xPolygon/polygon-edge/jsonrpc/filter_manager.go:290 +0x1b2
created by github.com/0xPolygon/polygon-edge/jsonrpc.TestFilterLog
        /Users/kourin/go/src/github.com/0xPolygon/polygon-edge/jsonrpc/filter_manager_test.go:18 +0x14c
FAIL    github.com/0xPolygon/polygon-edge/jsonrpc       0.378s
?       github.com/0xPolygon/polygon-edge/licenses      [no test files]

@0xAleksaOpacic
Copy link
Contributor Author

@Aleksao998 Test failed in my local environment. Please check it?

?       github.com/0xPolygon/polygon-edge/helper/tests  [no test files]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x16899f2]

goroutine 144 [running]:
github.com/0xPolygon/polygon-edge/jsonrpc.(*mockStore).GetBlockByHash(0xc0004a4680, 0x0, 0x0, 0x0, 0x200000000000000, 0xc00012c101, 0x1, 0x1)
        <autogenerated>:1 +0x32
github.com/0xPolygon/polygon-edge/jsonrpc.(*FilterManager).appendLogsToFilters(0xc0000a0120, 0xc0004c9200, 0x1, 0x2, 0x0)
        /Users/kourin/go/src/github.com/0xPolygon/polygon-edge/jsonrpc/filter_manager.go:494 +0x3bc
github.com/0xPolygon/polygon-edge/jsonrpc.(*FilterManager).processEvent(0xc0000a0120, 0xc000020b40, 0x0, 0x0)
        /Users/kourin/go/src/github.com/0xPolygon/polygon-edge/jsonrpc/filter_manager.go:463 +0x149
github.com/0xPolygon/polygon-edge/jsonrpc.(*FilterManager).dispatchEvent(0xc0000a0120, 0xc000020b40, 0x0, 0x0)
        /Users/kourin/go/src/github.com/0xPolygon/polygon-edge/jsonrpc/filter_manager.go:439 +0x39
github.com/0xPolygon/polygon-edge/jsonrpc.(*FilterManager).Run(0xc0000a0120)
        /Users/kourin/go/src/github.com/0xPolygon/polygon-edge/jsonrpc/filter_manager.go:290 +0x1b2
created by github.com/0xPolygon/polygon-edge/jsonrpc.TestFilterLog
        /Users/kourin/go/src/github.com/0xPolygon/polygon-edge/jsonrpc/filter_manager_test.go:18 +0x14c
FAIL    github.com/0xPolygon/polygon-edge/jsonrpc       0.378s
?       github.com/0xPolygon/polygon-edge/licenses      [no test files]

Fixed 25601c8

jsonrpc/filter_manager.go Outdated Show resolved Hide resolved
Copy link
Contributor

@Kourin1996 Kourin1996 left a comment

Choose a reason for hiding this comment

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

LGTM. Please resolve @dbrajovic's comment

Copy link
Contributor

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

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

Looks good 💯

Please check the comment I've left for the backwards compatibility headache 🙏

@ZeljkoBenovic ZeljkoBenovic linked an issue May 10, 2022 that may be closed by this pull request
@zivkovicmilos zivkovicmilos added the breaking change Functionality that contains breaking changes label May 10, 2022
@lazartravica
Copy link
Contributor

@zivkovicmilos @Aleksao998 Let's plan the release accordingly with:

Is the old blockchain produced by old clients still able to be synced by the new client?

@zivkovicmilos zivkovicmilos added this to the 0.4.0 milestone May 13, 2022
@0xAleksaOpacic 0xAleksaOpacic merged commit 315cc6f into develop May 16, 2022
@github-actions github-actions bot locked and limited conversation to collaborators May 16, 2022
@0xAleksaOpacic 0xAleksaOpacic deleted the hotfix/add_txHash_rlp_storage_marshal_unmarshal branch May 16, 2022 15:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking change Functionality that contains breaking changes hotfix Major bug fix that should be merged ASAP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Event logs transaction hash is null
5 participants