From 1638bd3d05fe2043fc65ce8d6c8c8e9ff77b0884 Mon Sep 17 00:00:00 2001 From: psogv0308 Date: Thu, 8 Aug 2024 01:13:22 +0900 Subject: [PATCH] Remove unsafe --- core/types/withdrawal.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/types/withdrawal.go b/core/types/withdrawal.go index 0fea969e67..7671fd60df 100644 --- a/core/types/withdrawal.go +++ b/core/types/withdrawal.go @@ -18,7 +18,7 @@ package types import ( "bytes" - "unsafe" + "reflect" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -43,8 +43,10 @@ type withdrawalMarshaling struct { Amount hexutil.Uint64 } +var withdrawalSize = common.StorageSize(reflect.TypeOf(Withdrawal{}).Size()) + func (w Withdrawal) Size() common.StorageSize { - return common.StorageSize(unsafe.Sizeof(w)) + return common.StorageSize(withdrawalSize) } // Withdrawals implements DerivableList for withdrawals.