mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-03 16:37:39 +00:00
0326be86b5
* starting on patch * finish determining all required patches * properly redefine the patch rules * new patch * rem double semicolon * fix patch file * Merge branch 'master' of github.com:prysmaticlabs/prysm into deprecate-eth-protos * building the deps * test target passes using ethereumapis * compile gateway * attempting to build everything * e2e use ethereumapis * more fixes for slasher * other item * getting closer to compiling slasher * build slasher package * Merge branch 'master' into deprecate-eth-protos * Merge branch 'master' into deprecate-eth-protos * fix benches * lint gazelle * Merge branch 'deprecate-eth-protos' of github.com:prysmaticlabs/prysm into deprecate-eth-protos * proper gateway * lint * Merge branch 'master' into deprecate-eth-protos * fix build * Merge branch 'deprecate-eth-protos' of github.com:prysmaticlabs/prysm into deprecate-eth-protos * use swag * resolve * ignore change * include new patch changes * fix test * builds * fix e2e * gaz
50 lines
1.1 KiB
Go
50 lines
1.1 KiB
Go
package kv
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/gogo/protobuf/proto"
|
|
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
|
"github.com/prysmaticlabs/go-ssz"
|
|
)
|
|
|
|
func TestStore_VoluntaryExits_CRUD(t *testing.T) {
|
|
db := setupDB(t)
|
|
defer teardownDB(t, db)
|
|
ctx := context.Background()
|
|
exit := ðpb.VoluntaryExit{
|
|
Epoch: 5,
|
|
}
|
|
exitRoot, err := ssz.SigningRoot(exit)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
retrieved, err := db.VoluntaryExit(ctx, exitRoot)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if retrieved != nil {
|
|
t.Errorf("Expected nil voluntary exit, received %v", retrieved)
|
|
}
|
|
if err := db.SaveVoluntaryExit(ctx, exit); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !db.HasVoluntaryExit(ctx, exitRoot) {
|
|
t.Error("Expected voluntary exit to exist in the db")
|
|
}
|
|
retrieved, err = db.VoluntaryExit(ctx, exitRoot)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !proto.Equal(exit, retrieved) {
|
|
t.Errorf("Wanted %v, received %v", exit, retrieved)
|
|
}
|
|
if err := db.DeleteVoluntaryExit(ctx, exitRoot); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if db.HasVoluntaryExit(ctx, exitRoot) {
|
|
t.Error("Expected voluntary exit to have been deleted from the db")
|
|
}
|
|
}
|