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

accounts/abi: fix panic in MethodById lookup. Fixes #17797 #17798

Merged
merged 1 commit into from
Oct 1, 2018

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Oct 1, 2018

Trivial fix,

@holiman holiman requested a review from gballet October 1, 2018 08:37
Copy link
Member

@gballet gballet left a comment

Choose a reason for hiding this comment

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

LGTM, just a minor code style commment.

@@ -137,6 +137,9 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
// MethodById looks up a method by the 4-byte id
// returns nil if none found
func (abi *ABI) MethodById(sigdata []byte) (*Method, error) {
if len(sigdata) < 4 {
Copy link
Member

Choose a reason for hiding this comment

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

Please use a constant name instead of a hardcoded number, something like MethodIdLength

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahmm.. really? MethodById looks up a method by the 4-byte id -- it's a 4-byte id, do we really have to make it generic for N-byte ids?

Copy link
Member

Choose a reason for hiding this comment

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

it's not about being generic (a variable) but documenting (a constant name). Alright, it's not a blocker let's move on.

}
}

func TestABI_MethodByIdEmpty(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

I guess this is a leftover from a previous test, and that you moved the test to TestABI_MethodById ? Anyhow, no need to commit an empty function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops

@holiman
Copy link
Contributor Author

holiman commented Oct 1, 2018

Fixed, squashed

Copy link
Member

@gballet gballet left a comment

Choose a reason for hiding this comment

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

LGTM

@gballet gballet merged commit 96fd50b into ethereum:master Oct 1, 2018
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Dec 27, 2024
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Dec 27, 2024
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Dec 27, 2024
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Dec 27, 2024
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Dec 27, 2024
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Dec 27, 2024
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Dec 27, 2024
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Dec 27, 2024
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Dec 28, 2024
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Dec 30, 2024
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Dec 30, 2024
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Dec 30, 2024
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Dec 30, 2024
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 1, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 3, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 4, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 6, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 10, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 10, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 14, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 16, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 17, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 22, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 22, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 23, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Jan 24, 2025
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.

2 participants