mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-29 16:13:47 +00:00
Merge branch 'ethereum:master' into portal
This commit is contained in:
commit
f8fef7a07f
56 changed files with 624 additions and 217 deletions
|
|
@ -279,7 +279,7 @@ func (w *ledgerDriver) ledgerDerive(derivationPath []uint32) (common.Address, er
|
|||
}
|
||||
hexstr := reply[1 : 1+int(reply[0])]
|
||||
|
||||
// Decode the hex sting into an Ethereum address and return
|
||||
// Decode the hex string into an Ethereum address and return
|
||||
var address common.Address
|
||||
if _, err = hex.Decode(address[:], hexstr); err != nil {
|
||||
return common.Address{}, err
|
||||
|
|
|
|||
|
|
@ -25,7 +25,9 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
@ -37,6 +39,7 @@ var (
|
|||
reverseMode = flag.Bool("reverse", false, "convert ASCII to rlp")
|
||||
noASCII = flag.Bool("noascii", false, "don't print ASCII strings readably")
|
||||
single = flag.Bool("single", false, "print only the first element, discard the rest")
|
||||
showpos = flag.Bool("pos", false, "display element byte posititions")
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
@ -52,17 +55,17 @@ If the filename is omitted, data is read from stdin.`)
|
|||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
var r io.Reader
|
||||
var r *inStream
|
||||
switch {
|
||||
case *hexMode != "":
|
||||
data, err := hex.DecodeString(strings.TrimPrefix(*hexMode, "0x"))
|
||||
if err != nil {
|
||||
die(err)
|
||||
}
|
||||
r = bytes.NewReader(data)
|
||||
r = newInStream(bytes.NewReader(data), int64(len(data)))
|
||||
|
||||
case flag.NArg() == 0:
|
||||
r = os.Stdin
|
||||
r = newInStream(bufio.NewReader(os.Stdin), 0)
|
||||
|
||||
case flag.NArg() == 1:
|
||||
fd, err := os.Open(flag.Arg(0))
|
||||
|
|
@ -70,13 +73,19 @@ func main() {
|
|||
die(err)
|
||||
}
|
||||
defer fd.Close()
|
||||
r = fd
|
||||
var size int64
|
||||
finfo, err := fd.Stat()
|
||||
if err == nil {
|
||||
size = finfo.Size()
|
||||
}
|
||||
r = newInStream(bufio.NewReader(fd), size)
|
||||
|
||||
default:
|
||||
fmt.Fprintln(os.Stderr, "Error: too many arguments")
|
||||
flag.Usage()
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
out := os.Stdout
|
||||
if *reverseMode {
|
||||
data, err := textToRlp(r)
|
||||
|
|
@ -93,10 +102,10 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
func rlpToText(r io.Reader, out io.Writer) error {
|
||||
s := rlp.NewStream(r, 0)
|
||||
func rlpToText(in *inStream, out io.Writer) error {
|
||||
stream := rlp.NewStream(in, 0)
|
||||
for {
|
||||
if err := dump(s, 0, out); err != nil {
|
||||
if err := dump(in, stream, 0, out); err != nil {
|
||||
if err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
|
@ -110,7 +119,10 @@ func rlpToText(r io.Reader, out io.Writer) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func dump(s *rlp.Stream, depth int, out io.Writer) error {
|
||||
func dump(in *inStream, s *rlp.Stream, depth int, out io.Writer) error {
|
||||
if *showpos {
|
||||
fmt.Fprintf(out, "%s: ", in.posLabel())
|
||||
}
|
||||
kind, size, err := s.Kind()
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -137,7 +149,7 @@ func dump(s *rlp.Stream, depth int, out io.Writer) error {
|
|||
if i > 0 {
|
||||
fmt.Fprint(out, ",\n")
|
||||
}
|
||||
if err := dump(s, depth+1, out); err == rlp.EOL {
|
||||
if err := dump(in, s, depth+1, out); err == rlp.EOL {
|
||||
break
|
||||
} else if err != nil {
|
||||
return err
|
||||
|
|
@ -208,3 +220,36 @@ func textToRlp(r io.Reader) ([]byte, error) {
|
|||
data, err := rlp.EncodeToBytes(obj[0])
|
||||
return data, err
|
||||
}
|
||||
|
||||
type inStream struct {
|
||||
br rlp.ByteReader
|
||||
pos int
|
||||
columns int
|
||||
}
|
||||
|
||||
func newInStream(br rlp.ByteReader, totalSize int64) *inStream {
|
||||
col := int(math.Ceil(math.Log10(float64(totalSize))))
|
||||
return &inStream{br: br, columns: col}
|
||||
}
|
||||
|
||||
func (rc *inStream) Read(b []byte) (n int, err error) {
|
||||
n, err = rc.br.Read(b)
|
||||
rc.pos += n
|
||||
return n, err
|
||||
}
|
||||
|
||||
func (rc *inStream) ReadByte() (byte, error) {
|
||||
b, err := rc.br.ReadByte()
|
||||
if err == nil {
|
||||
rc.pos++
|
||||
}
|
||||
return b, err
|
||||
}
|
||||
|
||||
func (rc *inStream) posLabel() string {
|
||||
l := strconv.FormatInt(int64(rc.pos), 10)
|
||||
if len(l) < rc.columns {
|
||||
l = strings.Repeat(" ", rc.columns-len(l)) + l
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ func TestRoundtrip(t *testing.T) {
|
|||
"0xc780c0c1c0825208",
|
||||
} {
|
||||
var out strings.Builder
|
||||
err := rlpToText(bytes.NewReader(common.FromHex(want)), &out)
|
||||
in := newInStream(bytes.NewReader(common.FromHex(want)), 0)
|
||||
err := rlpToText(in, &out)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,4 +104,10 @@ var (
|
|||
// ErrBlobFeeCapTooLow is returned if the transaction fee cap is less than the
|
||||
// blob gas fee of the block.
|
||||
ErrBlobFeeCapTooLow = errors.New("max fee per blob gas less than block blob gas fee")
|
||||
|
||||
// ErrMissingBlobHashes is returned if a blob transaction has no blob hashes.
|
||||
ErrMissingBlobHashes = errors.New("blob transaction missing blob hashes")
|
||||
|
||||
// ErrBlobTxCreate is returned if a blob transaction has no explicit to field.
|
||||
ErrBlobTxCreate = errors.New("blob transaction of type create")
|
||||
)
|
||||
|
|
|
|||
|
|
@ -48,11 +48,11 @@ func TestDump(t *testing.T) {
|
|||
s := &stateEnv{db: db, state: sdb}
|
||||
|
||||
// generate a few entries
|
||||
obj1 := s.state.GetOrNewStateObject(common.BytesToAddress([]byte{0x01}))
|
||||
obj1 := s.state.getOrNewStateObject(common.BytesToAddress([]byte{0x01}))
|
||||
obj1.AddBalance(big.NewInt(22))
|
||||
obj2 := s.state.GetOrNewStateObject(common.BytesToAddress([]byte{0x01, 0x02}))
|
||||
obj2 := s.state.getOrNewStateObject(common.BytesToAddress([]byte{0x01, 0x02}))
|
||||
obj2.SetCode(crypto.Keccak256Hash([]byte{3, 3, 3, 3, 3, 3, 3}), []byte{3, 3, 3, 3, 3, 3, 3})
|
||||
obj3 := s.state.GetOrNewStateObject(common.BytesToAddress([]byte{0x02}))
|
||||
obj3 := s.state.getOrNewStateObject(common.BytesToAddress([]byte{0x02}))
|
||||
obj3.SetBalance(big.NewInt(44))
|
||||
|
||||
// write some of them to the trie
|
||||
|
|
@ -105,13 +105,13 @@ func TestIterativeDump(t *testing.T) {
|
|||
s := &stateEnv{db: db, state: sdb}
|
||||
|
||||
// generate a few entries
|
||||
obj1 := s.state.GetOrNewStateObject(common.BytesToAddress([]byte{0x01}))
|
||||
obj1 := s.state.getOrNewStateObject(common.BytesToAddress([]byte{0x01}))
|
||||
obj1.AddBalance(big.NewInt(22))
|
||||
obj2 := s.state.GetOrNewStateObject(common.BytesToAddress([]byte{0x01, 0x02}))
|
||||
obj2 := s.state.getOrNewStateObject(common.BytesToAddress([]byte{0x01, 0x02}))
|
||||
obj2.SetCode(crypto.Keccak256Hash([]byte{3, 3, 3, 3, 3, 3, 3}), []byte{3, 3, 3, 3, 3, 3, 3})
|
||||
obj3 := s.state.GetOrNewStateObject(common.BytesToAddress([]byte{0x02}))
|
||||
obj3 := s.state.getOrNewStateObject(common.BytesToAddress([]byte{0x02}))
|
||||
obj3.SetBalance(big.NewInt(44))
|
||||
obj4 := s.state.GetOrNewStateObject(common.BytesToAddress([]byte{0x00}))
|
||||
obj4 := s.state.getOrNewStateObject(common.BytesToAddress([]byte{0x00}))
|
||||
obj4.AddBalance(big.NewInt(1337))
|
||||
|
||||
// write some of them to the trie
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ func (s *StateDB) HasSelfDestructed(addr common.Address) bool {
|
|||
|
||||
// AddBalance adds amount to the account associated with addr.
|
||||
func (s *StateDB) AddBalance(addr common.Address, amount *big.Int) {
|
||||
stateObject := s.GetOrNewStateObject(addr)
|
||||
stateObject := s.getOrNewStateObject(addr)
|
||||
if stateObject != nil {
|
||||
stateObject.AddBalance(amount)
|
||||
}
|
||||
|
|
@ -382,35 +382,35 @@ func (s *StateDB) AddBalance(addr common.Address, amount *big.Int) {
|
|||
|
||||
// SubBalance subtracts amount from the account associated with addr.
|
||||
func (s *StateDB) SubBalance(addr common.Address, amount *big.Int) {
|
||||
stateObject := s.GetOrNewStateObject(addr)
|
||||
stateObject := s.getOrNewStateObject(addr)
|
||||
if stateObject != nil {
|
||||
stateObject.SubBalance(amount)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *StateDB) SetBalance(addr common.Address, amount *big.Int) {
|
||||
stateObject := s.GetOrNewStateObject(addr)
|
||||
stateObject := s.getOrNewStateObject(addr)
|
||||
if stateObject != nil {
|
||||
stateObject.SetBalance(amount)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *StateDB) SetNonce(addr common.Address, nonce uint64) {
|
||||
stateObject := s.GetOrNewStateObject(addr)
|
||||
stateObject := s.getOrNewStateObject(addr)
|
||||
if stateObject != nil {
|
||||
stateObject.SetNonce(nonce)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *StateDB) SetCode(addr common.Address, code []byte) {
|
||||
stateObject := s.GetOrNewStateObject(addr)
|
||||
stateObject := s.getOrNewStateObject(addr)
|
||||
if stateObject != nil {
|
||||
stateObject.SetCode(crypto.Keccak256Hash(code), code)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *StateDB) SetState(addr common.Address, key, value common.Hash) {
|
||||
stateObject := s.GetOrNewStateObject(addr)
|
||||
stateObject := s.getOrNewStateObject(addr)
|
||||
if stateObject != nil {
|
||||
stateObject.SetState(key, value)
|
||||
}
|
||||
|
|
@ -431,7 +431,7 @@ func (s *StateDB) SetStorage(addr common.Address, storage map[common.Hash]common
|
|||
if _, ok := s.stateObjectsDestruct[addr]; !ok {
|
||||
s.stateObjectsDestruct[addr] = nil
|
||||
}
|
||||
stateObject := s.GetOrNewStateObject(addr)
|
||||
stateObject := s.getOrNewStateObject(addr)
|
||||
for k, v := range storage {
|
||||
stateObject.SetState(k, v)
|
||||
}
|
||||
|
|
@ -614,8 +614,8 @@ func (s *StateDB) setStateObject(object *stateObject) {
|
|||
s.stateObjects[object.Address()] = object
|
||||
}
|
||||
|
||||
// GetOrNewStateObject retrieves a state object or create a new state object if nil.
|
||||
func (s *StateDB) GetOrNewStateObject(addr common.Address) *stateObject {
|
||||
// getOrNewStateObject retrieves a state object or create a new state object if nil.
|
||||
func (s *StateDB) getOrNewStateObject(addr common.Address) *stateObject {
|
||||
stateObject := s.getStateObject(addr)
|
||||
if stateObject == nil {
|
||||
stateObject, _ = s.createObject(addr)
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ func TestCopy(t *testing.T) {
|
|||
orig, _ := New(types.EmptyRootHash, NewDatabase(rawdb.NewMemoryDatabase()), nil)
|
||||
|
||||
for i := byte(0); i < 255; i++ {
|
||||
obj := orig.GetOrNewStateObject(common.BytesToAddress([]byte{i}))
|
||||
obj := orig.getOrNewStateObject(common.BytesToAddress([]byte{i}))
|
||||
obj.AddBalance(big.NewInt(int64(i)))
|
||||
orig.updateStateObject(obj)
|
||||
}
|
||||
|
|
@ -180,9 +180,9 @@ func TestCopy(t *testing.T) {
|
|||
|
||||
// modify all in memory
|
||||
for i := byte(0); i < 255; i++ {
|
||||
origObj := orig.GetOrNewStateObject(common.BytesToAddress([]byte{i}))
|
||||
copyObj := copy.GetOrNewStateObject(common.BytesToAddress([]byte{i}))
|
||||
ccopyObj := ccopy.GetOrNewStateObject(common.BytesToAddress([]byte{i}))
|
||||
origObj := orig.getOrNewStateObject(common.BytesToAddress([]byte{i}))
|
||||
copyObj := copy.getOrNewStateObject(common.BytesToAddress([]byte{i}))
|
||||
ccopyObj := ccopy.getOrNewStateObject(common.BytesToAddress([]byte{i}))
|
||||
|
||||
origObj.AddBalance(big.NewInt(2 * int64(i)))
|
||||
copyObj.AddBalance(big.NewInt(3 * int64(i)))
|
||||
|
|
@ -208,9 +208,9 @@ func TestCopy(t *testing.T) {
|
|||
|
||||
// Verify that the three states have been updated independently
|
||||
for i := byte(0); i < 255; i++ {
|
||||
origObj := orig.GetOrNewStateObject(common.BytesToAddress([]byte{i}))
|
||||
copyObj := copy.GetOrNewStateObject(common.BytesToAddress([]byte{i}))
|
||||
ccopyObj := ccopy.GetOrNewStateObject(common.BytesToAddress([]byte{i}))
|
||||
origObj := orig.getOrNewStateObject(common.BytesToAddress([]byte{i}))
|
||||
copyObj := copy.getOrNewStateObject(common.BytesToAddress([]byte{i}))
|
||||
ccopyObj := ccopy.getOrNewStateObject(common.BytesToAddress([]byte{i}))
|
||||
|
||||
if want := big.NewInt(3 * int64(i)); origObj.Balance().Cmp(want) != 0 {
|
||||
t.Errorf("orig obj %d: balance mismatch: have %v, want %v", i, origObj.Balance(), want)
|
||||
|
|
@ -531,7 +531,7 @@ func (test *snapshotTest) checkEqual(state, checkstate *StateDB) error {
|
|||
|
||||
func TestTouchDelete(t *testing.T) {
|
||||
s := newStateEnv()
|
||||
s.state.GetOrNewStateObject(common.Address{})
|
||||
s.state.getOrNewStateObject(common.Address{})
|
||||
root, _ := s.state.Commit(0, false)
|
||||
s.state, _ = New(root, s.state.db, s.state.snaps)
|
||||
|
||||
|
|
@ -1158,7 +1158,7 @@ func TestDeleteStorage(t *testing.T) {
|
|||
fastState, _ := New(root, db, snaps)
|
||||
slowState, _ := New(root, db, nil)
|
||||
|
||||
obj := fastState.GetOrNewStateObject(addr)
|
||||
obj := fastState.getOrNewStateObject(addr)
|
||||
storageRoot := obj.data.Root
|
||||
|
||||
_, _, fastNodes, err := fastState.deleteStorage(addr, crypto.Keccak256Hash(addr[:]), storageRoot)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ func makeTestState(scheme string) (ethdb.Database, Database, *trie.Database, com
|
|||
// Fill it with some arbitrary data
|
||||
var accounts []*testAccount
|
||||
for i := byte(0); i < 96; i++ {
|
||||
obj := state.GetOrNewStateObject(common.BytesToAddress([]byte{i}))
|
||||
obj := state.getOrNewStateObject(common.BytesToAddress([]byte{i}))
|
||||
acc := &testAccount{address: common.BytesToAddress([]byte{i})}
|
||||
|
||||
obj.AddBalance(big.NewInt(int64(11 * i)))
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"math/big"
|
||||
|
|
@ -315,8 +314,14 @@ func (st *StateTransition) preCheck() error {
|
|||
}
|
||||
// Check the blob version validity
|
||||
if msg.BlobHashes != nil {
|
||||
// The to field of a blob tx type is mandatory, and a `BlobTx` transaction internally
|
||||
// has it as a non-nillable value, so any msg derived from blob transaction has it non-nil.
|
||||
// However, messages created through RPC (eth_call) don't have this restriction.
|
||||
if msg.To == nil {
|
||||
return ErrBlobTxCreate
|
||||
}
|
||||
if len(msg.BlobHashes) == 0 {
|
||||
return errors.New("blob transaction missing blob hashes")
|
||||
return ErrMissingBlobHashes
|
||||
}
|
||||
for i, hash := range msg.BlobHashes {
|
||||
if hash[0] != params.BlobTxHashVersion {
|
||||
|
|
|
|||
|
|
@ -583,7 +583,7 @@ func (p *BlobPool) recheck(addr common.Address, inclusions map[common.Hash]uint6
|
|||
txs[0].evictionBlobFeeJumps = txs[0].blobfeeJumps
|
||||
|
||||
for i := 1; i < len(txs); i++ {
|
||||
// If there's no nonce gap, initialize the evicion thresholds as the
|
||||
// If there's no nonce gap, initialize the eviction thresholds as the
|
||||
// minimum between the cumulative thresholds and the current tx fees
|
||||
if txs[i].nonce == txs[i-1].nonce+1 {
|
||||
txs[i].evictionExecTip = txs[i-1].evictionExecTip
|
||||
|
|
@ -1355,7 +1355,7 @@ func (p *BlobPool) drop() {
|
|||
p.stored -= uint64(drop.size)
|
||||
delete(p.lookup, drop.hash)
|
||||
|
||||
// Remove the transaction from the pool's evicion heap:
|
||||
// Remove the transaction from the pool's eviction heap:
|
||||
// - If the entire account was dropped, pop off the address
|
||||
// - Otherwise, if the new tail has better eviction caps, fix the heap
|
||||
if last {
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ func Call(address common.Address, input []byte, cfg *Config) ([]byte, uint64, er
|
|||
|
||||
var (
|
||||
vmenv = NewEnv(cfg)
|
||||
sender = cfg.State.GetOrNewStateObject(cfg.Origin)
|
||||
sender = vm.AccountRef(cfg.Origin)
|
||||
statedb = cfg.State
|
||||
rules = cfg.ChainConfig.Rules(vmenv.Context.BlockNumber, vmenv.Context.Random != nil, vmenv.Context.Time)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ type peerSet struct {
|
|||
|
||||
lock sync.RWMutex
|
||||
closed bool
|
||||
quitCh chan struct{} // Quit channel to signal termination
|
||||
}
|
||||
|
||||
// newPeerSet creates a new peer set to track the active participants.
|
||||
|
|
@ -65,6 +66,7 @@ func newPeerSet() *peerSet {
|
|||
peers: make(map[string]*ethPeer),
|
||||
snapWait: make(map[string]chan *snap.Peer),
|
||||
snapPend: make(map[string]*snap.Peer),
|
||||
quitCh: make(chan struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +131,15 @@ func (ps *peerSet) waitSnapExtension(peer *eth.Peer) (*snap.Peer, error) {
|
|||
ps.snapWait[id] = wait
|
||||
ps.lock.Unlock()
|
||||
|
||||
return <-wait, nil
|
||||
select {
|
||||
case p := <-wait:
|
||||
return p, nil
|
||||
case <-ps.quitCh:
|
||||
ps.lock.Lock()
|
||||
delete(ps.snapWait, id)
|
||||
ps.lock.Unlock()
|
||||
return nil, errPeerSetClosed
|
||||
}
|
||||
}
|
||||
|
||||
// registerPeer injects a new `eth` peer into the working set, or returns an error
|
||||
|
|
@ -256,5 +266,8 @@ func (ps *peerSet) close() {
|
|||
for _, p := range ps.peers {
|
||||
p.Disconnect(p2p.DiscQuitting)
|
||||
}
|
||||
if !ps.closed {
|
||||
close(ps.quitCh)
|
||||
}
|
||||
ps.closed = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,12 +122,7 @@ func testCallTracer(tracerName string, dirPath string, t *testing.T) {
|
|||
}
|
||||
// Configure a blockchain with the given prestate
|
||||
var (
|
||||
signer = types.MakeSigner(test.Genesis.Config, new(big.Int).SetUint64(uint64(test.Context.Number)), uint64(test.Context.Time))
|
||||
origin, _ = signer.Sender(tx)
|
||||
txContext = vm.TxContext{
|
||||
Origin: origin,
|
||||
GasPrice: tx.GasPrice(),
|
||||
}
|
||||
signer = types.MakeSigner(test.Genesis.Config, new(big.Int).SetUint64(uint64(test.Context.Number)), uint64(test.Context.Time))
|
||||
context = vm.BlockContext{
|
||||
CanTransfer: core.CanTransfer,
|
||||
Transfer: core.Transfer,
|
||||
|
|
@ -146,11 +141,11 @@ func testCallTracer(tracerName string, dirPath string, t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("failed to create call tracer: %v", err)
|
||||
}
|
||||
evm := vm.NewEVM(context, txContext, statedb, test.Genesis.Config, vm.Config{Tracer: tracer})
|
||||
msg, err := core.TransactionToMessage(tx, signer, nil)
|
||||
msg, err := core.TransactionToMessage(tx, signer, context.BaseFee)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to prepare transaction for tracing: %v", err)
|
||||
}
|
||||
evm := vm.NewEVM(context, core.NewEVMTxContext(msg), statedb, test.Genesis.Config, vm.Config{Tracer: tracer})
|
||||
vmRet, err := core.ApplyMessage(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
||||
if err != nil {
|
||||
t.Fatalf("failed to execute transaction: %v", err)
|
||||
|
|
@ -222,10 +217,6 @@ func benchTracer(tracerName string, test *callTracerTest, b *testing.B) {
|
|||
b.Fatalf("failed to parse testcase input: %v", err)
|
||||
}
|
||||
signer := types.MakeSigner(test.Genesis.Config, new(big.Int).SetUint64(uint64(test.Context.Number)), uint64(test.Context.Time))
|
||||
msg, err := core.TransactionToMessage(tx, signer, nil)
|
||||
if err != nil {
|
||||
b.Fatalf("failed to prepare transaction for tracing: %v", err)
|
||||
}
|
||||
origin, _ := signer.Sender(tx)
|
||||
txContext := vm.TxContext{
|
||||
Origin: origin,
|
||||
|
|
@ -240,6 +231,10 @@ func benchTracer(tracerName string, test *callTracerTest, b *testing.B) {
|
|||
Difficulty: (*big.Int)(test.Context.Difficulty),
|
||||
GasLimit: uint64(test.Context.GasLimit),
|
||||
}
|
||||
msg, err := core.TransactionToMessage(tx, signer, context.BaseFee)
|
||||
if err != nil {
|
||||
b.Fatalf("failed to prepare transaction for tracing: %v", err)
|
||||
}
|
||||
triedb, _, statedb := tests.MakePreState(rawdb.NewMemoryDatabase(), test.Genesis.Alloc, false, rawdb.HashScheme)
|
||||
defer triedb.Close()
|
||||
|
||||
|
|
|
|||
|
|
@ -86,11 +86,6 @@ func flatCallTracerTestRunner(tracerName string, filename string, dirPath string
|
|||
return fmt.Errorf("failed to parse testcase input: %v", err)
|
||||
}
|
||||
signer := types.MakeSigner(test.Genesis.Config, new(big.Int).SetUint64(uint64(test.Context.Number)), uint64(test.Context.Time))
|
||||
origin, _ := signer.Sender(tx)
|
||||
txContext := vm.TxContext{
|
||||
Origin: origin,
|
||||
GasPrice: tx.GasPrice(),
|
||||
}
|
||||
context := vm.BlockContext{
|
||||
CanTransfer: core.CanTransfer,
|
||||
Transfer: core.Transfer,
|
||||
|
|
@ -108,12 +103,11 @@ func flatCallTracerTestRunner(tracerName string, filename string, dirPath string
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to create call tracer: %v", err)
|
||||
}
|
||||
evm := vm.NewEVM(context, txContext, statedb, test.Genesis.Config, vm.Config{Tracer: tracer})
|
||||
|
||||
msg, err := core.TransactionToMessage(tx, signer, nil)
|
||||
msg, err := core.TransactionToMessage(tx, signer, context.BaseFee)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to prepare transaction for tracing: %v", err)
|
||||
}
|
||||
evm := vm.NewEVM(context, core.NewEVMTxContext(msg), statedb, test.Genesis.Config, vm.Config{Tracer: tracer})
|
||||
st := core.NewStateTransition(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
||||
|
||||
if _, err = st.TransitionDb(); err != nil {
|
||||
|
|
|
|||
|
|
@ -92,12 +92,7 @@ func testPrestateDiffTracer(tracerName string, dirPath string, t *testing.T) {
|
|||
}
|
||||
// Configure a blockchain with the given prestate
|
||||
var (
|
||||
signer = types.MakeSigner(test.Genesis.Config, new(big.Int).SetUint64(uint64(test.Context.Number)), uint64(test.Context.Time))
|
||||
origin, _ = signer.Sender(tx)
|
||||
txContext = vm.TxContext{
|
||||
Origin: origin,
|
||||
GasPrice: tx.GasPrice(),
|
||||
}
|
||||
signer = types.MakeSigner(test.Genesis.Config, new(big.Int).SetUint64(uint64(test.Context.Number)), uint64(test.Context.Time))
|
||||
context = vm.BlockContext{
|
||||
CanTransfer: core.CanTransfer,
|
||||
Transfer: core.Transfer,
|
||||
|
|
@ -116,11 +111,11 @@ func testPrestateDiffTracer(tracerName string, dirPath string, t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("failed to create call tracer: %v", err)
|
||||
}
|
||||
evm := vm.NewEVM(context, txContext, statedb, test.Genesis.Config, vm.Config{Tracer: tracer})
|
||||
msg, err := core.TransactionToMessage(tx, signer, nil)
|
||||
msg, err := core.TransactionToMessage(tx, signer, context.BaseFee)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to prepare transaction for tracing: %v", err)
|
||||
}
|
||||
evm := vm.NewEVM(context, core.NewEVMTxContext(msg), statedb, test.Genesis.Config, vm.Config{Tracer: tracer})
|
||||
st := core.NewStateTransition(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
||||
if _, err = st.TransitionDb(); err != nil {
|
||||
t.Fatalf("failed to execute transaction: %v", err)
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
},
|
||||
"post": {
|
||||
"0x808b4da0be6c9512e948521452227efc619bea52": {
|
||||
"balance": "0x2cd72a36dd031f089",
|
||||
"balance": "0x2cd987071ba2346b6",
|
||||
"nonce": 1223933
|
||||
},
|
||||
"0x8f03f1a3f10c05e7cccf75c1fd10168e06659be7": {
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ func BenchmarkTransactionTrace(b *testing.B) {
|
|||
//EnableReturnData: false,
|
||||
})
|
||||
evm := vm.NewEVM(context, txContext, statedb, params.AllEthashProtocolChanges, vm.Config{Tracer: tracer})
|
||||
msg, err := core.TransactionToMessage(tx, signer, nil)
|
||||
msg, err := core.TransactionToMessage(tx, signer, context.BaseFee)
|
||||
if err != nil {
|
||||
b.Fatalf("failed to prepare transaction for tracing: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ func TestEthClient(t *testing.T) {
|
|||
func(t *testing.T) { testBalanceAt(t, client) },
|
||||
},
|
||||
"TxInBlockInterrupted": {
|
||||
func(t *testing.T) { testTransactionInBlockInterrupted(t, client) },
|
||||
func(t *testing.T) { testTransactionInBlock(t, client) },
|
||||
},
|
||||
"ChainID": {
|
||||
func(t *testing.T) { testChainID(t, client) },
|
||||
|
|
@ -329,7 +329,7 @@ func testHeader(t *testing.T, chain []*types.Block, client *rpc.Client) {
|
|||
got.Number = big.NewInt(0) // hack to make DeepEqual work
|
||||
}
|
||||
if !reflect.DeepEqual(got, tt.want) {
|
||||
t.Fatalf("HeaderByNumber(%v)\n = %v\nwant %v", tt.block, got, tt.want)
|
||||
t.Fatalf("HeaderByNumber(%v) got = %v, want %v", tt.block, got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -381,7 +381,7 @@ func testBalanceAt(t *testing.T, client *rpc.Client) {
|
|||
}
|
||||
}
|
||||
|
||||
func testTransactionInBlockInterrupted(t *testing.T, client *rpc.Client) {
|
||||
func testTransactionInBlock(t *testing.T, client *rpc.Client) {
|
||||
ec := NewClient(client)
|
||||
|
||||
// Get current block by number.
|
||||
|
|
@ -390,22 +390,27 @@ func testTransactionInBlockInterrupted(t *testing.T, client *rpc.Client) {
|
|||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
// Test tx in block interrupted.
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
<-ctx.Done() // Ensure the close of the Done channel
|
||||
tx, err := ec.TransactionInBlock(ctx, block.Hash(), 0)
|
||||
if tx != nil {
|
||||
t.Fatal("transaction should be nil")
|
||||
}
|
||||
if err == nil || err == ethereum.NotFound {
|
||||
t.Fatal("error should not be nil/notfound")
|
||||
}
|
||||
|
||||
// Test tx in block not found.
|
||||
if _, err := ec.TransactionInBlock(context.Background(), block.Hash(), 20); err != ethereum.NotFound {
|
||||
t.Fatal("error should be ethereum.NotFound")
|
||||
}
|
||||
|
||||
// Test tx in block found.
|
||||
tx, err := ec.TransactionInBlock(context.Background(), block.Hash(), 0)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
if tx.Hash() != testTx1.Hash() {
|
||||
t.Fatalf("unexpected transaction: %v", tx)
|
||||
}
|
||||
|
||||
tx, err = ec.TransactionInBlock(context.Background(), block.Hash(), 1)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
if tx.Hash() != testTx2.Hash() {
|
||||
t.Fatalf("unexpected transaction: %v", tx)
|
||||
}
|
||||
}
|
||||
|
||||
func testChainID(t *testing.T, client *rpc.Client) {
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ import (
|
|||
// allowed to produce in order to speed up calculations.
|
||||
const estimateGasErrorRatio = 0.015
|
||||
|
||||
var errBlobTxNotSupported = errors.New("signing blob transactions not supported")
|
||||
|
||||
// EthereumAPI provides an API to access Ethereum related information.
|
||||
type EthereumAPI struct {
|
||||
b Backend
|
||||
|
|
@ -468,6 +470,9 @@ func (s *PersonalAccountAPI) SendTransaction(ctx context.Context, args Transacti
|
|||
s.nonceLock.LockAddr(args.from())
|
||||
defer s.nonceLock.UnlockAddr(args.from())
|
||||
}
|
||||
if args.IsEIP4844() {
|
||||
return common.Hash{}, errBlobTxNotSupported
|
||||
}
|
||||
signed, err := s.signTransaction(ctx, &args, passwd)
|
||||
if err != nil {
|
||||
log.Warn("Failed transaction send attempt", "from", args.from(), "to", args.To, "value", args.Value.ToInt(), "err", err)
|
||||
|
|
@ -492,6 +497,9 @@ func (s *PersonalAccountAPI) SignTransaction(ctx context.Context, args Transacti
|
|||
if args.GasPrice == nil && (args.MaxFeePerGas == nil || args.MaxPriorityFeePerGas == nil) {
|
||||
return nil, errors.New("missing gasPrice or maxFeePerGas/maxPriorityFeePerGas")
|
||||
}
|
||||
if args.IsEIP4844() {
|
||||
return nil, errBlobTxNotSupported
|
||||
}
|
||||
if args.Nonce == nil {
|
||||
return nil, errors.New("nonce not specified")
|
||||
}
|
||||
|
|
@ -1219,6 +1227,7 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr
|
|||
// returns error if the transaction would revert or if there are unexpected failures. The returned
|
||||
// value is capped by both `args.Gas` (if non-nil & non-zero) and the backend's RPCGasCap
|
||||
// configuration (if non-zero).
|
||||
// Note: Required blob gas is not computed in this method.
|
||||
func (s *BlockChainAPI) EstimateGas(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *StateOverride) (hexutil.Uint64, error) {
|
||||
bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber)
|
||||
if blockNrOrHash != nil {
|
||||
|
|
@ -1809,6 +1818,9 @@ func (s *TransactionAPI) SendTransaction(ctx context.Context, args TransactionAr
|
|||
s.nonceLock.LockAddr(args.from())
|
||||
defer s.nonceLock.UnlockAddr(args.from())
|
||||
}
|
||||
if args.IsEIP4844() {
|
||||
return common.Hash{}, errBlobTxNotSupported
|
||||
}
|
||||
|
||||
// Set some sanity defaults and terminate on failure
|
||||
if err := args.setDefaults(ctx, s.b); err != nil {
|
||||
|
|
@ -1834,6 +1846,7 @@ func (s *TransactionAPI) FillTransaction(ctx context.Context, args TransactionAr
|
|||
}
|
||||
// Assemble the transaction and obtain rlp
|
||||
tx := args.toTransaction()
|
||||
// TODO(s1na): fill in blob proofs, commitments
|
||||
data, err := tx.MarshalBinary()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -1892,6 +1905,9 @@ func (s *TransactionAPI) SignTransaction(ctx context.Context, args TransactionAr
|
|||
if args.GasPrice == nil && (args.MaxPriorityFeePerGas == nil || args.MaxFeePerGas == nil) {
|
||||
return nil, errors.New("missing gasPrice or maxFeePerGas/maxPriorityFeePerGas")
|
||||
}
|
||||
if args.IsEIP4844() {
|
||||
return nil, errBlobTxNotSupported
|
||||
}
|
||||
if args.Nonce == nil {
|
||||
return nil, errors.New("nonce not specified")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package ethapi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/ecdsa"
|
||||
"encoding/json"
|
||||
|
|
@ -31,6 +32,7 @@ import (
|
|||
|
||||
"github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/accounts"
|
||||
"github.com/ethereum/go-ethereum/accounts/keystore"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/consensus"
|
||||
|
|
@ -403,10 +405,30 @@ func allBlobTxs(addr common.Address, config *params.ChainConfig) []txData {
|
|||
}
|
||||
}
|
||||
|
||||
func newTestAccountManager(t *testing.T) (*accounts.Manager, accounts.Account) {
|
||||
var (
|
||||
dir = t.TempDir()
|
||||
am = accounts.NewManager(&accounts.Config{InsecureUnlockAllowed: true})
|
||||
b = keystore.NewKeyStore(dir, 2, 1)
|
||||
testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
||||
)
|
||||
acc, err := b.ImportECDSA(testKey, "")
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create test account: %v", err)
|
||||
}
|
||||
if err := b.Unlock(acc, ""); err != nil {
|
||||
t.Fatalf("failed to unlock account: %v\n", err)
|
||||
}
|
||||
am.AddBackend(b)
|
||||
return am, acc
|
||||
}
|
||||
|
||||
type testBackend struct {
|
||||
db ethdb.Database
|
||||
chain *core.BlockChain
|
||||
pending *types.Block
|
||||
accman *accounts.Manager
|
||||
acc accounts.Account
|
||||
}
|
||||
|
||||
func newTestBackend(t *testing.T, n int, gspec *core.Genesis, engine consensus.Engine, generator func(i int, b *core.BlockGen)) *testBackend {
|
||||
|
|
@ -419,6 +441,8 @@ func newTestBackend(t *testing.T, n int, gspec *core.Genesis, engine consensus.E
|
|||
TrieDirtyDisabled: true, // Archive mode
|
||||
}
|
||||
)
|
||||
accman, acc := newTestAccountManager(t)
|
||||
gspec.Alloc[acc.Address] = core.GenesisAccount{Balance: big.NewInt(params.Ether)}
|
||||
// Generate blocks for testing
|
||||
db, blocks, _ := core.GenerateChainWithGenesis(gspec, engine, n, generator)
|
||||
txlookupLimit := uint64(0)
|
||||
|
|
@ -430,7 +454,7 @@ func newTestBackend(t *testing.T, n int, gspec *core.Genesis, engine consensus.E
|
|||
t.Fatalf("block %d: failed to insert into chain: %v", n, err)
|
||||
}
|
||||
|
||||
backend := &testBackend{db: db, chain: chain}
|
||||
backend := &testBackend{db: db, chain: chain, accman: accman, acc: acc}
|
||||
return backend
|
||||
}
|
||||
|
||||
|
|
@ -446,7 +470,7 @@ func (b testBackend) FeeHistory(ctx context.Context, blockCount uint64, lastBloc
|
|||
return nil, nil, nil, nil, nil
|
||||
}
|
||||
func (b testBackend) ChainDb() ethdb.Database { return b.db }
|
||||
func (b testBackend) AccountManager() *accounts.Manager { return nil }
|
||||
func (b testBackend) AccountManager() *accounts.Manager { return b.accman }
|
||||
func (b testBackend) ExtRPCEnabled() bool { return false }
|
||||
func (b testBackend) RPCGasCap() uint64 { return 10000000 }
|
||||
func (b testBackend) RPCEVMTimeout() time.Duration { return time.Second }
|
||||
|
|
@ -566,7 +590,7 @@ func (b testBackend) GetTransaction(ctx context.Context, txHash common.Hash) (*t
|
|||
func (b testBackend) GetPoolTransactions() (types.Transactions, error) { panic("implement me") }
|
||||
func (b testBackend) GetPoolTransaction(txHash common.Hash) *types.Transaction { panic("implement me") }
|
||||
func (b testBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error) {
|
||||
panic("implement me")
|
||||
return 0, nil
|
||||
}
|
||||
func (b testBackend) Stats() (pending int, queued int) { panic("implement me") }
|
||||
func (b testBackend) TxPoolContent() (map[common.Address][]*types.Transaction, map[common.Address][]*types.Transaction) {
|
||||
|
|
@ -603,7 +627,7 @@ func TestEstimateGas(t *testing.T) {
|
|||
var (
|
||||
accounts = newAccounts(2)
|
||||
genesis = &core.Genesis{
|
||||
Config: params.TestChainConfig,
|
||||
Config: params.MergedTestChainConfig,
|
||||
Alloc: core.GenesisAlloc{
|
||||
accounts[0].addr: {Balance: big.NewInt(params.Ether)},
|
||||
accounts[1].addr: {Balance: big.NewInt(params.Ether)},
|
||||
|
|
@ -613,12 +637,13 @@ func TestEstimateGas(t *testing.T) {
|
|||
signer = types.HomesteadSigner{}
|
||||
randomAccounts = newAccounts(2)
|
||||
)
|
||||
api := NewBlockChainAPI(newTestBackend(t, genBlocks, genesis, ethash.NewFaker(), func(i int, b *core.BlockGen) {
|
||||
api := NewBlockChainAPI(newTestBackend(t, genBlocks, genesis, beacon.New(ethash.NewFaker()), func(i int, b *core.BlockGen) {
|
||||
// Transfer from account[0] to account[1]
|
||||
// value: 1000 wei
|
||||
// fee: 0 wei
|
||||
tx, _ := types.SignTx(types.NewTx(&types.LegacyTx{Nonce: uint64(i), To: &accounts[1].addr, Value: big.NewInt(1000), Gas: params.TxGas, GasPrice: b.BaseFee(), Data: nil}), signer, accounts[0].key)
|
||||
b.AddTx(tx)
|
||||
b.SetPoS()
|
||||
}))
|
||||
var testSuite = []struct {
|
||||
blockNumber rpc.BlockNumber
|
||||
|
|
@ -718,6 +743,18 @@ func TestEstimateGas(t *testing.T) {
|
|||
expectErr: nil,
|
||||
want: 67595,
|
||||
},
|
||||
// Blobs should have no effect on gas estimate
|
||||
{
|
||||
blockNumber: rpc.LatestBlockNumber,
|
||||
call: TransactionArgs{
|
||||
From: &accounts[0].addr,
|
||||
To: &accounts[1].addr,
|
||||
Value: (*hexutil.Big)(big.NewInt(1)),
|
||||
BlobHashes: []common.Hash{common.Hash{0x01, 0x22}},
|
||||
BlobFeeCap: (*hexutil.Big)(big.NewInt(1)),
|
||||
},
|
||||
want: 21000,
|
||||
},
|
||||
}
|
||||
for i, tc := range testSuite {
|
||||
result, err := api.EstimateGas(context.Background(), tc.call, &rpc.BlockNumberOrHash{BlockNumber: &tc.blockNumber}, &tc.overrides)
|
||||
|
|
@ -747,7 +784,7 @@ func TestCall(t *testing.T) {
|
|||
var (
|
||||
accounts = newAccounts(3)
|
||||
genesis = &core.Genesis{
|
||||
Config: params.TestChainConfig,
|
||||
Config: params.MergedTestChainConfig,
|
||||
Alloc: core.GenesisAlloc{
|
||||
accounts[0].addr: {Balance: big.NewInt(params.Ether)},
|
||||
accounts[1].addr: {Balance: big.NewInt(params.Ether)},
|
||||
|
|
@ -757,12 +794,13 @@ func TestCall(t *testing.T) {
|
|||
genBlocks = 10
|
||||
signer = types.HomesteadSigner{}
|
||||
)
|
||||
api := NewBlockChainAPI(newTestBackend(t, genBlocks, genesis, ethash.NewFaker(), func(i int, b *core.BlockGen) {
|
||||
api := NewBlockChainAPI(newTestBackend(t, genBlocks, genesis, beacon.New(ethash.NewFaker()), func(i int, b *core.BlockGen) {
|
||||
// Transfer from account[0] to account[1]
|
||||
// value: 1000 wei
|
||||
// fee: 0 wei
|
||||
tx, _ := types.SignTx(types.NewTx(&types.LegacyTx{Nonce: uint64(i), To: &accounts[1].addr, Value: big.NewInt(1000), Gas: params.TxGas, GasPrice: b.BaseFee(), Data: nil}), signer, accounts[0].key)
|
||||
b.AddTx(tx)
|
||||
b.SetPoS()
|
||||
}))
|
||||
randomAccounts := newAccounts(3)
|
||||
var testSuite = []struct {
|
||||
|
|
@ -884,6 +922,32 @@ func TestCall(t *testing.T) {
|
|||
blockOverrides: BlockOverrides{Number: (*hexutil.Big)(big.NewInt(11))},
|
||||
want: "0x000000000000000000000000000000000000000000000000000000000000000b",
|
||||
},
|
||||
// Invalid blob tx
|
||||
{
|
||||
blockNumber: rpc.LatestBlockNumber,
|
||||
call: TransactionArgs{
|
||||
From: &accounts[1].addr,
|
||||
Input: &hexutil.Bytes{0x00},
|
||||
BlobHashes: []common.Hash{},
|
||||
},
|
||||
expectErr: core.ErrBlobTxCreate,
|
||||
},
|
||||
// BLOBHASH opcode
|
||||
{
|
||||
blockNumber: rpc.LatestBlockNumber,
|
||||
call: TransactionArgs{
|
||||
From: &accounts[1].addr,
|
||||
To: &randomAccounts[2].addr,
|
||||
BlobHashes: []common.Hash{common.Hash{0x01, 0x22}},
|
||||
BlobFeeCap: (*hexutil.Big)(big.NewInt(1)),
|
||||
},
|
||||
overrides: StateOverride{
|
||||
randomAccounts[2].addr: {
|
||||
Code: hex2Bytes("60004960005260206000f3"),
|
||||
},
|
||||
},
|
||||
want: "0x0122000000000000000000000000000000000000000000000000000000000000",
|
||||
},
|
||||
}
|
||||
for i, tc := range testSuite {
|
||||
result, err := api.Call(context.Background(), tc.call, &rpc.BlockNumberOrHash{BlockNumber: &tc.blockNumber}, &tc.overrides, &tc.blockOverrides)
|
||||
|
|
@ -910,6 +974,134 @@ func TestCall(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestSignTransaction(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Initialize test accounts
|
||||
var (
|
||||
key, _ = crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a")
|
||||
to = crypto.PubkeyToAddress(key.PublicKey)
|
||||
genesis = &core.Genesis{
|
||||
Config: params.MergedTestChainConfig,
|
||||
Alloc: core.GenesisAlloc{},
|
||||
}
|
||||
)
|
||||
b := newTestBackend(t, 1, genesis, beacon.New(ethash.NewFaker()), func(i int, b *core.BlockGen) {
|
||||
b.SetPoS()
|
||||
})
|
||||
api := NewTransactionAPI(b, nil)
|
||||
res, err := api.FillTransaction(context.Background(), TransactionArgs{
|
||||
From: &b.acc.Address,
|
||||
To: &to,
|
||||
Value: (*hexutil.Big)(big.NewInt(1)),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("failed to fill tx defaults: %v\n", err)
|
||||
}
|
||||
|
||||
res, err = api.SignTransaction(context.Background(), argsFromTransaction(res.Tx, b.acc.Address))
|
||||
if err != nil {
|
||||
t.Fatalf("failed to sign tx: %v\n", err)
|
||||
}
|
||||
tx, err := json.Marshal(res.Tx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
expect := `{"type":"0x2","chainId":"0x1","nonce":"0x0","to":"0x703c4b2bd70c169f5717101caee543299fc946c7","gas":"0x5208","gasPrice":null,"maxPriorityFeePerGas":"0x0","maxFeePerGas":"0x684ee180","value":"0x1","input":"0x","accessList":[],"v":"0x0","r":"0x8fabeb142d585dd9247f459f7e6fe77e2520c88d50ba5d220da1533cea8b34e1","s":"0x582dd68b21aef36ba23f34e49607329c20d981d30404daf749077f5606785ce7","yParity":"0x0","hash":"0x93927839207cfbec395da84b8a2bc38b7b65d2cb2819e9fef1f091f5b1d4cc8f"}`
|
||||
if !bytes.Equal(tx, []byte(expect)) {
|
||||
t.Errorf("result mismatch. Have:\n%s\nWant:\n%s\n", tx, expect)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSignBlobTransaction(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Initialize test accounts
|
||||
var (
|
||||
key, _ = crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a")
|
||||
to = crypto.PubkeyToAddress(key.PublicKey)
|
||||
genesis = &core.Genesis{
|
||||
Config: params.MergedTestChainConfig,
|
||||
Alloc: core.GenesisAlloc{},
|
||||
}
|
||||
)
|
||||
b := newTestBackend(t, 1, genesis, beacon.New(ethash.NewFaker()), func(i int, b *core.BlockGen) {
|
||||
b.SetPoS()
|
||||
})
|
||||
api := NewTransactionAPI(b, nil)
|
||||
res, err := api.FillTransaction(context.Background(), TransactionArgs{
|
||||
From: &b.acc.Address,
|
||||
To: &to,
|
||||
Value: (*hexutil.Big)(big.NewInt(1)),
|
||||
BlobHashes: []common.Hash{{0x01, 0x22}},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("failed to fill tx defaults: %v\n", err)
|
||||
}
|
||||
|
||||
_, err = api.SignTransaction(context.Background(), argsFromTransaction(res.Tx, b.acc.Address))
|
||||
if err == nil {
|
||||
t.Fatalf("should fail on blob transaction")
|
||||
}
|
||||
if !errors.Is(err, errBlobTxNotSupported) {
|
||||
t.Errorf("error mismatch. Have: %v, want: %v", err, errBlobTxNotSupported)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSendBlobTransaction(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Initialize test accounts
|
||||
var (
|
||||
key, _ = crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a")
|
||||
to = crypto.PubkeyToAddress(key.PublicKey)
|
||||
genesis = &core.Genesis{
|
||||
Config: params.MergedTestChainConfig,
|
||||
Alloc: core.GenesisAlloc{},
|
||||
}
|
||||
)
|
||||
b := newTestBackend(t, 1, genesis, beacon.New(ethash.NewFaker()), func(i int, b *core.BlockGen) {
|
||||
b.SetPoS()
|
||||
})
|
||||
api := NewTransactionAPI(b, nil)
|
||||
res, err := api.FillTransaction(context.Background(), TransactionArgs{
|
||||
From: &b.acc.Address,
|
||||
To: &to,
|
||||
Value: (*hexutil.Big)(big.NewInt(1)),
|
||||
BlobHashes: []common.Hash{common.Hash{0x01, 0x22}},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("failed to fill tx defaults: %v\n", err)
|
||||
}
|
||||
|
||||
_, err = api.SendTransaction(context.Background(), argsFromTransaction(res.Tx, b.acc.Address))
|
||||
if err == nil {
|
||||
t.Errorf("sending tx should have failed")
|
||||
} else if !errors.Is(err, errBlobTxNotSupported) {
|
||||
t.Errorf("unexpected error. Have %v, want %v\n", err, errBlobTxNotSupported)
|
||||
}
|
||||
}
|
||||
|
||||
func argsFromTransaction(tx *types.Transaction, from common.Address) TransactionArgs {
|
||||
var (
|
||||
gas = tx.Gas()
|
||||
nonce = tx.Nonce()
|
||||
input = tx.Data()
|
||||
)
|
||||
return TransactionArgs{
|
||||
From: &from,
|
||||
To: tx.To(),
|
||||
Gas: (*hexutil.Uint64)(&gas),
|
||||
MaxFeePerGas: (*hexutil.Big)(tx.GasFeeCap()),
|
||||
MaxPriorityFeePerGas: (*hexutil.Big)(tx.GasTipCap()),
|
||||
Value: (*hexutil.Big)(tx.Value()),
|
||||
Nonce: (*hexutil.Uint64)(&nonce),
|
||||
Input: (*hexutil.Bytes)(&input),
|
||||
ChainID: (*hexutil.Big)(tx.ChainId()),
|
||||
// TODO: impl accessList conversion
|
||||
//AccessList: tx.AccessList(),
|
||||
BlobFeeCap: (*hexutil.Big)(tx.BlobGasFeeCap()),
|
||||
BlobHashes: tx.BlobHashes(),
|
||||
}
|
||||
}
|
||||
|
||||
type account struct {
|
||||
key *ecdsa.PrivateKey
|
||||
addr common.Address
|
||||
|
|
@ -1399,9 +1591,7 @@ func TestRPCGetBlockOrHeader(t *testing.T) {
|
|||
}
|
||||
|
||||
func setupReceiptBackend(t *testing.T, genBlocks int) (*testBackend, []common.Hash) {
|
||||
config := *params.TestChainConfig
|
||||
config.ShanghaiTime = new(uint64)
|
||||
config.CancunTime = new(uint64)
|
||||
config := *params.MergedTestChainConfig
|
||||
var (
|
||||
acc1Key, _ = crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a")
|
||||
acc2Key, _ = crypto.HexToECDSA("49a7b37aa6f6645917e7b807e9d1c00d4fa71f18343b0d4122a4d2df64dd6fee")
|
||||
|
|
@ -1432,9 +1622,6 @@ func setupReceiptBackend(t *testing.T, genBlocks int) (*testBackend, []common.Ha
|
|||
txHashes = make([]common.Hash, genBlocks)
|
||||
)
|
||||
|
||||
// Set the terminal total difficulty in the config
|
||||
genesis.Config.TerminalTotalDifficulty = big.NewInt(0)
|
||||
genesis.Config.TerminalTotalDifficultyPassed = true
|
||||
backend := newTestBackend(t, genBlocks, genesis, beacon.New(ethash.NewFaker()), func(i int, b *core.BlockGen) {
|
||||
var (
|
||||
tx *types.Transaction
|
||||
|
|
|
|||
|
|
@ -4,17 +4,17 @@
|
|||
"extraData": "0x",
|
||||
"gasLimit": "0x47e7c4",
|
||||
"gasUsed": "0x5208",
|
||||
"hash": "0x0da274b315de8e4d5bf8717218ec43540464ef36378cb896469bb731e1d3f3cb",
|
||||
"hash": "0xeeb5c1852740ca4bbe65b0f57baf80634ed12a2b44affe30eec3fb54437c3926",
|
||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"nonce": "0x0000000000000000",
|
||||
"number": "0x1",
|
||||
"parentHash": "0xbdc7d83b8f876938810462fe8d053263a482e44201e3883d4ae204ff4de7eff5",
|
||||
"parentHash": "0x98e056de84de969782b238b4509b32814627ba443ea622054a79c2bc7e4d92c7",
|
||||
"receiptsRoot": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
|
||||
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"size": "0x26a",
|
||||
"stateRoot": "0x92c5c55a698963f5b06e3aee415630f5c48b0760e537af94917ce9c4f42a2e22",
|
||||
"stateRoot": "0x4acfcd1a6ab9f5e62411021ecd8a749976ae50b0590e967471264b372d7ac55b",
|
||||
"timestamp": "0xa",
|
||||
"totalDifficulty": "0x1",
|
||||
"transactions": [
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"extraData": "0x",
|
||||
"gasLimit": "0x47e7c4",
|
||||
"gasUsed": "0x0",
|
||||
"hash": "0xbdc7d83b8f876938810462fe8d053263a482e44201e3883d4ae204ff4de7eff5",
|
||||
"hash": "0x98e056de84de969782b238b4509b32814627ba443ea622054a79c2bc7e4d92c7",
|
||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"size": "0x200",
|
||||
"stateRoot": "0xfe168c5e9584a85927212e5bea5304bb7d0d8a893453b4b2c52176a72f585ae2",
|
||||
"stateRoot": "0xd883f48b83cc9c1e8389453beb4ad4e572462eec049ca4fffbe16ecefb3fe937",
|
||||
"timestamp": "0x0",
|
||||
"totalDifficulty": "0x1",
|
||||
"transactions": [],
|
||||
|
|
|
|||
|
|
@ -4,22 +4,22 @@
|
|||
"extraData": "0x",
|
||||
"gasLimit": "0x47e7c4",
|
||||
"gasUsed": "0x5208",
|
||||
"hash": "0xda97ed946e0d502fb898b0ac881bd44da3c7fee5eaf184431e1ec3d361dad17e",
|
||||
"hash": "0xedb9ccf3a85f67c095ad48abfb0fa09d47179bb0f902078d289042d12428aca5",
|
||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"nonce": "0x0000000000000000",
|
||||
"number": "0x9",
|
||||
"parentHash": "0x5abd19c39d9f1c6e52998e135ea14e1fbc5db3fa2a108f4538e238ca5c2e68d7",
|
||||
"parentHash": "0xcd7d78eaa8b0ddbd2956fc37e1883c30df27b43e8cc9a982020310656736637c",
|
||||
"receiptsRoot": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
|
||||
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"size": "0x26a",
|
||||
"stateRoot": "0xbd4aa2c2873df709151075250a8c01c9a14d2b0e2f715dbdd16e0ef8030c2cf0",
|
||||
"stateRoot": "0x78b2b19ef1a0276dbbc23a875dbf60ae5d10dafa0017098473c4871abd3e7b5c",
|
||||
"timestamp": "0x5a",
|
||||
"totalDifficulty": "0x1",
|
||||
"transactions": [
|
||||
{
|
||||
"blockHash": "0xda97ed946e0d502fb898b0ac881bd44da3c7fee5eaf184431e1ec3d361dad17e",
|
||||
"blockHash": "0xedb9ccf3a85f67c095ad48abfb0fa09d47179bb0f902078d289042d12428aca5",
|
||||
"blockNumber": "0x9",
|
||||
"from": "0x703c4b2bd70c169f5717101caee543299fc946c7",
|
||||
"gas": "0x5208",
|
||||
|
|
|
|||
|
|
@ -4,17 +4,17 @@
|
|||
"extraData": "0x",
|
||||
"gasLimit": "0x47e7c4",
|
||||
"gasUsed": "0x5208",
|
||||
"hash": "0x97f540a3577c0f645c5dada5da86f38350e8f847e71f21124f917835003e2607",
|
||||
"hash": "0xa063415a5020f1569fae73ecb0d37bc5649ebe86d59e764a389eb37814bd42cb",
|
||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"nonce": "0x0000000000000000",
|
||||
"number": "0xa",
|
||||
"parentHash": "0xda97ed946e0d502fb898b0ac881bd44da3c7fee5eaf184431e1ec3d361dad17e",
|
||||
"parentHash": "0xedb9ccf3a85f67c095ad48abfb0fa09d47179bb0f902078d289042d12428aca5",
|
||||
"receiptsRoot": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
|
||||
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"size": "0x26a",
|
||||
"stateRoot": "0xbb62872e4023fa8a8b17b9cc37031f4817d9595779748d01cba408b495707a91",
|
||||
"stateRoot": "0x118f1433ae23c4d1c12f5bd652baddb72611c55ac1cd6af6620d209db222f9e6",
|
||||
"timestamp": "0x64",
|
||||
"totalDifficulty": "0x1",
|
||||
"transactions": [
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"extraData": "0x",
|
||||
"gasLimit": "0x47e7c4",
|
||||
"gasUsed": "0x0",
|
||||
"hash": "0xbdc7d83b8f876938810462fe8d053263a482e44201e3883d4ae204ff4de7eff5",
|
||||
"hash": "0x98e056de84de969782b238b4509b32814627ba443ea622054a79c2bc7e4d92c7",
|
||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"size": "0x200",
|
||||
"stateRoot": "0xfe168c5e9584a85927212e5bea5304bb7d0d8a893453b4b2c52176a72f585ae2",
|
||||
"stateRoot": "0xd883f48b83cc9c1e8389453beb4ad4e572462eec049ca4fffbe16ecefb3fe937",
|
||||
"timestamp": "0x0",
|
||||
"totalDifficulty": "0x1",
|
||||
"transactions": [],
|
||||
|
|
|
|||
|
|
@ -4,17 +4,17 @@
|
|||
"extraData": "0x",
|
||||
"gasLimit": "0x47e7c4",
|
||||
"gasUsed": "0x5208",
|
||||
"hash": "0x0da274b315de8e4d5bf8717218ec43540464ef36378cb896469bb731e1d3f3cb",
|
||||
"hash": "0xeeb5c1852740ca4bbe65b0f57baf80634ed12a2b44affe30eec3fb54437c3926",
|
||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"nonce": "0x0000000000000000",
|
||||
"number": "0x1",
|
||||
"parentHash": "0xbdc7d83b8f876938810462fe8d053263a482e44201e3883d4ae204ff4de7eff5",
|
||||
"parentHash": "0x98e056de84de969782b238b4509b32814627ba443ea622054a79c2bc7e4d92c7",
|
||||
"receiptsRoot": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
|
||||
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"size": "0x26a",
|
||||
"stateRoot": "0x92c5c55a698963f5b06e3aee415630f5c48b0760e537af94917ce9c4f42a2e22",
|
||||
"stateRoot": "0x4acfcd1a6ab9f5e62411021ecd8a749976ae50b0590e967471264b372d7ac55b",
|
||||
"timestamp": "0xa",
|
||||
"totalDifficulty": "0x1",
|
||||
"transactions": [
|
||||
|
|
|
|||
|
|
@ -4,22 +4,22 @@
|
|||
"extraData": "0x",
|
||||
"gasLimit": "0x47e7c4",
|
||||
"gasUsed": "0x5208",
|
||||
"hash": "0xda97ed946e0d502fb898b0ac881bd44da3c7fee5eaf184431e1ec3d361dad17e",
|
||||
"hash": "0xedb9ccf3a85f67c095ad48abfb0fa09d47179bb0f902078d289042d12428aca5",
|
||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"nonce": "0x0000000000000000",
|
||||
"number": "0x9",
|
||||
"parentHash": "0x5abd19c39d9f1c6e52998e135ea14e1fbc5db3fa2a108f4538e238ca5c2e68d7",
|
||||
"parentHash": "0xcd7d78eaa8b0ddbd2956fc37e1883c30df27b43e8cc9a982020310656736637c",
|
||||
"receiptsRoot": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
|
||||
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"size": "0x26a",
|
||||
"stateRoot": "0xbd4aa2c2873df709151075250a8c01c9a14d2b0e2f715dbdd16e0ef8030c2cf0",
|
||||
"stateRoot": "0x78b2b19ef1a0276dbbc23a875dbf60ae5d10dafa0017098473c4871abd3e7b5c",
|
||||
"timestamp": "0x5a",
|
||||
"totalDifficulty": "0x1",
|
||||
"transactions": [
|
||||
{
|
||||
"blockHash": "0xda97ed946e0d502fb898b0ac881bd44da3c7fee5eaf184431e1ec3d361dad17e",
|
||||
"blockHash": "0xedb9ccf3a85f67c095ad48abfb0fa09d47179bb0f902078d289042d12428aca5",
|
||||
"blockNumber": "0x9",
|
||||
"from": "0x703c4b2bd70c169f5717101caee543299fc946c7",
|
||||
"gas": "0x5208",
|
||||
|
|
|
|||
|
|
@ -4,17 +4,17 @@
|
|||
"extraData": "0x",
|
||||
"gasLimit": "0x47e7c4",
|
||||
"gasUsed": "0x5208",
|
||||
"hash": "0x97f540a3577c0f645c5dada5da86f38350e8f847e71f21124f917835003e2607",
|
||||
"hash": "0xa063415a5020f1569fae73ecb0d37bc5649ebe86d59e764a389eb37814bd42cb",
|
||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"nonce": "0x0000000000000000",
|
||||
"number": "0xa",
|
||||
"parentHash": "0xda97ed946e0d502fb898b0ac881bd44da3c7fee5eaf184431e1ec3d361dad17e",
|
||||
"parentHash": "0xedb9ccf3a85f67c095ad48abfb0fa09d47179bb0f902078d289042d12428aca5",
|
||||
"receiptsRoot": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
|
||||
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"size": "0x26a",
|
||||
"stateRoot": "0xbb62872e4023fa8a8b17b9cc37031f4817d9595779748d01cba408b495707a91",
|
||||
"stateRoot": "0x118f1433ae23c4d1c12f5bd652baddb72611c55ac1cd6af6620d209db222f9e6",
|
||||
"timestamp": "0x64",
|
||||
"totalDifficulty": "0x1",
|
||||
"transactions": [
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
{
|
||||
"blobGasPrice": "0x1",
|
||||
"blobGasUsed": "0x20000",
|
||||
"blockHash": "0xe724dfd4349861f4dceef2bc4df086d0a3d88858214f6bee9fcf1bebd1edc2a6",
|
||||
"blockHash": "0xd1392771155ce83f6403c6af275efd22bed567030c21168fcc9dbad5004eb245",
|
||||
"blockNumber": "0x6",
|
||||
"contractAddress": null,
|
||||
"cumulativeGasUsed": "0x5208",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[
|
||||
{
|
||||
"blockHash": "0x1e7dcf3abe8bf05d32367a5dc387caa32578b15871bf8b3cbeedf2d8d530f844",
|
||||
"blockHash": "0x56ea26cf955d7f2e08e194ad212ca4d5f99ee8e0b19dec3c71d8faafa33b1d22",
|
||||
"blockNumber": "0x2",
|
||||
"contractAddress": "0xae9bea628c4ce503dcfd7e305cab4e29e7476592",
|
||||
"cumulativeGasUsed": "0xcf50",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[
|
||||
{
|
||||
"blockHash": "0xffa737e6ce9a9162ffd411dd06169114b3ed5ee9fc1474a2625c92548e4455e0",
|
||||
"blockHash": "0xf41e7a7a716382f20464cf76c6ae1fa701e9d32f5cc550ebfd2391b9642ae6bc",
|
||||
"blockNumber": "0x4",
|
||||
"contractAddress": null,
|
||||
"cumulativeGasUsed": "0x538d",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[
|
||||
{
|
||||
"blockHash": "0x173dcd9d22ce71929cd17e84ea88702a0f84d6244c6898d2a4f48722e494fe9c",
|
||||
"blockHash": "0xa1410af902e98b32e0bbe464f8637ff464f1d4344b585127d2ce71f9cb39cb8a",
|
||||
"blockNumber": "0x3",
|
||||
"contractAddress": null,
|
||||
"cumulativeGasUsed": "0x5e28",
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
"blockNumber": "0x3",
|
||||
"transactionHash": "0xeaf3921cbf03ba45bad4e6ab807b196ce3b2a0b5bacc355b6272fa96b11b4287",
|
||||
"transactionIndex": "0x0",
|
||||
"blockHash": "0x173dcd9d22ce71929cd17e84ea88702a0f84d6244c6898d2a4f48722e494fe9c",
|
||||
"blockHash": "0xa1410af902e98b32e0bbe464f8637ff464f1d4344b585127d2ce71f9cb39cb8a",
|
||||
"logIndex": "0x0",
|
||||
"removed": false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[
|
||||
{
|
||||
"blockHash": "0xa8a067b3cb3b9ddc6cfb8317bfd08b266fcf9994fc870c1f7ed394acecfadf39",
|
||||
"blockHash": "0x797d0c5603eccb33cc8ebd1300e977746512ec49e6b89087c7aad28ff760a26f",
|
||||
"blockNumber": "0x1",
|
||||
"contractAddress": null,
|
||||
"cumulativeGasUsed": "0x5208",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
{
|
||||
"blobGasPrice": "0x1",
|
||||
"blobGasUsed": "0x20000",
|
||||
"blockHash": "0xe724dfd4349861f4dceef2bc4df086d0a3d88858214f6bee9fcf1bebd1edc2a6",
|
||||
"blockHash": "0xd1392771155ce83f6403c6af275efd22bed567030c21168fcc9dbad5004eb245",
|
||||
"blockNumber": "0x6",
|
||||
"contractAddress": null,
|
||||
"cumulativeGasUsed": "0x5208",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"extraData": "0x",
|
||||
"gasLimit": "0x47e7c4",
|
||||
"gasUsed": "0x0",
|
||||
"hash": "0xbdc7d83b8f876938810462fe8d053263a482e44201e3883d4ae204ff4de7eff5",
|
||||
"hash": "0x98e056de84de969782b238b4509b32814627ba443ea622054a79c2bc7e4d92c7",
|
||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"stateRoot": "0xfe168c5e9584a85927212e5bea5304bb7d0d8a893453b4b2c52176a72f585ae2",
|
||||
"stateRoot": "0xd883f48b83cc9c1e8389453beb4ad4e572462eec049ca4fffbe16ecefb3fe937",
|
||||
"timestamp": "0x0",
|
||||
"totalDifficulty": "0x1",
|
||||
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@
|
|||
"extraData": "0x",
|
||||
"gasLimit": "0x47e7c4",
|
||||
"gasUsed": "0x5208",
|
||||
"hash": "0x0da274b315de8e4d5bf8717218ec43540464ef36378cb896469bb731e1d3f3cb",
|
||||
"hash": "0xeeb5c1852740ca4bbe65b0f57baf80634ed12a2b44affe30eec3fb54437c3926",
|
||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"nonce": "0x0000000000000000",
|
||||
"number": "0x1",
|
||||
"parentHash": "0xbdc7d83b8f876938810462fe8d053263a482e44201e3883d4ae204ff4de7eff5",
|
||||
"parentHash": "0x98e056de84de969782b238b4509b32814627ba443ea622054a79c2bc7e4d92c7",
|
||||
"receiptsRoot": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
|
||||
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"stateRoot": "0x92c5c55a698963f5b06e3aee415630f5c48b0760e537af94917ce9c4f42a2e22",
|
||||
"stateRoot": "0x4acfcd1a6ab9f5e62411021ecd8a749976ae50b0590e967471264b372d7ac55b",
|
||||
"timestamp": "0xa",
|
||||
"totalDifficulty": "0x1",
|
||||
"transactionsRoot": "0xca0ebcce920d2cdfbf9e1dbe90ed3441a1a576f344bd80e60508da814916f4e7"
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@
|
|||
"extraData": "0x",
|
||||
"gasLimit": "0x47e7c4",
|
||||
"gasUsed": "0x5208",
|
||||
"hash": "0xda97ed946e0d502fb898b0ac881bd44da3c7fee5eaf184431e1ec3d361dad17e",
|
||||
"hash": "0xedb9ccf3a85f67c095ad48abfb0fa09d47179bb0f902078d289042d12428aca5",
|
||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"nonce": "0x0000000000000000",
|
||||
"number": "0x9",
|
||||
"parentHash": "0x5abd19c39d9f1c6e52998e135ea14e1fbc5db3fa2a108f4538e238ca5c2e68d7",
|
||||
"parentHash": "0xcd7d78eaa8b0ddbd2956fc37e1883c30df27b43e8cc9a982020310656736637c",
|
||||
"receiptsRoot": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
|
||||
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"stateRoot": "0xbd4aa2c2873df709151075250a8c01c9a14d2b0e2f715dbdd16e0ef8030c2cf0",
|
||||
"stateRoot": "0x78b2b19ef1a0276dbbc23a875dbf60ae5d10dafa0017098473c4871abd3e7b5c",
|
||||
"timestamp": "0x5a",
|
||||
"totalDifficulty": "0x1",
|
||||
"transactionsRoot": "0x0767ed8359337dc6a8fdc77fe52db611bed1be87aac73c4556b1bf1dd3d190a5"
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@
|
|||
"extraData": "0x",
|
||||
"gasLimit": "0x47e7c4",
|
||||
"gasUsed": "0x5208",
|
||||
"hash": "0x97f540a3577c0f645c5dada5da86f38350e8f847e71f21124f917835003e2607",
|
||||
"hash": "0xa063415a5020f1569fae73ecb0d37bc5649ebe86d59e764a389eb37814bd42cb",
|
||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"nonce": "0x0000000000000000",
|
||||
"number": "0xa",
|
||||
"parentHash": "0xda97ed946e0d502fb898b0ac881bd44da3c7fee5eaf184431e1ec3d361dad17e",
|
||||
"parentHash": "0xedb9ccf3a85f67c095ad48abfb0fa09d47179bb0f902078d289042d12428aca5",
|
||||
"receiptsRoot": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
|
||||
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"stateRoot": "0xbb62872e4023fa8a8b17b9cc37031f4817d9595779748d01cba408b495707a91",
|
||||
"stateRoot": "0x118f1433ae23c4d1c12f5bd652baddb72611c55ac1cd6af6620d209db222f9e6",
|
||||
"timestamp": "0x64",
|
||||
"totalDifficulty": "0x1",
|
||||
"transactionsRoot": "0xb0893d21a4a44dc26a962a6e91abae66df87fb61ac9c60e936aee89c76331445"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"extraData": "0x",
|
||||
"gasLimit": "0x47e7c4",
|
||||
"gasUsed": "0x0",
|
||||
"hash": "0xbdc7d83b8f876938810462fe8d053263a482e44201e3883d4ae204ff4de7eff5",
|
||||
"hash": "0x98e056de84de969782b238b4509b32814627ba443ea622054a79c2bc7e4d92c7",
|
||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"stateRoot": "0xfe168c5e9584a85927212e5bea5304bb7d0d8a893453b4b2c52176a72f585ae2",
|
||||
"stateRoot": "0xd883f48b83cc9c1e8389453beb4ad4e572462eec049ca4fffbe16ecefb3fe937",
|
||||
"timestamp": "0x0",
|
||||
"totalDifficulty": "0x1",
|
||||
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@
|
|||
"extraData": "0x",
|
||||
"gasLimit": "0x47e7c4",
|
||||
"gasUsed": "0x5208",
|
||||
"hash": "0x0da274b315de8e4d5bf8717218ec43540464ef36378cb896469bb731e1d3f3cb",
|
||||
"hash": "0xeeb5c1852740ca4bbe65b0f57baf80634ed12a2b44affe30eec3fb54437c3926",
|
||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"nonce": "0x0000000000000000",
|
||||
"number": "0x1",
|
||||
"parentHash": "0xbdc7d83b8f876938810462fe8d053263a482e44201e3883d4ae204ff4de7eff5",
|
||||
"parentHash": "0x98e056de84de969782b238b4509b32814627ba443ea622054a79c2bc7e4d92c7",
|
||||
"receiptsRoot": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
|
||||
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"stateRoot": "0x92c5c55a698963f5b06e3aee415630f5c48b0760e537af94917ce9c4f42a2e22",
|
||||
"stateRoot": "0x4acfcd1a6ab9f5e62411021ecd8a749976ae50b0590e967471264b372d7ac55b",
|
||||
"timestamp": "0xa",
|
||||
"totalDifficulty": "0x1",
|
||||
"transactionsRoot": "0xca0ebcce920d2cdfbf9e1dbe90ed3441a1a576f344bd80e60508da814916f4e7"
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@
|
|||
"extraData": "0x",
|
||||
"gasLimit": "0x47e7c4",
|
||||
"gasUsed": "0x5208",
|
||||
"hash": "0xda97ed946e0d502fb898b0ac881bd44da3c7fee5eaf184431e1ec3d361dad17e",
|
||||
"hash": "0xedb9ccf3a85f67c095ad48abfb0fa09d47179bb0f902078d289042d12428aca5",
|
||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"nonce": "0x0000000000000000",
|
||||
"number": "0x9",
|
||||
"parentHash": "0x5abd19c39d9f1c6e52998e135ea14e1fbc5db3fa2a108f4538e238ca5c2e68d7",
|
||||
"parentHash": "0xcd7d78eaa8b0ddbd2956fc37e1883c30df27b43e8cc9a982020310656736637c",
|
||||
"receiptsRoot": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
|
||||
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"stateRoot": "0xbd4aa2c2873df709151075250a8c01c9a14d2b0e2f715dbdd16e0ef8030c2cf0",
|
||||
"stateRoot": "0x78b2b19ef1a0276dbbc23a875dbf60ae5d10dafa0017098473c4871abd3e7b5c",
|
||||
"timestamp": "0x5a",
|
||||
"totalDifficulty": "0x1",
|
||||
"transactionsRoot": "0x0767ed8359337dc6a8fdc77fe52db611bed1be87aac73c4556b1bf1dd3d190a5"
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@
|
|||
"extraData": "0x",
|
||||
"gasLimit": "0x47e7c4",
|
||||
"gasUsed": "0x5208",
|
||||
"hash": "0x97f540a3577c0f645c5dada5da86f38350e8f847e71f21124f917835003e2607",
|
||||
"hash": "0xa063415a5020f1569fae73ecb0d37bc5649ebe86d59e764a389eb37814bd42cb",
|
||||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"miner": "0x0000000000000000000000000000000000000000",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"nonce": "0x0000000000000000",
|
||||
"number": "0xa",
|
||||
"parentHash": "0xda97ed946e0d502fb898b0ac881bd44da3c7fee5eaf184431e1ec3d361dad17e",
|
||||
"parentHash": "0xedb9ccf3a85f67c095ad48abfb0fa09d47179bb0f902078d289042d12428aca5",
|
||||
"receiptsRoot": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
|
||||
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"stateRoot": "0xbb62872e4023fa8a8b17b9cc37031f4817d9595779748d01cba408b495707a91",
|
||||
"stateRoot": "0x118f1433ae23c4d1c12f5bd652baddb72611c55ac1cd6af6620d209db222f9e6",
|
||||
"timestamp": "0x64",
|
||||
"totalDifficulty": "0x1",
|
||||
"transactionsRoot": "0xb0893d21a4a44dc26a962a6e91abae66df87fb61ac9c60e936aee89c76331445"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"blobGasPrice": "0x1",
|
||||
"blobGasUsed": "0x20000",
|
||||
"blockHash": "0xe724dfd4349861f4dceef2bc4df086d0a3d88858214f6bee9fcf1bebd1edc2a6",
|
||||
"blockHash": "0xd1392771155ce83f6403c6af275efd22bed567030c21168fcc9dbad5004eb245",
|
||||
"blockNumber": "0x6",
|
||||
"contractAddress": null,
|
||||
"cumulativeGasUsed": "0x5208",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"blockHash": "0x1e7dcf3abe8bf05d32367a5dc387caa32578b15871bf8b3cbeedf2d8d530f844",
|
||||
"blockHash": "0x56ea26cf955d7f2e08e194ad212ca4d5f99ee8e0b19dec3c71d8faafa33b1d22",
|
||||
"blockNumber": "0x2",
|
||||
"contractAddress": "0xae9bea628c4ce503dcfd7e305cab4e29e7476592",
|
||||
"cumulativeGasUsed": "0xcf50",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"blockHash": "0x3fadc5bc916018a326732be829a2565b3acb960a8406f0f151a5e1fa971ea7dd",
|
||||
"blockHash": "0x69bf6ba924d95b6c50b0357768e5c892bd1b00cdf2f97e2e81fc06a76dfa57e3",
|
||||
"blockNumber": "0x5",
|
||||
"contractAddress": "0xfdaa97661a584d977b4d3abb5370766ff5b86a18",
|
||||
"cumulativeGasUsed": "0xe01c",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"blockHash": "0xffa737e6ce9a9162ffd411dd06169114b3ed5ee9fc1474a2625c92548e4455e0",
|
||||
"blockHash": "0xf41e7a7a716382f20464cf76c6ae1fa701e9d32f5cc550ebfd2391b9642ae6bc",
|
||||
"blockNumber": "0x4",
|
||||
"contractAddress": null,
|
||||
"cumulativeGasUsed": "0x538d",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"blockHash": "0xa8a067b3cb3b9ddc6cfb8317bfd08b266fcf9994fc870c1f7ed394acecfadf39",
|
||||
"blockHash": "0x797d0c5603eccb33cc8ebd1300e977746512ec49e6b89087c7aad28ff760a26f",
|
||||
"blockNumber": "0x1",
|
||||
"contractAddress": null,
|
||||
"cumulativeGasUsed": "0x5208",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"blockHash": "0x173dcd9d22ce71929cd17e84ea88702a0f84d6244c6898d2a4f48722e494fe9c",
|
||||
"blockHash": "0xa1410af902e98b32e0bbe464f8637ff464f1d4344b585127d2ce71f9cb39cb8a",
|
||||
"blockNumber": "0x3",
|
||||
"contractAddress": null,
|
||||
"cumulativeGasUsed": "0x5e28",
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
"blockNumber": "0x3",
|
||||
"transactionHash": "0xeaf3921cbf03ba45bad4e6ab807b196ce3b2a0b5bacc355b6272fa96b11b4287",
|
||||
"transactionIndex": "0x0",
|
||||
"blockHash": "0x173dcd9d22ce71929cd17e84ea88702a0f84d6244c6898d2a4f48722e494fe9c",
|
||||
"blockHash": "0xa1410af902e98b32e0bbe464f8637ff464f1d4344b585127d2ce71f9cb39cb8a",
|
||||
"logIndex": "0x0",
|
||||
"removed": false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,10 +26,12 @@ import (
|
|||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/consensus/misc/eip4844"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
"github.com/holiman/uint256"
|
||||
)
|
||||
|
||||
// TransactionArgs represents the arguments to construct a new transaction
|
||||
|
|
@ -53,6 +55,10 @@ type TransactionArgs struct {
|
|||
// Introduced by AccessListTxType transaction.
|
||||
AccessList *types.AccessList `json:"accessList,omitempty"`
|
||||
ChainID *hexutil.Big `json:"chainId,omitempty"`
|
||||
|
||||
// Introduced by EIP-4844.
|
||||
BlobFeeCap *hexutil.Big `json:"maxFeePerBlobGas"`
|
||||
BlobHashes []common.Hash `json:"blobVersionedHashes,omitempty"`
|
||||
}
|
||||
|
||||
// from retrieves the transaction sender address.
|
||||
|
|
@ -92,6 +98,12 @@ func (args *TransactionArgs) setDefaults(ctx context.Context, b Backend) error {
|
|||
if args.Data != nil && args.Input != nil && !bytes.Equal(*args.Data, *args.Input) {
|
||||
return errors.New(`both "data" and "input" are set and not equal. Please use "input" to pass transaction call data`)
|
||||
}
|
||||
if args.BlobHashes != nil && args.To == nil {
|
||||
return errors.New(`blob transactions cannot have the form of a create transaction`)
|
||||
}
|
||||
if args.BlobHashes != nil && len(args.BlobHashes) == 0 {
|
||||
return errors.New(`need at least 1 blob for a blob transaction`)
|
||||
}
|
||||
if args.To == nil && len(args.data()) == 0 {
|
||||
return errors.New(`contract creation without any data provided`)
|
||||
}
|
||||
|
|
@ -153,6 +165,10 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend) erro
|
|||
}
|
||||
return nil // No need to set anything, user already set MaxFeePerGas and MaxPriorityFeePerGas
|
||||
}
|
||||
// Sanity check the EIP-4844 fee parameters.
|
||||
if args.BlobFeeCap != nil && args.BlobFeeCap.ToInt().Sign() == 0 {
|
||||
return errors.New("maxFeePerBlobGas must be non-zero")
|
||||
}
|
||||
// Sanity check the non-EIP-1559 fee parameters.
|
||||
head := b.CurrentHeader()
|
||||
isLondon := b.ChainConfig().IsLondon(head.Number)
|
||||
|
|
@ -165,14 +181,21 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend) erro
|
|||
}
|
||||
|
||||
// Now attempt to fill in default value depending on whether London is active or not.
|
||||
if isLondon {
|
||||
if b.ChainConfig().IsCancun(head.Number, head.Time) {
|
||||
if err := args.setCancunFeeDefaults(ctx, head, b); err != nil {
|
||||
return err
|
||||
}
|
||||
} else if isLondon {
|
||||
if args.BlobFeeCap != nil {
|
||||
return errors.New("maxFeePerBlobGas is not valid before Cancun is active")
|
||||
}
|
||||
// London is active, set maxPriorityFeePerGas and maxFeePerGas.
|
||||
if err := args.setLondonFeeDefaults(ctx, head, b); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil {
|
||||
return errors.New("maxFeePerGas and maxPriorityFeePerGas are not valid before London is active")
|
||||
if args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil || args.BlobFeeCap != nil {
|
||||
return errors.New("maxFeePerGas and maxPriorityFeePerGas and maxFeePerBlobGas are not valid before London is active")
|
||||
}
|
||||
// London not active, set gas price.
|
||||
price, err := b.SuggestGasTipCap(ctx)
|
||||
|
|
@ -184,6 +207,21 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend) erro
|
|||
return nil
|
||||
}
|
||||
|
||||
// setCancunFeeDefaults fills in reasonable default fee values for unspecified fields.
|
||||
func (args *TransactionArgs) setCancunFeeDefaults(ctx context.Context, head *types.Header, b Backend) error {
|
||||
// Set maxFeePerBlobGas if it is missing.
|
||||
if args.BlobHashes != nil && args.BlobFeeCap == nil {
|
||||
// ExcessBlobGas must be set for a Cancun block.
|
||||
blobBaseFee := eip4844.CalcBlobFee(*head.ExcessBlobGas)
|
||||
// Set the max fee to be 2 times larger than the previous block's blob base fee.
|
||||
// The additional slack allows the tx to not become invalidated if the base
|
||||
// fee is rising.
|
||||
val := new(big.Int).Mul(blobBaseFee, big.NewInt(2))
|
||||
args.BlobFeeCap = (*hexutil.Big)(val)
|
||||
}
|
||||
return args.setLondonFeeDefaults(ctx, head, b)
|
||||
}
|
||||
|
||||
// setLondonFeeDefaults fills in reasonable default fee values for unspecified fields.
|
||||
func (args *TransactionArgs) setLondonFeeDefaults(ctx context.Context, head *types.Header, b Backend) error {
|
||||
// Set maxPriorityFeePerGas if it is missing.
|
||||
|
|
@ -236,9 +274,10 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (*
|
|||
gas = globalGasCap
|
||||
}
|
||||
var (
|
||||
gasPrice *big.Int
|
||||
gasFeeCap *big.Int
|
||||
gasTipCap *big.Int
|
||||
gasPrice *big.Int
|
||||
gasFeeCap *big.Int
|
||||
gasTipCap *big.Int
|
||||
blobFeeCap *big.Int
|
||||
)
|
||||
if baseFee == nil {
|
||||
// If there's no basefee, then it must be a non-1559 execution
|
||||
|
|
@ -270,6 +309,11 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (*
|
|||
}
|
||||
}
|
||||
}
|
||||
if args.BlobFeeCap != nil {
|
||||
blobFeeCap = args.BlobFeeCap.ToInt()
|
||||
} else if args.BlobHashes != nil {
|
||||
blobFeeCap = new(big.Int)
|
||||
}
|
||||
value := new(big.Int)
|
||||
if args.Value != nil {
|
||||
value = args.Value.ToInt()
|
||||
|
|
@ -289,6 +333,8 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (*
|
|||
GasTipCap: gasTipCap,
|
||||
Data: data,
|
||||
AccessList: accessList,
|
||||
BlobGasFeeCap: blobFeeCap,
|
||||
BlobHashes: args.BlobHashes,
|
||||
SkipAccountChecks: true,
|
||||
}
|
||||
return msg, nil
|
||||
|
|
@ -299,6 +345,24 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (*
|
|||
func (args *TransactionArgs) toTransaction() *types.Transaction {
|
||||
var data types.TxData
|
||||
switch {
|
||||
case args.BlobHashes != nil:
|
||||
al := types.AccessList{}
|
||||
if args.AccessList != nil {
|
||||
al = *args.AccessList
|
||||
}
|
||||
data = &types.BlobTx{
|
||||
To: *args.To,
|
||||
ChainID: uint256.MustFromBig((*big.Int)(args.ChainID)),
|
||||
Nonce: uint64(*args.Nonce),
|
||||
Gas: uint64(*args.Gas),
|
||||
GasFeeCap: uint256.MustFromBig((*big.Int)(args.MaxFeePerGas)),
|
||||
GasTipCap: uint256.MustFromBig((*big.Int)(args.MaxPriorityFeePerGas)),
|
||||
Value: uint256.MustFromBig((*big.Int)(args.Value)),
|
||||
Data: args.data(),
|
||||
AccessList: al,
|
||||
BlobHashes: args.BlobHashes,
|
||||
BlobFeeCap: uint256.MustFromBig((*big.Int)(args.BlobFeeCap)),
|
||||
}
|
||||
case args.MaxFeePerGas != nil:
|
||||
al := types.AccessList{}
|
||||
if args.AccessList != nil {
|
||||
|
|
@ -344,3 +408,8 @@ func (args *TransactionArgs) toTransaction() *types.Transaction {
|
|||
func (args *TransactionArgs) ToTransaction() *types.Transaction {
|
||||
return args.toTransaction()
|
||||
}
|
||||
|
||||
// IsEIP4844 returns an indicator if the args contains EIP4844 fields.
|
||||
func (args *TransactionArgs) IsEIP4844() bool {
|
||||
return args.BlobHashes != nil || args.BlobFeeCap != nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ import (
|
|||
// TestSetFeeDefaults tests the logic for filling in default fee values works as expected.
|
||||
func TestSetFeeDefaults(t *testing.T) {
|
||||
type test struct {
|
||||
name string
|
||||
isLondon bool
|
||||
in *TransactionArgs
|
||||
want *TransactionArgs
|
||||
err error
|
||||
name string
|
||||
fork string // options: legacy, london, cancun
|
||||
in *TransactionArgs
|
||||
want *TransactionArgs
|
||||
err error
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
@ -62,28 +62,28 @@ func TestSetFeeDefaults(t *testing.T) {
|
|||
// Legacy txs
|
||||
{
|
||||
"legacy tx pre-London",
|
||||
false,
|
||||
"legacy",
|
||||
&TransactionArgs{},
|
||||
&TransactionArgs{GasPrice: fortytwo},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"legacy tx pre-London with zero price",
|
||||
false,
|
||||
"legacy",
|
||||
&TransactionArgs{GasPrice: zero},
|
||||
&TransactionArgs{GasPrice: zero},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"legacy tx post-London, explicit gas price",
|
||||
true,
|
||||
"london",
|
||||
&TransactionArgs{GasPrice: fortytwo},
|
||||
&TransactionArgs{GasPrice: fortytwo},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"legacy tx post-London with zero price",
|
||||
true,
|
||||
"london",
|
||||
&TransactionArgs{GasPrice: zero},
|
||||
nil,
|
||||
errors.New("gasPrice must be non-zero after london fork"),
|
||||
|
|
@ -92,35 +92,35 @@ func TestSetFeeDefaults(t *testing.T) {
|
|||
// Access list txs
|
||||
{
|
||||
"access list tx pre-London",
|
||||
false,
|
||||
"legacy",
|
||||
&TransactionArgs{AccessList: al},
|
||||
&TransactionArgs{AccessList: al, GasPrice: fortytwo},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"access list tx post-London, explicit gas price",
|
||||
false,
|
||||
"legacy",
|
||||
&TransactionArgs{AccessList: al, GasPrice: fortytwo},
|
||||
&TransactionArgs{AccessList: al, GasPrice: fortytwo},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"access list tx post-London",
|
||||
true,
|
||||
"london",
|
||||
&TransactionArgs{AccessList: al},
|
||||
&TransactionArgs{AccessList: al, MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"access list tx post-London, only max fee",
|
||||
true,
|
||||
"london",
|
||||
&TransactionArgs{AccessList: al, MaxFeePerGas: maxFee},
|
||||
&TransactionArgs{AccessList: al, MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"access list tx post-London, only priority fee",
|
||||
true,
|
||||
"london",
|
||||
&TransactionArgs{AccessList: al, MaxFeePerGas: maxFee},
|
||||
&TransactionArgs{AccessList: al, MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
||||
nil,
|
||||
|
|
@ -129,56 +129,56 @@ func TestSetFeeDefaults(t *testing.T) {
|
|||
// Dynamic fee txs
|
||||
{
|
||||
"dynamic tx post-London",
|
||||
true,
|
||||
"london",
|
||||
&TransactionArgs{},
|
||||
&TransactionArgs{MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"dynamic tx post-London, only max fee",
|
||||
true,
|
||||
"london",
|
||||
&TransactionArgs{MaxFeePerGas: maxFee},
|
||||
&TransactionArgs{MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"dynamic tx post-London, only priority fee",
|
||||
true,
|
||||
"london",
|
||||
&TransactionArgs{MaxFeePerGas: maxFee},
|
||||
&TransactionArgs{MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"dynamic fee tx pre-London, maxFee set",
|
||||
false,
|
||||
"legacy",
|
||||
&TransactionArgs{MaxFeePerGas: maxFee},
|
||||
nil,
|
||||
errors.New("maxFeePerGas and maxPriorityFeePerGas are not valid before London is active"),
|
||||
errors.New("maxFeePerGas and maxPriorityFeePerGas and maxFeePerBlobGas are not valid before London is active"),
|
||||
},
|
||||
{
|
||||
"dynamic fee tx pre-London, priorityFee set",
|
||||
false,
|
||||
"legacy",
|
||||
&TransactionArgs{MaxPriorityFeePerGas: fortytwo},
|
||||
nil,
|
||||
errors.New("maxFeePerGas and maxPriorityFeePerGas are not valid before London is active"),
|
||||
errors.New("maxFeePerGas and maxPriorityFeePerGas and maxFeePerBlobGas are not valid before London is active"),
|
||||
},
|
||||
{
|
||||
"dynamic fee tx, maxFee < priorityFee",
|
||||
true,
|
||||
"london",
|
||||
&TransactionArgs{MaxFeePerGas: maxFee, MaxPriorityFeePerGas: (*hexutil.Big)(big.NewInt(1000))},
|
||||
nil,
|
||||
errors.New("maxFeePerGas (0x3e) < maxPriorityFeePerGas (0x3e8)"),
|
||||
},
|
||||
{
|
||||
"dynamic fee tx, maxFee < priorityFee while setting default",
|
||||
true,
|
||||
"london",
|
||||
&TransactionArgs{MaxFeePerGas: (*hexutil.Big)(big.NewInt(7))},
|
||||
nil,
|
||||
errors.New("maxFeePerGas (0x7) < maxPriorityFeePerGas (0x2a)"),
|
||||
},
|
||||
{
|
||||
"dynamic fee tx post-London, explicit gas price",
|
||||
true,
|
||||
"london",
|
||||
&TransactionArgs{MaxFeePerGas: zero, MaxPriorityFeePerGas: zero},
|
||||
nil,
|
||||
errors.New("maxFeePerGas must be non-zero"),
|
||||
|
|
@ -187,33 +187,60 @@ func TestSetFeeDefaults(t *testing.T) {
|
|||
// Misc
|
||||
{
|
||||
"set all fee parameters",
|
||||
false,
|
||||
"legacy",
|
||||
&TransactionArgs{GasPrice: fortytwo, MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
||||
nil,
|
||||
errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified"),
|
||||
},
|
||||
{
|
||||
"set gas price and maxPriorityFee",
|
||||
false,
|
||||
"legacy",
|
||||
&TransactionArgs{GasPrice: fortytwo, MaxPriorityFeePerGas: fortytwo},
|
||||
nil,
|
||||
errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified"),
|
||||
},
|
||||
{
|
||||
"set gas price and maxFee",
|
||||
true,
|
||||
"london",
|
||||
&TransactionArgs{GasPrice: fortytwo, MaxFeePerGas: maxFee},
|
||||
nil,
|
||||
errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified"),
|
||||
},
|
||||
// EIP-4844
|
||||
{
|
||||
"set maxFeePerBlobGas pre cancun",
|
||||
"london",
|
||||
&TransactionArgs{BlobFeeCap: fortytwo},
|
||||
nil,
|
||||
errors.New("maxFeePerBlobGas is not valid before Cancun is active"),
|
||||
},
|
||||
{
|
||||
"set maxFeePerBlobGas pre london",
|
||||
"legacy",
|
||||
&TransactionArgs{BlobFeeCap: fortytwo},
|
||||
nil,
|
||||
errors.New("maxFeePerGas and maxPriorityFeePerGas and maxFeePerBlobGas are not valid before London is active"),
|
||||
},
|
||||
{
|
||||
"set gas price and maxFee for blob transaction",
|
||||
"cancun",
|
||||
&TransactionArgs{GasPrice: fortytwo, MaxFeePerGas: maxFee, BlobHashes: []common.Hash{}},
|
||||
nil,
|
||||
errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified"),
|
||||
},
|
||||
{
|
||||
"fill maxFeePerBlobGas",
|
||||
"cancun",
|
||||
&TransactionArgs{BlobHashes: []common.Hash{}},
|
||||
&TransactionArgs{BlobHashes: []common.Hash{}, BlobFeeCap: (*hexutil.Big)(big.NewInt(4)), MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
|
||||
nil,
|
||||
},
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
for i, test := range tests {
|
||||
if test.isLondon {
|
||||
b.activateLondon()
|
||||
} else {
|
||||
b.deactivateLondon()
|
||||
if err := b.setFork(test.fork); err != nil {
|
||||
t.Fatalf("failed to set fork: %v", err)
|
||||
}
|
||||
got := test.in
|
||||
err := got.setFeeDefaults(ctx, b)
|
||||
|
|
@ -235,6 +262,7 @@ type backendMock struct {
|
|||
}
|
||||
|
||||
func newBackendMock() *backendMock {
|
||||
var cancunTime uint64 = 600
|
||||
config := ¶ms.ChainConfig{
|
||||
ChainID: big.NewInt(42),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
|
|
@ -250,6 +278,7 @@ func newBackendMock() *backendMock {
|
|||
MuirGlacierBlock: big.NewInt(0),
|
||||
BerlinBlock: big.NewInt(0),
|
||||
LondonBlock: big.NewInt(1000),
|
||||
CancunTime: &cancunTime,
|
||||
}
|
||||
return &backendMock{
|
||||
current: &types.Header{
|
||||
|
|
@ -265,13 +294,25 @@ func newBackendMock() *backendMock {
|
|||
}
|
||||
}
|
||||
|
||||
func (b *backendMock) activateLondon() {
|
||||
b.current.Number = big.NewInt(1100)
|
||||
func (b *backendMock) setFork(fork string) error {
|
||||
if fork == "legacy" {
|
||||
b.current.Number = big.NewInt(900)
|
||||
b.current.Time = 555
|
||||
} else if fork == "london" {
|
||||
b.current.Number = big.NewInt(1100)
|
||||
b.current.Time = 555
|
||||
} else if fork == "cancun" {
|
||||
b.current.Number = big.NewInt(1100)
|
||||
b.current.Time = 700
|
||||
// Blob base fee will be 2
|
||||
excess := uint64(2314058)
|
||||
b.current.ExcessBlobGas = &excess
|
||||
} else {
|
||||
return errors.New("invalid fork")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *backendMock) deactivateLondon() {
|
||||
b.current.Number = big.NewInt(900)
|
||||
}
|
||||
func (b *backendMock) SuggestGasTipCap(ctx context.Context) (*big.Int, error) {
|
||||
return big.NewInt(42), nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,19 +52,19 @@ func TestBuildPayload(t *testing.T) {
|
|||
verify := func(outer *engine.ExecutionPayloadEnvelope, txs int) {
|
||||
payload := outer.ExecutionPayload
|
||||
if payload.ParentHash != b.chain.CurrentBlock().Hash() {
|
||||
t.Fatal("Unexpect parent hash")
|
||||
t.Fatal("Unexpected parent hash")
|
||||
}
|
||||
if payload.Random != (common.Hash{}) {
|
||||
t.Fatal("Unexpect random value")
|
||||
t.Fatal("Unexpected random value")
|
||||
}
|
||||
if payload.Timestamp != timestamp {
|
||||
t.Fatal("Unexpect timestamp")
|
||||
t.Fatal("Unexpected timestamp")
|
||||
}
|
||||
if payload.FeeRecipient != recipient {
|
||||
t.Fatal("Unexpect fee recipient")
|
||||
t.Fatal("Unexpected fee recipient")
|
||||
}
|
||||
if len(payload.Transactions) != txs {
|
||||
t.Fatal("Unexpect transaction set")
|
||||
t.Fatal("Unexpected transaction set")
|
||||
}
|
||||
}
|
||||
empty := payload.ResolveEmpty()
|
||||
|
|
|
|||
|
|
@ -243,6 +243,36 @@ var (
|
|||
Clique: nil,
|
||||
}
|
||||
|
||||
// MergedTestChainConfig contains every protocol change (EIPs) introduced
|
||||
// and accepted by the Ethereum core developers for testing purposes.
|
||||
MergedTestChainConfig = &ChainConfig{
|
||||
ChainID: big.NewInt(1),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
DAOForkBlock: nil,
|
||||
DAOForkSupport: false,
|
||||
EIP150Block: big.NewInt(0),
|
||||
EIP155Block: big.NewInt(0),
|
||||
EIP158Block: big.NewInt(0),
|
||||
ByzantiumBlock: big.NewInt(0),
|
||||
ConstantinopleBlock: big.NewInt(0),
|
||||
PetersburgBlock: big.NewInt(0),
|
||||
IstanbulBlock: big.NewInt(0),
|
||||
MuirGlacierBlock: big.NewInt(0),
|
||||
BerlinBlock: big.NewInt(0),
|
||||
LondonBlock: big.NewInt(0),
|
||||
ArrowGlacierBlock: big.NewInt(0),
|
||||
GrayGlacierBlock: big.NewInt(0),
|
||||
MergeNetsplitBlock: big.NewInt(0),
|
||||
ShanghaiTime: newUint64(0),
|
||||
CancunTime: newUint64(0),
|
||||
PragueTime: nil,
|
||||
VerkleTime: nil,
|
||||
TerminalTotalDifficulty: big.NewInt(0),
|
||||
TerminalTotalDifficultyPassed: true,
|
||||
Ethash: new(EthashConfig),
|
||||
Clique: nil,
|
||||
}
|
||||
|
||||
// NonActivatedConfig defines the chain configuration without activating
|
||||
// any protocol change (EIPs).
|
||||
NonActivatedConfig = &ChainConfig{
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
"github.com/ethereum/go-ethereum/trie"
|
||||
|
|
@ -224,6 +225,7 @@ func (t *BlockTest) insertBlocks(blockchain *core.BlockChain) ([]btBlock, error)
|
|||
cb, err := b.decode()
|
||||
if err != nil {
|
||||
if b.BlockHeader == nil {
|
||||
log.Info("Block decoding failed", "index", bi, "err", err)
|
||||
continue // OK - block is supposed to be invalid, continue with next block
|
||||
} else {
|
||||
return nil, fmt.Errorf("block RLP decoding failed when expected to succeed: %v", err)
|
||||
|
|
|
|||
|
|
@ -62,14 +62,6 @@ func TestState(t *testing.T) {
|
|||
// EOF is not part of cancun
|
||||
st.skipLoad(`^stEOF/`)
|
||||
|
||||
// EIP-4844 tests need to be regenerated due to the data-to-blob rename
|
||||
st.skipLoad(`^stEIP4844-blobtransactions/`)
|
||||
|
||||
// Expected failures:
|
||||
// These EIP-4844 tests need to be regenerated.
|
||||
st.fails(`stEIP4844-blobtransactions/opcodeBlobhashOutOfRange.json`, "test has incorrect state root")
|
||||
st.fails(`stEIP4844-blobtransactions/opcodeBlobhBounds.json`, "test has incorrect state root")
|
||||
|
||||
// For Istanbul, older tests were moved into LegacyTests
|
||||
for _, dir := range []string{
|
||||
filepath.Join(baseDir, "EIPTests", "StateTests"),
|
||||
|
|
|
|||
|
|
@ -291,6 +291,17 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh
|
|||
}
|
||||
evm := vm.NewEVM(context, txContext, statedb, config, vmconfig)
|
||||
|
||||
{ // Blob transactions may be present after the Cancun fork.
|
||||
// In production,
|
||||
// - the header is verified against the max in eip4844.go:VerifyEIP4844Header
|
||||
// - the block body is verified against the header in block_validator.go:ValidateBody
|
||||
// Here, we just do this shortcut smaller fix, since state tests do not
|
||||
// utilize those codepaths
|
||||
if len(msg.BlobHashes)*params.BlobTxBlobGasPerBlob > params.MaxBlobGasPerBlock {
|
||||
return nil, nil, nil, common.Hash{}, errors.New("blob gas exceeds maximum")
|
||||
}
|
||||
}
|
||||
|
||||
// Execute the message.
|
||||
snapshot := statedb.Snapshot()
|
||||
gaspool := new(core.GasPool)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit ee3fa4c86d05f99f2717f83a6ad08008490ddf07
|
||||
Subproject commit fa51c5c164f79140730ccb8fe26a46c3d3994338
|
||||
Loading…
Reference in a new issue