mirror of https://github.com/ethereum/go-ethereum
Co-authored-by: lightclient <lightclient@protonmail.com> Co-authored-by: Mario Vega <marioevz@gmail.com>
parent
d71831255d
commit
8578fb7669
@ -0,0 +1,131 @@ |
||||
package core |
||||
|
||||
import ( |
||||
"bytes" |
||||
"math/big" |
||||
"os" |
||||
"testing" |
||||
|
||||
"github.com/ethereum/go-ethereum/common" |
||||
"github.com/ethereum/go-ethereum/consensus/beacon" |
||||
"github.com/ethereum/go-ethereum/core/rawdb" |
||||
"github.com/ethereum/go-ethereum/core/types" |
||||
"github.com/ethereum/go-ethereum/core/vm" |
||||
"github.com/ethereum/go-ethereum/crypto" |
||||
"github.com/ethereum/go-ethereum/eth/tracers/logger" |
||||
"github.com/ethereum/go-ethereum/params" |
||||
"github.com/holiman/uint256" |
||||
) |
||||
|
||||
func TestEIP7702(t *testing.T) { |
||||
var ( |
||||
aa = common.HexToAddress("0x000000000000000000000000000000000000aaaa") |
||||
bb = common.HexToAddress("0x000000000000000000000000000000000000bbbb") |
||||
engine = beacon.NewFaker() |
||||
|
||||
// A sender who makes transactions, has some funds
|
||||
key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") |
||||
key2, _ = crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a") |
||||
addr1 = crypto.PubkeyToAddress(key1.PublicKey) |
||||
addr2 = crypto.PubkeyToAddress(key2.PublicKey) |
||||
funds = new(big.Int).Mul(common.Big1, big.NewInt(params.Ether)) |
||||
config = *params.AllEthashProtocolChanges |
||||
gspec = &Genesis{ |
||||
Config: &config, |
||||
Alloc: types.GenesisAlloc{ |
||||
addr1: {Balance: funds}, |
||||
addr2: {Balance: funds}, |
||||
// The address 0xAAAA sstores 1 into slot 2.
|
||||
aa: { |
||||
Code: []byte{ |
||||
byte(vm.PC), // [0]
|
||||
byte(vm.DUP1), // [0,0]
|
||||
byte(vm.DUP1), // [0,0,0]
|
||||
byte(vm.DUP1), // [0,0,0,0]
|
||||
byte(vm.PUSH1), 0x01, // [0,0,0,0,1] (value)
|
||||
byte(vm.PUSH20), addr2[0], addr2[1], addr2[2], addr2[3], addr2[4], addr2[5], addr2[6], addr2[7], addr2[8], addr2[9], addr2[10], addr2[11], addr2[12], addr2[13], addr2[14], addr2[15], addr2[16], addr2[17], addr2[18], addr2[19], |
||||
byte(vm.GAS), |
||||
byte(vm.CALL), |
||||
byte(vm.STOP), |
||||
}, |
||||
Nonce: 0, |
||||
Balance: big.NewInt(0), |
||||
}, |
||||
// The address 0xBBBB sstores 42 into slot 42.
|
||||
bb: { |
||||
Code: []byte{ |
||||
byte(vm.PUSH1), 0x42, |
||||
byte(vm.DUP1), |
||||
byte(vm.SSTORE), |
||||
byte(vm.STOP), |
||||
}, |
||||
Nonce: 0, |
||||
Balance: big.NewInt(0), |
||||
}, |
||||
}, |
||||
} |
||||
) |
||||
|
||||
gspec.Config.BerlinBlock = common.Big0 |
||||
gspec.Config.LondonBlock = common.Big0 |
||||
gspec.Config.TerminalTotalDifficulty = common.Big0 |
||||
gspec.Config.TerminalTotalDifficultyPassed = true |
||||
gspec.Config.ShanghaiTime = u64(0) |
||||
gspec.Config.CancunTime = u64(0) |
||||
gspec.Config.PragueTime = u64(0) |
||||
signer := types.LatestSigner(gspec.Config) |
||||
|
||||
auth1, _ := types.SignAuth(&types.Authorization{ |
||||
ChainID: new(big.Int).Set(gspec.Config.ChainID), |
||||
Address: aa, |
||||
Nonce: 1, |
||||
}, key1) |
||||
|
||||
auth2, _ := types.SignAuth(&types.Authorization{ |
||||
ChainID: new(big.Int), |
||||
Address: bb, |
||||
Nonce: 0, |
||||
}, key2) |
||||
|
||||
_, blocks, _ := GenerateChainWithGenesis(gspec, engine, 1, func(i int, b *BlockGen) { |
||||
b.SetCoinbase(aa) |
||||
txdata := &types.SetCodeTx{ |
||||
ChainID: uint256.MustFromBig(gspec.Config.ChainID), |
||||
Nonce: 0, |
||||
To: addr1, |
||||
Gas: 500000, |
||||
GasFeeCap: uint256.MustFromBig(newGwei(5)), |
||||
GasTipCap: uint256.NewInt(2), |
||||
AuthList: []*types.Authorization{auth1, auth2}, |
||||
} |
||||
tx := types.NewTx(txdata) |
||||
tx, err := types.SignTx(tx, signer, key1) |
||||
if err != nil { |
||||
t.Fatalf("%s", err) |
||||
} |
||||
b.AddTx(tx) |
||||
}) |
||||
chain, err := NewBlockChain(rawdb.NewMemoryDatabase(), nil, gspec, nil, engine, vm.Config{Tracer: logger.NewMarkdownLogger(&logger.Config{}, os.Stderr).Hooks()}, nil) |
||||
if err != nil { |
||||
t.Fatalf("failed to create tester chain: %v", err) |
||||
} |
||||
defer chain.Stop() |
||||
if n, err := chain.InsertChain(blocks); err != nil { |
||||
t.Fatalf("block %d: failed to insert into chain: %v", n, err) |
||||
} |
||||
|
||||
var ( |
||||
state, _ = chain.State() |
||||
fortyTwo = common.BytesToHash([]byte{0x42}) |
||||
actual = state.GetState(addr2, fortyTwo) |
||||
) |
||||
if code, want := state.GetCode(addr1), types.AddressToDelegation(auth1.Address); !bytes.Equal(code, want) { |
||||
t.Fatalf("addr1 code incorrect: got %s, want %s", common.Bytes2Hex(code), common.Bytes2Hex(want)) |
||||
} |
||||
if code, want := state.GetCode(addr2), types.AddressToDelegation(auth2.Address); !bytes.Equal(code, want) { |
||||
t.Fatalf("addr2 code incorrect: got %s, want %s", common.Bytes2Hex(code), common.Bytes2Hex(want)) |
||||
} |
||||
if actual.Cmp(fortyTwo) != 0 { |
||||
t.Fatalf("addr2 storage wrong: expected %d, got %d", fortyTwo, actual) |
||||
} |
||||
} |
@ -0,0 +1,75 @@ |
||||
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
||||
|
||||
package types |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
"errors" |
||||
"math/big" |
||||
|
||||
"github.com/ethereum/go-ethereum/common" |
||||
"github.com/ethereum/go-ethereum/common/hexutil" |
||||
) |
||||
|
||||
var _ = (*authorizationMarshaling)(nil) |
||||
|
||||
// MarshalJSON marshals as JSON.
|
||||
func (a Authorization) MarshalJSON() ([]byte, error) { |
||||
type Authorization struct { |
||||
ChainID *hexutil.Big `json:"chainId" gencodec:"required"` |
||||
Address common.Address `json:"address" gencodec:"required"` |
||||
Nonce hexutil.Uint64 `json:"nonce" gencodec:"required"` |
||||
V *hexutil.Big `json:"v" gencodec:"required"` |
||||
R *hexutil.Big `json:"r" gencodec:"required"` |
||||
S *hexutil.Big `json:"s" gencodec:"required"` |
||||
} |
||||
var enc Authorization |
||||
enc.ChainID = (*hexutil.Big)(a.ChainID) |
||||
enc.Address = a.Address |
||||
enc.Nonce = hexutil.Uint64(a.Nonce) |
||||
enc.V = (*hexutil.Big)(a.V) |
||||
enc.R = (*hexutil.Big)(a.R) |
||||
enc.S = (*hexutil.Big)(a.S) |
||||
return json.Marshal(&enc) |
||||
} |
||||
|
||||
// UnmarshalJSON unmarshals from JSON.
|
||||
func (a *Authorization) UnmarshalJSON(input []byte) error { |
||||
type Authorization struct { |
||||
ChainID *hexutil.Big `json:"chainId" gencodec:"required"` |
||||
Address *common.Address `json:"address" gencodec:"required"` |
||||
Nonce *hexutil.Uint64 `json:"nonce" gencodec:"required"` |
||||
V *hexutil.Big `json:"v" gencodec:"required"` |
||||
R *hexutil.Big `json:"r" gencodec:"required"` |
||||
S *hexutil.Big `json:"s" gencodec:"required"` |
||||
} |
||||
var dec Authorization |
||||
if err := json.Unmarshal(input, &dec); err != nil { |
||||
return err |
||||
} |
||||
if dec.ChainID == nil { |
||||
return errors.New("missing required field 'chainId' for Authorization") |
||||
} |
||||
a.ChainID = (*big.Int)(dec.ChainID) |
||||
if dec.Address == nil { |
||||
return errors.New("missing required field 'address' for Authorization") |
||||
} |
||||
a.Address = *dec.Address |
||||
if dec.Nonce == nil { |
||||
return errors.New("missing required field 'nonce' for Authorization") |
||||
} |
||||
a.Nonce = uint64(*dec.Nonce) |
||||
if dec.V == nil { |
||||
return errors.New("missing required field 'v' for Authorization") |
||||
} |
||||
a.V = (*big.Int)(dec.V) |
||||
if dec.R == nil { |
||||
return errors.New("missing required field 'r' for Authorization") |
||||
} |
||||
a.R = (*big.Int)(dec.R) |
||||
if dec.S == nil { |
||||
return errors.New("missing required field 's' for Authorization") |
||||
} |
||||
a.S = (*big.Int)(dec.S) |
||||
return nil |
||||
} |
@ -0,0 +1,256 @@ |
||||
package types |
||||
|
||||
import ( |
||||
"bytes" |
||||
"crypto/ecdsa" |
||||
"errors" |
||||
"math/big" |
||||
|
||||
"github.com/ethereum/go-ethereum/common" |
||||
"github.com/ethereum/go-ethereum/common/hexutil" |
||||
"github.com/ethereum/go-ethereum/crypto" |
||||
"github.com/ethereum/go-ethereum/rlp" |
||||
"github.com/holiman/uint256" |
||||
) |
||||
|
||||
// DelegationPrefix is used by code to denote the account is delegating to
|
||||
// another account.
|
||||
var DelegationPrefix = []byte{0xef, 0x01, 0x00} |
||||
|
||||
// ParseDelegation tries to parse the address from a delegation slice.
|
||||
func ParseDelegation(b []byte) (common.Address, bool) { |
||||
if len(b) != 23 || !bytes.HasPrefix(b, DelegationPrefix) { |
||||
return common.Address{}, false |
||||
} |
||||
var addr common.Address |
||||
copy(addr[:], b[len(DelegationPrefix):]) |
||||
return addr, true |
||||
} |
||||
|
||||
// AddressToDelegation adds the delegation prefix to the specified address.
|
||||
func AddressToDelegation(addr common.Address) []byte { |
||||
return append(DelegationPrefix, addr.Bytes()...) |
||||
} |
||||
|
||||
// SetCodeTx implements the EIP-7702 transaction type which temporarily installs
|
||||
// the code at the signer's address.
|
||||
type SetCodeTx struct { |
||||
ChainID *uint256.Int |
||||
Nonce uint64 |
||||
GasTipCap *uint256.Int // a.k.a. maxPriorityFeePerGas
|
||||
GasFeeCap *uint256.Int // a.k.a. maxFeePerGas
|
||||
Gas uint64 |
||||
To common.Address |
||||
Value *uint256.Int |
||||
Data []byte |
||||
AccessList AccessList |
||||
AuthList AuthorizationList |
||||
|
||||
// Signature values
|
||||
V *uint256.Int `json:"v" gencodec:"required"` |
||||
R *uint256.Int `json:"r" gencodec:"required"` |
||||
S *uint256.Int `json:"s" gencodec:"required"` |
||||
} |
||||
|
||||
//go:generate go run github.com/fjl/gencodec -type Authorization -field-override authorizationMarshaling -out gen_authorization.go
|
||||
|
||||
// Authorization is an authorization from an account to deploy code at it's
|
||||
// address.
|
||||
type Authorization struct { |
||||
ChainID *big.Int `json:"chainId" gencodec:"required"` |
||||
Address common.Address `json:"address" gencodec:"required"` |
||||
Nonce uint64 `json:"nonce" gencodec:"required"` |
||||
V *big.Int `json:"v" gencodec:"required"` |
||||
R *big.Int `json:"r" gencodec:"required"` |
||||
S *big.Int `json:"s" gencodec:"required"` |
||||
} |
||||
|
||||
// field type overrides for gencodec
|
||||
type authorizationMarshaling struct { |
||||
ChainID *hexutil.Big |
||||
Nonce hexutil.Uint64 |
||||
V *hexutil.Big |
||||
R *hexutil.Big |
||||
S *hexutil.Big |
||||
} |
||||
|
||||
func SignAuth(auth *Authorization, prv *ecdsa.PrivateKey) (*Authorization, error) { |
||||
h := prefixedRlpHash( |
||||
0x05, |
||||
[]interface{}{ |
||||
auth.ChainID, |
||||
auth.Address, |
||||
auth.Nonce, |
||||
}) |
||||
|
||||
sig, err := crypto.Sign(h[:], prv) |
||||
if err != nil { |
||||
return nil, err |
||||
} |
||||
return auth.WithSignature(sig), nil |
||||
} |
||||
|
||||
func (a *Authorization) WithSignature(sig []byte) *Authorization { |
||||
r, s, _ := decodeSignature(sig) |
||||
v := big.NewInt(int64(sig[64])) |
||||
cpy := Authorization{ |
||||
ChainID: a.ChainID, |
||||
Address: a.Address, |
||||
Nonce: a.Nonce, |
||||
V: v, |
||||
R: r, |
||||
S: s, |
||||
} |
||||
return &cpy |
||||
} |
||||
|
||||
type AuthorizationList []*Authorization |
||||
|
||||
func (a Authorization) Authority() (common.Address, error) { |
||||
sighash := prefixedRlpHash( |
||||
0x05, |
||||
[]interface{}{ |
||||
a.ChainID, |
||||
a.Address, |
||||
a.Nonce, |
||||
}) |
||||
|
||||
v := byte(a.V.Uint64()) |
||||
if !crypto.ValidateSignatureValues(v, a.R, a.S, true) { |
||||
return common.Address{}, ErrInvalidSig |
||||
} |
||||
// encode the signature in uncompressed format
|
||||
r, s := a.R.Bytes(), a.S.Bytes() |
||||
sig := make([]byte, crypto.SignatureLength) |
||||
copy(sig[32-len(r):32], r) |
||||
copy(sig[64-len(s):64], s) |
||||
sig[64] = v |
||||
// recover the public key from the signature
|
||||
pub, err := crypto.Ecrecover(sighash[:], sig) |
||||
if err != nil { |
||||
return common.Address{}, err |
||||
} |
||||
if len(pub) == 0 || pub[0] != 4 { |
||||
return common.Address{}, errors.New("invalid public key") |
||||
} |
||||
var addr common.Address |
||||
copy(addr[:], crypto.Keccak256(pub[1:])[12:]) |
||||
return addr, nil |
||||
} |
||||
|
||||
type SetCodeDelegation struct { |
||||
From common.Address |
||||
Nonce uint64 |
||||
Target common.Address |
||||
} |
||||
|
||||
/* |
||||
func (a AuthorizationList) WithAddress() []AuthorizationTuple { |
||||
var ( |
||||
list = make([]AuthorizationTuple, len(a)) |
||||
sha = hasherPool.Get().(crypto.KeccakState) |
||||
h = common.Hash{} |
||||
) |
||||
defer hasherPool.Put(sha) |
||||
for i, auth := range a { |
||||
sha.Reset() |
||||
sha.Write([]byte{0x05}) |
||||
sha.Write(auth.Code) |
||||
sha.Read(h[:]) |
||||
addr, err := recoverPlain(h, auth.R, auth.S, auth.V, false) |
||||
if err != nil { |
||||
continue |
||||
} |
||||
list[i].Address = addr |
||||
copy(list[i].Code, auth.Code) |
||||
} |
||||
return list |
||||
} |
||||
*/ |
||||
|
||||
// copy creates a deep copy of the transaction data and initializes all fields.
|
||||
func (tx *SetCodeTx) copy() TxData { |
||||
cpy := &SetCodeTx{ |
||||
Nonce: tx.Nonce, |
||||
To: tx.To, |
||||
Data: common.CopyBytes(tx.Data), |
||||
Gas: tx.Gas, |
||||
// These are copied below.
|
||||
AccessList: make(AccessList, len(tx.AccessList)), |
||||
AuthList: make(AuthorizationList, len(tx.AuthList)), |
||||
Value: new(uint256.Int), |
||||
ChainID: new(uint256.Int), |
||||
GasTipCap: new(uint256.Int), |
||||
GasFeeCap: new(uint256.Int), |
||||
V: new(uint256.Int), |
||||
R: new(uint256.Int), |
||||
S: new(uint256.Int), |
||||
} |
||||
copy(cpy.AccessList, tx.AccessList) |
||||
copy(cpy.AuthList, tx.AuthList) |
||||
if tx.Value != nil { |
||||
cpy.Value.Set(tx.Value) |
||||
} |
||||
if tx.ChainID != nil { |
||||
cpy.ChainID.Set(tx.ChainID) |
||||
} |
||||
if tx.GasTipCap != nil { |
||||
cpy.GasTipCap.Set(tx.GasTipCap) |
||||
} |
||||
if tx.GasFeeCap != nil { |
||||
cpy.GasFeeCap.Set(tx.GasFeeCap) |
||||
} |
||||
if tx.V != nil { |
||||
cpy.V.Set(tx.V) |
||||
} |
||||
if tx.R != nil { |
||||
cpy.R.Set(tx.R) |
||||
} |
||||
if tx.S != nil { |
||||
cpy.S.Set(tx.S) |
||||
} |
||||
return cpy |
||||
} |
||||
|
||||
// accessors for innerTx.
|
||||
func (tx *SetCodeTx) txType() byte { return SetCodeTxType } |
||||
func (tx *SetCodeTx) chainID() *big.Int { return tx.ChainID.ToBig() } |
||||
func (tx *SetCodeTx) accessList() AccessList { return tx.AccessList } |
||||
func (tx *SetCodeTx) data() []byte { return tx.Data } |
||||
func (tx *SetCodeTx) gas() uint64 { return tx.Gas } |
||||
func (tx *SetCodeTx) gasFeeCap() *big.Int { return tx.GasFeeCap.ToBig() } |
||||
func (tx *SetCodeTx) gasTipCap() *big.Int { return tx.GasTipCap.ToBig() } |
||||
func (tx *SetCodeTx) gasPrice() *big.Int { return tx.GasFeeCap.ToBig() } |
||||
func (tx *SetCodeTx) value() *big.Int { return tx.Value.ToBig() } |
||||
func (tx *SetCodeTx) nonce() uint64 { return tx.Nonce } |
||||
func (tx *SetCodeTx) to() *common.Address { tmp := tx.To; return &tmp } |
||||
|
||||
func (tx *SetCodeTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int { |
||||
if baseFee == nil { |
||||
return dst.Set(tx.GasFeeCap.ToBig()) |
||||
} |
||||
tip := dst.Sub(tx.GasFeeCap.ToBig(), baseFee) |
||||
if tip.Cmp(tx.GasTipCap.ToBig()) > 0 { |
||||
tip.Set(tx.GasTipCap.ToBig()) |
||||
} |
||||
return tip.Add(tip, baseFee) |
||||
} |
||||
|
||||
func (tx *SetCodeTx) rawSignatureValues() (v, r, s *big.Int) { |
||||
return tx.V.ToBig(), tx.R.ToBig(), tx.S.ToBig() |
||||
} |
||||
|
||||
func (tx *SetCodeTx) setSignatureValues(chainID, v, r, s *big.Int) { |
||||
tx.ChainID.SetFromBig(chainID) |
||||
tx.V.SetFromBig(v) |
||||
tx.R.SetFromBig(r) |
||||
tx.S.SetFromBig(s) |
||||
} |
||||
|
||||
func (tx *SetCodeTx) encode(b *bytes.Buffer) error { |
||||
return rlp.Encode(b, tx) |
||||
} |
||||
|
||||
func (tx *SetCodeTx) decode(input []byte) error { |
||||
return rlp.DecodeBytes(input, tx) |
||||
} |
@ -0,0 +1,15 @@ |
||||
package types |
||||
|
||||
import ( |
||||
"testing" |
||||
|
||||
"github.com/ethereum/go-ethereum/common" |
||||
) |
||||
|
||||
func TestParseDelegation(t *testing.T) { |
||||
addr := common.Address{0x42} |
||||
d := append(DelegationPrefix, addr.Bytes()...) |
||||
if got, ok := ParseDelegation(d); !ok || addr != got { |
||||
t.Fatalf("failed to parse, got %s %v", got.Hex(), ok) |
||||
} |
||||
} |
@ -0,0 +1,74 @@ |
||||
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
||||
|
||||
package tests |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
"errors" |
||||
"math/big" |
||||
|
||||
"github.com/ethereum/go-ethereum/common" |
||||
"github.com/ethereum/go-ethereum/common/math" |
||||
) |
||||
|
||||
var _ = (*stAuthorizationMarshaling)(nil) |
||||
|
||||
// MarshalJSON marshals as JSON.
|
||||
func (s stAuthorization) MarshalJSON() ([]byte, error) { |
||||
type stAuthorization struct { |
||||
ChainID *math.HexOrDecimal256 |
||||
Address common.Address `json:"address" gencodec:"required"` |
||||
Nonce math.HexOrDecimal64 `json:"nonce" gencodec:"required"` |
||||
V *math.HexOrDecimal256 `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.HexOrDecimal256)(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 |
||||
Address *common.Address `json:"address" gencodec:"required"` |
||||
Nonce *math.HexOrDecimal64 `json:"nonce" gencodec:"required"` |
||||
V *math.HexOrDecimal256 `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 { |
||||
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 = (*big.Int)(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 |
||||
} |
Loading…
Reference in new issue