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

Fix hasher #1394

Merged
merged 1 commit into from
Dec 24, 2024
Merged

Fix hasher #1394

merged 1 commit into from
Dec 24, 2024

Conversation

cffls
Copy link
Contributor

@cffls cffls commented Dec 23, 2024

Description

This will fix a hasher bug that was introduced in a23701f

The error can occur when the hasher is used by more than one goroutine at the same time:

panic: runtime error: slice bounds out of range [:-5]
goroutine 41937862 [running]:
golang.org/x/crypto/sha3.(*state).Write(0xc0ae67eb60, {0xc0e01441e0?, 0x14, 0x2a42620?})
/root/go/pkg/mod/golang.org/x/[email protected]/sha3/sha3.go:135 +0x255
github.com/ethereum/go-ethereum/crypto.HashData({0x7fb51c2a9a58, 0xc0ae67eb60}, {0xc0e01441e0, 0x14, 0x14})
/go/src/github.com/maticnetwork/bor/crypto/crypto.go:79 +0x6b
github.com/ethereum/go-ethereum/core/state.(*StateDB).getStateObject.func1(0xc17b255680)
/go/src/github.com/maticnetwork/bor/core/state/statedb.go:992 +0xfa
github.com/ethereum/go-ethereum/core/state.MVRead[...](0xc17b255680?, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...}, ...)
/go/src/github.com/maticnetwork/bor/core/state/statedb.go:314 +0x4ea
github.com/ethereum/go-ethereum/core/state.(*StateDB).getStateObject(0xc17b255680, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...})
/go/src/github.com/maticnetwork/bor/core/state/statedb.go:979 +0x1de
github.com/ethereum/go-ethereum/core/state.(*StateDB).GetBalance.func1(0x274dd60?)
/go/src/github.com/maticnetwork/bor/core/state/statedb.go:647 +0x25
github.com/ethereum/go-ethereum/core/state.MVRead[...](0xc17b255680?, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...}, ...)
/go/src/github.com/maticnetwork/bor/core/state/statedb.go:314 +0x4ea
github.com/ethereum/go-ethereum/core/state.(*StateDB).GetBalance(0xc17b255680, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...})
/go/src/github.com/maticnetwork/bor/core/state/statedb.go:646 +0x1d8
github.com/ethereum/go-ethereum/core/state.(*StateDB).ApplyMVWriteSet(0xc12958ab40, {0xc0df8c0008, 0x4f, 0xc12958ab40?})
/go/src/github.com/maticnetwork/bor/core/state/statedb.go:422 +0x2c5
github.com/ethereum/go-ethereum/core.(*ExecutionTask).Settle(0xc0d52b5d48)
/go/src/github.com/maticnetwork/bor/core/parallel_state_processor.go:183 +0x305
github.com/ethereum/go-ethereum/core/blockstm.(*ParallelExecutor).Prepare.func2()
/go/src/github.com/maticnetwork/bor/core/blockstm/executor.go:383 +0x3c
created by github.com/ethereum/go-ethereum/core/blockstm.(*ParallelExecutor).Prepare in goroutine 41937844
/go/src/github.com/maticnetwork/bor/core/blockstm/executor.go:381 +0x3c7

Changes

  • 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)
  • Changes only for a subset of nodes

Breaking changes

Please complete this section if any breaking changes have been made, otherwise delete it

Nodes audience

In case this PR includes changes that must be applied only to a subset of nodes, please specify how you handled it (e.g. by adding a flag with a default value...)

Checklist

  • I have added at least 2 reviewer or the whole pos-v1 team
  • I have added sufficient documentation in code
  • I will be resolving comments - if any - by pushing each fix in a separate commit and linking the commit hash in the comment reply
  • Created a task in Jira and informed the team for implementation in Erigon client (if applicable)
  • Includes RPC methods changes, and the Notion documentation has been updated

Cross repository changes

  • This PR requires changes to heimdall
    • In case link the PR here:
  • This PR requires changes to matic-cli
    • In case link the PR here:

Testing

  • I have added unit tests
  • I have added tests to CI
  • I have tested this code manually on local environment
  • I have tested this code manually on remote devnet using express-cli
  • I have tested this code manually on mumbai/amoy
  • I have created new e2e tests into express-cli

Manual tests

Please complete this section with the steps you performed if you ran manual tests for this functionality, otherwise delete it

Additional comments

Please post additional comments in this section if you have them, otherwise delete it

This will fix a hasher bug that was introduced in maticnetwork@a23701f
@cffls cffls merged commit 47cdc30 into maticnetwork:develop Dec 24, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants