mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Revert "tests: use 'sender' in state tests if present (#28023)"
This reverts commit bf493562d0.
This commit is contained in:
parent
0524514eb0
commit
d9b1eb1cc1
2 changed files with 2 additions and 12 deletions
|
|
@ -27,7 +27,6 @@ func (s stTransaction) MarshalJSON() ([]byte, error) {
|
||||||
GasLimit []math.HexOrDecimal64 `json:"gasLimit"`
|
GasLimit []math.HexOrDecimal64 `json:"gasLimit"`
|
||||||
Value []string `json:"value"`
|
Value []string `json:"value"`
|
||||||
PrivateKey hexutil.Bytes `json:"secretKey"`
|
PrivateKey hexutil.Bytes `json:"secretKey"`
|
||||||
Sender *common.Address `json:"sender"`
|
|
||||||
BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"`
|
BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"`
|
||||||
BlobGasFeeCap *math.HexOrDecimal256 `json:"maxFeePerBlobGas,omitempty"`
|
BlobGasFeeCap *math.HexOrDecimal256 `json:"maxFeePerBlobGas,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
@ -47,7 +46,6 @@ func (s stTransaction) MarshalJSON() ([]byte, error) {
|
||||||
}
|
}
|
||||||
enc.Value = s.Value
|
enc.Value = s.Value
|
||||||
enc.PrivateKey = s.PrivateKey
|
enc.PrivateKey = s.PrivateKey
|
||||||
enc.Sender = s.Sender
|
|
||||||
enc.BlobVersionedHashes = s.BlobVersionedHashes
|
enc.BlobVersionedHashes = s.BlobVersionedHashes
|
||||||
enc.BlobGasFeeCap = (*math.HexOrDecimal256)(s.BlobGasFeeCap)
|
enc.BlobGasFeeCap = (*math.HexOrDecimal256)(s.BlobGasFeeCap)
|
||||||
return json.Marshal(&enc)
|
return json.Marshal(&enc)
|
||||||
|
|
@ -66,7 +64,6 @@ func (s *stTransaction) UnmarshalJSON(input []byte) error {
|
||||||
GasLimit []math.HexOrDecimal64 `json:"gasLimit"`
|
GasLimit []math.HexOrDecimal64 `json:"gasLimit"`
|
||||||
Value []string `json:"value"`
|
Value []string `json:"value"`
|
||||||
PrivateKey *hexutil.Bytes `json:"secretKey"`
|
PrivateKey *hexutil.Bytes `json:"secretKey"`
|
||||||
Sender *common.Address `json:"sender"`
|
|
||||||
BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"`
|
BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"`
|
||||||
BlobGasFeeCap *math.HexOrDecimal256 `json:"maxFeePerBlobGas,omitempty"`
|
BlobGasFeeCap *math.HexOrDecimal256 `json:"maxFeePerBlobGas,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
@ -107,9 +104,6 @@ func (s *stTransaction) UnmarshalJSON(input []byte) error {
|
||||||
if dec.PrivateKey != nil {
|
if dec.PrivateKey != nil {
|
||||||
s.PrivateKey = *dec.PrivateKey
|
s.PrivateKey = *dec.PrivateKey
|
||||||
}
|
}
|
||||||
if dec.Sender != nil {
|
|
||||||
s.Sender = dec.Sender
|
|
||||||
}
|
|
||||||
if dec.BlobVersionedHashes != nil {
|
if dec.BlobVersionedHashes != nil {
|
||||||
s.BlobVersionedHashes = dec.BlobVersionedHashes
|
s.BlobVersionedHashes = dec.BlobVersionedHashes
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,6 @@ type stTransaction struct {
|
||||||
GasLimit []uint64 `json:"gasLimit"`
|
GasLimit []uint64 `json:"gasLimit"`
|
||||||
Value []string `json:"value"`
|
Value []string `json:"value"`
|
||||||
PrivateKey []byte `json:"secretKey"`
|
PrivateKey []byte `json:"secretKey"`
|
||||||
Sender *common.Address `json:"sender"`
|
|
||||||
BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"`
|
BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"`
|
||||||
BlobGasFeeCap *big.Int `json:"maxFeePerBlobGas,omitempty"`
|
BlobGasFeeCap *big.Int `json:"maxFeePerBlobGas,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
@ -360,12 +359,9 @@ func (t *StateTest) genesis(config *params.ChainConfig) *core.Genesis {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tx *stTransaction) toMessage(ps stPostState, baseFee *big.Int) (*core.Message, error) {
|
func (tx *stTransaction) toMessage(ps stPostState, baseFee *big.Int) (*core.Message, error) {
|
||||||
|
// Derive sender from private key if present.
|
||||||
var from common.Address
|
var from common.Address
|
||||||
// If 'sender' field is present, use that
|
if len(tx.PrivateKey) > 0 {
|
||||||
if tx.Sender != nil {
|
|
||||||
from = *tx.Sender
|
|
||||||
} else if len(tx.PrivateKey) > 0 {
|
|
||||||
// Derive sender from private key if needed.
|
|
||||||
key, err := crypto.ToECDSA(tx.PrivateKey)
|
key, err := crypto.ToECDSA(tx.PrivateKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("invalid private key: %v", err)
|
return nil, fmt.Errorf("invalid private key: %v", err)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue