Merge branch 'ethereum:master' into master

This commit is contained in:
juga1980 2025-07-14 11:30:28 +02:00 committed by GitHub
commit 09f1a2ed61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 16 additions and 13 deletions

View file

@ -17,7 +17,7 @@
// Package keystore implements encrypted storage of secp256k1 private keys. // Package keystore implements encrypted storage of secp256k1 private keys.
// //
// Keys are stored as encrypted JSON files according to the Web3 Secret Storage specification. // Keys are stored as encrypted JSON files according to the Web3 Secret Storage specification.
// See https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition for more information. // See https://ethereum.org/en/developers/docs/data-structures-and-encoding/web3-secret-storage/ for more information.
package keystore package keystore
import ( import (

View file

@ -19,7 +19,7 @@
This key store behaves as KeyStorePlain with the difference that This key store behaves as KeyStorePlain with the difference that
the private key is encrypted and on disk uses another JSON encoding. the private key is encrypted and on disk uses another JSON encoding.
The crypto is documented at https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition The crypto is documented at https://ethereum.org/en/developers/docs/data-structures-and-encoding/web3-secret-storage/
*/ */

View file

@ -48,12 +48,11 @@ var (
testSlot = common.HexToHash("0xdeadbeef") testSlot = common.HexToHash("0xdeadbeef")
testValue = crypto.Keccak256Hash(testSlot[:]) testValue = crypto.Keccak256Hash(testSlot[:])
testBalance = big.NewInt(2e15) testBalance = big.NewInt(2e15)
testTxHashes []common.Hash
) )
func newTestBackend(t *testing.T) (*node.Node, []*types.Block) { func newTestBackend(t *testing.T) (*node.Node, []*types.Block, []common.Hash) {
// Generate test chain. // Generate test chain.
genesis, blocks := generateTestChain() genesis, blocks, txHashes := generateTestChain()
// Create node // Create node
n, err := node.New(&node.Config{ n, err := node.New(&node.Config{
HTTPModules: []string{"debug", "eth", "admin"}, HTTPModules: []string{"debug", "eth", "admin"},
@ -82,10 +81,10 @@ func newTestBackend(t *testing.T) (*node.Node, []*types.Block) {
if _, err := ethservice.BlockChain().InsertChain(blocks[1:]); err != nil { if _, err := ethservice.BlockChain().InsertChain(blocks[1:]); err != nil {
t.Fatalf("can't import test blocks: %v", err) t.Fatalf("can't import test blocks: %v", err)
} }
return n, blocks return n, blocks, txHashes
} }
func generateTestChain() (*core.Genesis, []*types.Block) { func generateTestChain() (*core.Genesis, []*types.Block, []common.Hash) {
genesis := &core.Genesis{ genesis := &core.Genesis{
Config: params.AllEthashProtocolChanges, Config: params.AllEthashProtocolChanges,
Alloc: types.GenesisAlloc{ Alloc: types.GenesisAlloc{
@ -96,6 +95,7 @@ func generateTestChain() (*core.Genesis, []*types.Block) {
ExtraData: []byte("test genesis"), ExtraData: []byte("test genesis"),
Timestamp: 9000, Timestamp: 9000,
} }
txHashes := make([]common.Hash, 0)
generate := func(i int, g *core.BlockGen) { generate := func(i int, g *core.BlockGen) {
g.OffsetTime(5) g.OffsetTime(5)
g.SetExtra([]byte("test")) g.SetExtra([]byte("test"))
@ -111,15 +111,15 @@ func generateTestChain() (*core.Genesis, []*types.Block) {
}) })
tx, _ = types.SignTx(tx, types.LatestSignerForChainID(genesis.Config.ChainID), testKey) tx, _ = types.SignTx(tx, types.LatestSignerForChainID(genesis.Config.ChainID), testKey)
g.AddTx(tx) g.AddTx(tx)
testTxHashes = append(testTxHashes, tx.Hash()) txHashes = append(txHashes, tx.Hash())
} }
_, blocks, _ := core.GenerateChainWithGenesis(genesis, ethash.NewFaker(), 1, generate) _, blocks, _ := core.GenerateChainWithGenesis(genesis, ethash.NewFaker(), 1, generate)
blocks = append([]*types.Block{genesis.ToBlock()}, blocks...) blocks = append([]*types.Block{genesis.ToBlock()}, blocks...)
return genesis, blocks return genesis, blocks, txHashes
} }
func TestGethClient(t *testing.T) { func TestGethClient(t *testing.T) {
backend, _ := newTestBackend(t) backend, _, txHashes := newTestBackend(t)
client := backend.Attach() client := backend.Attach()
defer backend.Close() defer backend.Close()
defer client.Close() defer client.Close()
@ -172,7 +172,7 @@ func TestGethClient(t *testing.T) {
}, },
{ {
"TestTraceTransaction", "TestTraceTransaction",
func(t *testing.T) { testTraceTransactions(t, client) }, func(t *testing.T) { testTraceTransactions(t, client, txHashes) },
}, },
{ {
"TestSetHead", "TestSetHead",
@ -480,9 +480,9 @@ func testCallContract(t *testing.T, client *rpc.Client) {
} }
} }
func testTraceTransactions(t *testing.T, client *rpc.Client) { func testTraceTransactions(t *testing.T, client *rpc.Client, txHashes []common.Hash) {
ec := New(client) ec := New(client)
for _, txHash := range testTxHashes { for _, txHash := range txHashes {
// Struct logger // Struct logger
_, err := ec.TraceTransaction(context.Background(), txHash, nil) _, err := ec.TraceTransaction(context.Background(), txHash, nil)
if err != nil { if err != nil {

View file

@ -150,6 +150,9 @@ func (args *SendTxArgs) ToTransaction() (*types.Transaction, error) {
if args.AccessList != nil { if args.AccessList != nil {
al = *args.AccessList al = *args.AccessList
} }
if to == nil {
return nil, fmt.Errorf("transaction recipient must be set for blob transactions")
}
data = &types.BlobTx{ data = &types.BlobTx{
To: *to, To: *to,
ChainID: uint256.MustFromBig((*big.Int)(args.ChainID)), ChainID: uint256.MustFromBig((*big.Int)(args.ChainID)),