mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-29 08:03:48 +00:00
* feat: add EIP-7702 * fix goimport * add unit tests * add api test * sync txpool update * update generated code * make code readable * fix goimport * fix TestAsyncChecker unit test * add AuthorizationList in fuzz tests for completeness sake * add EuclidV2 test, EIP-7702 transaction in TestT8n * clean up logs * bump version * fix TestAsyncChecker * Revert "fix TestAsyncChecker" This reverts commit 314478303d4a504a3948bd6595568916ba7d82f0. * accept eip-7702 txns only after enabling eip-7702 * revert IntrinsicGas param name from setCodeAuthorizations to authList * fix a bug * align upstream implementation in Encoding Receipts * fix one test case * fix tracer * return precode copy * support setcode tx in EstimateGas and add unit tests * add TestValidateAuthorizations * poseidon hash fix * migrate a fix before the fix pr is merged * support setcode type transactions in TransactionData * chore: auto version bump [bot] * add a nonce-gapped-auth-does-not-block-pending-tx unit test * make the auth invalid * Apply suggestions from code review * change usedAndLeftSlots and knownConflicts to util functions * add comments about different return of applyAuthorization * remove gencodec:required in transaction signatures * fix goimport * update StructLogger and AccessListTracer * fix a bug * fix flaky test --------- Co-authored-by: colinlyguo <colinlyguo@users.noreply.github.com> Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
75 lines
2.4 KiB
Go
75 lines
2.4 KiB
Go
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
|
|
|
package tests
|
|
|
|
import (
|
|
"encoding/json"
|
|
"errors"
|
|
"math/big"
|
|
|
|
"github.com/scroll-tech/go-ethereum/common"
|
|
"github.com/scroll-tech/go-ethereum/common/math"
|
|
)
|
|
|
|
var _ = (*stAuthorizationMarshaling)(nil)
|
|
|
|
// MarshalJSON marshals as JSON.
|
|
func (s stAuthorization) MarshalJSON() ([]byte, error) {
|
|
type stAuthorization struct {
|
|
ChainID *math.HexOrDecimal256 `json:"chainId" gencodec:"required"`
|
|
Address common.Address `json:"address" gencodec:"required"`
|
|
Nonce math.HexOrDecimal64 `json:"nonce" gencodec:"required"`
|
|
V math.HexOrDecimal64 `json:"v" gencodec:"required"`
|
|
R *math.HexOrDecimal256 `json:"r" gencodec:"required"`
|
|
S *math.HexOrDecimal256 `json:"s" gencodec:"required"`
|
|
}
|
|
var enc stAuthorization
|
|
enc.ChainID = (*math.HexOrDecimal256)(s.ChainID)
|
|
enc.Address = s.Address
|
|
enc.Nonce = math.HexOrDecimal64(s.Nonce)
|
|
enc.V = math.HexOrDecimal64(s.V)
|
|
enc.R = (*math.HexOrDecimal256)(s.R)
|
|
enc.S = (*math.HexOrDecimal256)(s.S)
|
|
return json.Marshal(&enc)
|
|
}
|
|
|
|
// UnmarshalJSON unmarshals from JSON.
|
|
func (s *stAuthorization) UnmarshalJSON(input []byte) error {
|
|
type stAuthorization struct {
|
|
ChainID *math.HexOrDecimal256 `json:"chainId" gencodec:"required"`
|
|
Address *common.Address `json:"address" gencodec:"required"`
|
|
Nonce *math.HexOrDecimal64 `json:"nonce" gencodec:"required"`
|
|
V *math.HexOrDecimal64 `json:"v" gencodec:"required"`
|
|
R *math.HexOrDecimal256 `json:"r" gencodec:"required"`
|
|
S *math.HexOrDecimal256 `json:"s" gencodec:"required"`
|
|
}
|
|
var dec stAuthorization
|
|
if err := json.Unmarshal(input, &dec); err != nil {
|
|
return err
|
|
}
|
|
if dec.ChainID == nil {
|
|
return errors.New("missing required field 'chainId' for stAuthorization")
|
|
}
|
|
s.ChainID = (*big.Int)(dec.ChainID)
|
|
if dec.Address == nil {
|
|
return errors.New("missing required field 'address' for stAuthorization")
|
|
}
|
|
s.Address = *dec.Address
|
|
if dec.Nonce == nil {
|
|
return errors.New("missing required field 'nonce' for stAuthorization")
|
|
}
|
|
s.Nonce = uint64(*dec.Nonce)
|
|
if dec.V == nil {
|
|
return errors.New("missing required field 'v' for stAuthorization")
|
|
}
|
|
s.V = uint8(*dec.V)
|
|
if dec.R == nil {
|
|
return errors.New("missing required field 'r' for stAuthorization")
|
|
}
|
|
s.R = (*big.Int)(dec.R)
|
|
if dec.S == nil {
|
|
return errors.New("missing required field 's' for stAuthorization")
|
|
}
|
|
s.S = (*big.Int)(dec.S)
|
|
return nil
|
|
}
|