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

(BIDS-2535) cleanup method names replacement #2623

Closed
wants to merge 11 commits into from

Conversation

remoterami
Copy link
Collaborator

@remoterami remoterami commented Oct 18, 2023

This PR is based on #2618

🤖 Generated by Copilot at 929fbe8

This pull request enhances the support for contract creation and invocation transactions in the eth2-beaconchain-explorer. It improves the data handling, display, and formatting of these transactions in the bigtable_eth1, handlers, and rpc packages, and adds a new field invokes_contract to the Transaction message in the eth1.proto file.

db/bigtable_eth1.go Outdated Show resolved Hide resolved
rpc/erigon.go Outdated Show resolved Hide resolved
txs = append(txs, types.Eth1BlockPageTransaction{
Hash: fmt.Sprintf("%#x", tx.Hash),
HashFormatted: utils.FormatAddressWithLimits(tx.Hash, "", false, "tx", 15, 18, true),
From: fmt.Sprintf("%#x", tx.From),
FromFormatted: utils.FormatAddressWithLimits(tx.From, names[string(tx.From)], false, "address", 15, 20, true),
To: fmt.Sprintf("%#x", tx.To),
ToFormatted: utils.FormatAddressWithLimits(tx.To, names[string(tx.To)], names[string(tx.To)] == "Contract Creation" || len(method) > 0, "address", 15, 20, true),
ToFormatted: utils.FormatAddressWithLimits(tx.To, names[string(tx.To)], tx.GetInvokesContract(), "address", 15, 20, true),
Copy link
Contributor

Choose a reason for hiding this comment

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

This causes the contract symbol to disappear for "Contract Creation".

Before:
image

Now:
image

Is this intended? Personally I don't think it is as the contract symbol is shown in the same case here:

to := utils.FormatAddress(t.To, nil, toName, false, t.IsContractCreation || t.InvokesContract, !bytes.Equal(t.To, address))


The same applies to

utils.FormatAddressWithLimits(v.GetTo(), names[string(v.GetTo())], v.GetInvokesContract(), "address", 15, 20, true),

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You are correct, this was not intended. A lot has changed with the new approach, I think it should be correct now

db/bigtable_eth1.go Show resolved Hide resolved
@remoterami remoterami force-pushed the BIDS-2535/cleanup_method_names_replacement branch 2 times, most recently from 0d5b7d6 to 4642450 Compare November 6, 2023 17:09
@remoterami remoterami force-pushed the BIDS-2535/cleanup_method_names_replacement branch from 4642450 to 27e9233 Compare November 7, 2023 11:00
@remoterami remoterami closed this Feb 6, 2024
@remoterami remoterami deleted the BIDS-2535/cleanup_method_names_replacement branch February 6, 2024 14:21
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