From f5d6ea1805aa5a8ecf1227caeefbd384bec6de64 Mon Sep 17 00:00:00 2001 From: alan <652732310@qq.com> Date: Mon, 17 Feb 2025 10:43:07 +0800 Subject: [PATCH] add cache for authority --- core/types/tx_setcode.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/types/tx_setcode.go b/core/types/tx_setcode.go index f2281d4ae7..12f80dca52 100644 --- a/core/types/tx_setcode.go +++ b/core/types/tx_setcode.go @@ -70,12 +70,13 @@ type SetCodeTx struct { // SetCodeAuthorization is an authorization from an account to deploy code at its address. type SetCodeAuthorization struct { - ChainID uint256.Int `json:"chainId" gencodec:"required"` - Address common.Address `json:"address" gencodec:"required"` - Nonce uint64 `json:"nonce" gencodec:"required"` - V uint8 `json:"yParity" gencodec:"required"` - R uint256.Int `json:"r" gencodec:"required"` - S uint256.Int `json:"s" gencodec:"required"` + ChainID uint256.Int `json:"chainId" gencodec:"required"` + Address common.Address `json:"address" gencodec:"required"` + Nonce uint64 `json:"nonce" gencodec:"required"` + V uint8 `json:"yParity" gencodec:"required"` + R uint256.Int `json:"r" gencodec:"required"` + S uint256.Int `json:"s" gencodec:"required"` + authority common.Address `json:"-"` } // field type overrides for gencodec @@ -135,6 +136,7 @@ func (a *SetCodeAuthorization) Authority() (common.Address, error) { } var addr common.Address copy(addr[:], crypto.Keccak256(pub[1:])[12:]) + a.authority = addr return addr, nil }