mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-25 01:09:28 +00:00
cleanup
This commit is contained in:
parent
58819e6ba0
commit
f7ed82b12c
2 changed files with 23 additions and 9 deletions
|
|
@ -81,6 +81,5 @@ func ExecuteStateless(ctx context.Context, config *params.ChainConfig, vmconfig
|
|||
// Almost everything validated, but receipt and state root needs to be returned
|
||||
receiptRoot := types.DeriveSha(res.Receipts, trie.NewStackTrie(nil))
|
||||
stateRoot := db.IntermediateRoot(config.IsEIP158(block.Number()))
|
||||
|
||||
return stateRoot, receiptRoot, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1690,17 +1690,26 @@ func TestWitnessCreationAndConsumption(t *testing.T) {
|
|||
t.Fatalf("witness missing from payload")
|
||||
}
|
||||
// Test stateless execution of the created witness
|
||||
wantStateRoot := envelope.ExecutionPayload.StateRoot
|
||||
wantReceiptRoot := envelope.ExecutionPayload.ReceiptsRoot
|
||||
|
||||
envelope.ExecutionPayload.StateRoot = common.Hash{}
|
||||
envelope.ExecutionPayload.ReceiptsRoot = common.Hash{}
|
||||
|
||||
res, err := api.ExecuteStatelessPayloadV3(*envelope.ExecutionPayload, []common.Hash{}, &common.Hash{42}, *envelope.Witness)
|
||||
if err != nil {
|
||||
t.Fatalf("error executing stateless payload witness: %v", err)
|
||||
}
|
||||
if res.StateRoot != envelope.ExecutionPayload.StateRoot {
|
||||
t.Fatalf("stateless state root mismatch: have %v, want %v", res.StateRoot, envelope.ExecutionPayload.StateRoot)
|
||||
if res.StateRoot != wantStateRoot {
|
||||
t.Fatalf("stateless state root mismatch: have %v, want %v", res.StateRoot, wantStateRoot)
|
||||
}
|
||||
if res.ReceiptsRoot != envelope.ExecutionPayload.ReceiptsRoot {
|
||||
t.Fatalf("stateless receipt root mismatch: have %v, want %v", res.ReceiptsRoot, envelope.ExecutionPayload.ReceiptsRoot)
|
||||
if res.ReceiptsRoot != wantReceiptRoot {
|
||||
t.Fatalf("stateless receipt root mismatch: have %v, want %v", res.ReceiptsRoot, wantReceiptRoot)
|
||||
}
|
||||
// Test block insertion with witness creation
|
||||
envelope.ExecutionPayload.StateRoot = wantStateRoot
|
||||
envelope.ExecutionPayload.ReceiptsRoot = wantReceiptRoot
|
||||
|
||||
res2, err := api.NewPayloadWithWitnessV3(context.Background(), *envelope.ExecutionPayload, []common.Hash{}, &common.Hash{42})
|
||||
if err != nil {
|
||||
t.Fatalf("error executing stateless payload witness: %v", err)
|
||||
|
|
@ -1709,15 +1718,21 @@ func TestWitnessCreationAndConsumption(t *testing.T) {
|
|||
t.Fatalf("witness missing from payload")
|
||||
}
|
||||
// Test stateless execution of the created witness
|
||||
wantStateRoot = envelope.ExecutionPayload.StateRoot
|
||||
wantReceiptRoot = envelope.ExecutionPayload.ReceiptsRoot
|
||||
|
||||
envelope.ExecutionPayload.StateRoot = common.Hash{}
|
||||
envelope.ExecutionPayload.ReceiptsRoot = common.Hash{}
|
||||
|
||||
res, err = api.ExecuteStatelessPayloadV3(*envelope.ExecutionPayload, []common.Hash{}, &common.Hash{42}, *res2.Witness)
|
||||
if err != nil {
|
||||
t.Fatalf("error executing stateless payload witness: %v", err)
|
||||
}
|
||||
if res.StateRoot != envelope.ExecutionPayload.StateRoot {
|
||||
t.Fatalf("stateless state root mismatch: have %v, want %v", res.StateRoot, envelope.ExecutionPayload.StateRoot)
|
||||
if res.StateRoot != wantStateRoot {
|
||||
t.Fatalf("stateless state root mismatch: have %v, want %v", res.StateRoot, wantStateRoot)
|
||||
}
|
||||
if res.ReceiptsRoot != envelope.ExecutionPayload.ReceiptsRoot {
|
||||
t.Fatalf("stateless receipt root mismatch: have %v, want %v", res.ReceiptsRoot, envelope.ExecutionPayload.ReceiptsRoot)
|
||||
if res.ReceiptsRoot != wantReceiptRoot {
|
||||
t.Fatalf("stateless receipt root mismatch: have %v, want %v", res.ReceiptsRoot, wantReceiptRoot)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue