From 9d891bb0f411aea39e68ee61ef7d25b1a5012a7c Mon Sep 17 00:00:00 2001 From: james-prysm Date: Mon, 4 Nov 2024 14:59:00 -0600 Subject: [PATCH] fixing access list transactions" --- beacon-chain/sync/subscriber_beacon_blocks.go | 4 +++ testing/endtoend/components/eth1/BUILD.bazel | 2 ++ .../endtoend/components/eth1/transactions.go | 30 ++++++++++++++----- time/slots/slottime.go | 2 +- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/beacon-chain/sync/subscriber_beacon_blocks.go b/beacon-chain/sync/subscriber_beacon_blocks.go index 45e8608449cb..02378d077503 100644 --- a/beacon-chain/sync/subscriber_beacon_blocks.go +++ b/beacon-chain/sync/subscriber_beacon_blocks.go @@ -12,6 +12,7 @@ import ( "github.com/prysmaticlabs/prysm/v5/consensus-types/blocks" "github.com/prysmaticlabs/prysm/v5/consensus-types/interfaces" "github.com/prysmaticlabs/prysm/v5/io/file" + "github.com/prysmaticlabs/prysm/v5/runtime/version" "github.com/prysmaticlabs/prysm/v5/time/slots" "google.golang.org/protobuf/proto" ) @@ -62,6 +63,9 @@ func (s *Service) beaconBlockSubscriber(ctx context.Context, msg proto.Message) // This function reconstructs the blob sidecars from the EL using the block's KZG commitments, // broadcasts the reconstructed blobs over P2P, and saves them into the blob storage. func (s *Service) reconstructAndBroadcastBlobs(ctx context.Context, block interfaces.ReadOnlySignedBeaconBlock) { + if block.Version() < version.Deneb { + return + } startTime, err := slots.ToTime(uint64(s.cfg.chain.GenesisTime().Unix()), block.Block().Slot()) if err != nil { log.WithError(err).Error("Failed to convert slot to time") diff --git a/testing/endtoend/components/eth1/BUILD.bazel b/testing/endtoend/components/eth1/BUILD.bazel index 46bc9c0a7c92..93facd8b3be1 100644 --- a/testing/endtoend/components/eth1/BUILD.bazel +++ b/testing/endtoend/components/eth1/BUILD.bazel @@ -28,12 +28,14 @@ go_library( "//testing/endtoend/types:go_default_library", "//testing/middleware/engine-api-proxy:go_default_library", "//testing/util:go_default_library", + "@com_github_ethereum_go_ethereum//:go_default_library", "@com_github_ethereum_go_ethereum//accounts/abi/bind:go_default_library", "@com_github_ethereum_go_ethereum//accounts/keystore:go_default_library", "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_ethereum_go_ethereum//core/types:go_default_library", "@com_github_ethereum_go_ethereum//crypto/kzg4844:go_default_library", "@com_github_ethereum_go_ethereum//ethclient:go_default_library", + "@com_github_ethereum_go_ethereum//ethclient/gethclient:go_default_library", "@com_github_ethereum_go_ethereum//rpc:go_default_library", "@com_github_holiman_uint256//:go_default_library", "@com_github_mariusvanderwijden_fuzzyvm//filler:go_default_library", diff --git a/testing/endtoend/components/eth1/transactions.go b/testing/endtoend/components/eth1/transactions.go index 929521e73cd8..33601d97b62b 100644 --- a/testing/endtoend/components/eth1/transactions.go +++ b/testing/endtoend/components/eth1/transactions.go @@ -12,11 +12,13 @@ import ( "github.com/MariusVanDerWijden/FuzzyVM/filler" txfuzz "github.com/MariusVanDerWijden/tx-fuzz" + "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto/kzg4844" "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/ethclient/gethclient" "github.com/ethereum/go-ethereum/rpc" "github.com/holiman/uint256" "github.com/pkg/errors" @@ -266,15 +268,27 @@ func RandomBlobTx(rpc *rpc.Client, f *filler.Filler, sender common.Address, nonc return New4844Tx(nonce, &to, gas, chainID, tip, feecap, value, code, big.NewInt(1000000), data, make(types.AccessList, 0)), nil case 1: // 4844 transaction with AL nonce, to, value, gas, gasPrice, code - tx := types.NewTx(&types.AccessListTx{ - Nonce: nonce, - To: &to, - Value: value, - Gas: gas, - //GasPrice: gasPrice, - Data: code, + tx := types.NewTx(&types.LegacyTx{ + Nonce: nonce, + To: &to, + Value: value, + Gas: gas, + GasPrice: gasPrice, + Data: code, }) - al, err := txfuzz.CreateAccessList(rpc, tx, sender) + + // TODO: replace call with al, err := txfuzz.CreateAccessList(rpc, tx, sender) when txfuzz is fixed in new release + msg := ethereum.CallMsg{ + From: sender, + To: tx.To(), + Gas: tx.Gas(), + GasPrice: tx.GasPrice(), + Value: tx.Value(), + Data: tx.Data(), + AccessList: nil, + } + geth := gethclient.New(rpc) + al, _, _, err := geth.CreateAccessList(context.Background(), msg) if err != nil { return nil, errors.Wrap(err, "CreateAccessList") } diff --git a/time/slots/slottime.go b/time/slots/slottime.go index ba065e1cc3bb..3950094bf390 100644 --- a/time/slots/slottime.go +++ b/time/slots/slottime.go @@ -265,7 +265,7 @@ func SyncCommitteePeriodStartEpoch(e primitives.Epoch) (primitives.Epoch, error) // given slot start time func SecondsSinceSlotStart(s primitives.Slot, genesisTime, timeStamp uint64) (uint64, error) { if timeStamp < genesisTime+uint64(s)*params.BeaconConfig().SecondsPerSlot { - return 0, fmt.Errorf("could not compute seconds since slot start: invalid timestamp.slot%d got %d, want %d", s, timeStamp, genesisTime+uint64(s)*params.BeaconConfig().SecondsPerSlot) + return 0, fmt.Errorf("could not compute seconds since slot %d start: invalid timestamp, got %d < want %d", s, timeStamp, genesisTime+uint64(s)*params.BeaconConfig().SecondsPerSlot) } return timeStamp - genesisTime - uint64(s)*params.BeaconConfig().SecondsPerSlot, nil }