mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Revert "ethclient: add empty/nonexist account testcase for eth_getProof RPC (#28482)"
This reverts commit 2fc1dfc877.
This commit is contained in:
parent
1fbe009995
commit
5a02597caf
1 changed files with 2 additions and 44 deletions
|
|
@ -42,7 +42,6 @@ var (
|
||||||
testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
||||||
testAddr = crypto.PubkeyToAddress(testKey.PublicKey)
|
testAddr = crypto.PubkeyToAddress(testKey.PublicKey)
|
||||||
testContract = common.HexToAddress("0xbeef")
|
testContract = common.HexToAddress("0xbeef")
|
||||||
testEmpty = common.HexToAddress("0xeeee")
|
|
||||||
testSlot = common.HexToHash("0xdeadbeef")
|
testSlot = common.HexToHash("0xdeadbeef")
|
||||||
testValue = crypto.Keccak256Hash(testSlot[:])
|
testValue = crypto.Keccak256Hash(testSlot[:])
|
||||||
testBalance = big.NewInt(2e15)
|
testBalance = big.NewInt(2e15)
|
||||||
|
|
@ -81,11 +80,8 @@ func newTestBackend(t *testing.T) (*node.Node, []*types.Block) {
|
||||||
func generateTestChain() (*core.Genesis, []*types.Block) {
|
func generateTestChain() (*core.Genesis, []*types.Block) {
|
||||||
genesis := &core.Genesis{
|
genesis := &core.Genesis{
|
||||||
Config: params.AllEthashProtocolChanges,
|
Config: params.AllEthashProtocolChanges,
|
||||||
Alloc: core.GenesisAlloc{
|
Alloc: core.GenesisAlloc{testAddr: {Balance: testBalance, Storage: map[common.Hash]common.Hash{testSlot: testValue}},
|
||||||
testAddr: {Balance: testBalance, Storage: map[common.Hash]common.Hash{testSlot: testValue}},
|
testContract: {Nonce: 1, Code: []byte{0x13, 0x37}}},
|
||||||
testContract: {Nonce: 1, Code: []byte{0x13, 0x37}},
|
|
||||||
testEmpty: {Balance: big.NewInt(1)},
|
|
||||||
},
|
|
||||||
ExtraData: []byte("test genesis"),
|
ExtraData: []byte("test genesis"),
|
||||||
Timestamp: 9000,
|
Timestamp: 9000,
|
||||||
}
|
}
|
||||||
|
|
@ -114,12 +110,6 @@ func TestGethClient(t *testing.T) {
|
||||||
}, {
|
}, {
|
||||||
"TestGetProof2",
|
"TestGetProof2",
|
||||||
func(t *testing.T) { testGetProof(t, client, testContract) },
|
func(t *testing.T) { testGetProof(t, client, testContract) },
|
||||||
}, {
|
|
||||||
"TestGetProofEmpty",
|
|
||||||
func(t *testing.T) { testGetProof(t, client, testEmpty) },
|
|
||||||
}, {
|
|
||||||
"TestGetProofNonExistent",
|
|
||||||
func(t *testing.T) { testGetProofNonExistent(t, client) },
|
|
||||||
}, {
|
}, {
|
||||||
"TestGetProofCanonicalizeKeys",
|
"TestGetProofCanonicalizeKeys",
|
||||||
func(t *testing.T) { testGetProofCanonicalizeKeys(t, client) },
|
func(t *testing.T) { testGetProofCanonicalizeKeys(t, client) },
|
||||||
|
|
@ -284,38 +274,6 @@ func testGetProofCanonicalizeKeys(t *testing.T, client *rpc.Client) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testGetProofNonExistent(t *testing.T, client *rpc.Client) {
|
|
||||||
addr := common.HexToAddress("0x0001")
|
|
||||||
ec := New(client)
|
|
||||||
result, err := ec.GetProof(context.Background(), addr, nil, nil)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if result.Address != addr {
|
|
||||||
t.Fatalf("unexpected address, have: %v want: %v", result.Address, addr)
|
|
||||||
}
|
|
||||||
// test nonce
|
|
||||||
if result.Nonce != 0 {
|
|
||||||
t.Fatalf("invalid nonce, want: %v got: %v", 0, result.Nonce)
|
|
||||||
}
|
|
||||||
// test balance
|
|
||||||
if result.Balance.Cmp(big.NewInt(0)) != 0 {
|
|
||||||
t.Fatalf("invalid balance, want: %v got: %v", 0, result.Balance)
|
|
||||||
}
|
|
||||||
// test storage
|
|
||||||
if have := len(result.StorageProof); have != 0 {
|
|
||||||
t.Fatalf("invalid storage proof, want 0 proof, got %v proof(s)", have)
|
|
||||||
}
|
|
||||||
// test codeHash
|
|
||||||
if have, want := result.CodeHash, (common.Hash{}); have != want {
|
|
||||||
t.Fatalf("codehash wrong, have %v want %v ", have, want)
|
|
||||||
}
|
|
||||||
// test codeHash
|
|
||||||
if have, want := result.StorageHash, (common.Hash{}); have != want {
|
|
||||||
t.Fatalf("storagehash wrong, have %v want %v ", have, want)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func testGCStats(t *testing.T, client *rpc.Client) {
|
func testGCStats(t *testing.T, client *rpc.Client) {
|
||||||
ec := New(client)
|
ec := New(client)
|
||||||
_, err := ec.GCStats(context.Background())
|
_, err := ec.GCStats(context.Background())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue