fixed test case

pull/4065/head
haodi 3 years ago
parent 3316a1d8b5
commit 781ea91200
  1. 12
      core/evm_test.go

@ -69,7 +69,7 @@ func TestEVMStaking(t *testing.T) {
// createValidator test // createValidator test
createValidator := sampleCreateValidator(*key) createValidator := sampleCreateValidator(*key)
err := ctx.CreateValidator(db, &createValidator) err := ctx.CreateValidator(db, nil, &createValidator)
if err != nil { if err != nil {
t.Errorf("Got error %v in CreateValidator", err) t.Errorf("Got error %v in CreateValidator", err)
} }
@ -88,7 +88,7 @@ func TestEVMStaking(t *testing.T) {
// editValidator test // editValidator test
editValidator := sampleEditValidator(*key) editValidator := sampleEditValidator(*key)
editValidator.SlotKeyToRemove = &createValidator.SlotPubKeys[0] editValidator.SlotKeyToRemove = &createValidator.SlotPubKeys[0]
err = ctx.EditValidator(db, &editValidator) err = ctx.EditValidator(db, nil, &editValidator)
if err != nil { if err != nil {
t.Errorf("Got error %v in EditValidator", err) t.Errorf("Got error %v in EditValidator", err)
} }
@ -106,14 +106,14 @@ func TestEVMStaking(t *testing.T) {
// redelegate using epoch1, so that we can cover the locked tokens use case as well // redelegate using epoch1, so that we can cover the locked tokens use case as well
ctx2 := NewEVMContext(msg, blockfactory.ForTest.NewHeader(common.Big1), chain, nil) ctx2 := NewEVMContext(msg, blockfactory.ForTest.NewHeader(common.Big1), chain, nil)
err = db.UpdateValidatorWrapper(wrapper.Address, wrapper) err = db.UpdateValidatorWrapper(wrapper.Address, wrapper)
err = ctx2.Delegate(db, &delegate) err = ctx2.Delegate(db, nil, &delegate)
if err != nil { if err != nil {
t.Errorf("Got error %v in Delegate", err) t.Errorf("Got error %v in Delegate", err)
} }
// undelegate test // undelegate test
undelegate := sampleUndelegate(*key) undelegate := sampleUndelegate(*key)
err = ctx.Undelegate(db, &undelegate) err = ctx.Undelegate(db, nil, &undelegate)
if err != nil { if err != nil {
t.Errorf("Got error %v in Undelegate", err) t.Errorf("Got error %v in Undelegate", err)
} }
@ -124,7 +124,7 @@ func TestEVMStaking(t *testing.T) {
wrapper.Delegations[0].Undelegations = []staking.Undelegation{} wrapper.Delegations[0].Undelegations = []staking.Undelegation{}
wrapper.Delegations[0].Reward = common.Big257 wrapper.Delegations[0].Reward = common.Big257
db.UpdateValidatorWrapper(wrapper.Address, wrapper) db.UpdateValidatorWrapper(wrapper.Address, wrapper)
err = ctx.CollectRewards(db, &collectRewards) err = ctx.CollectRewards(db, nil, &collectRewards)
if err != nil { if err != nil {
t.Errorf("Got error %v in CollectRewards", err) t.Errorf("Got error %v in CollectRewards", err)
} }
@ -453,7 +453,7 @@ func TestWriteCapablePrecompilesIntegration(t *testing.T) {
// now add a validator, and send its address as caller // now add a validator, and send its address as caller
createValidator := sampleCreateValidator(*key) createValidator := sampleCreateValidator(*key)
err = ctx.CreateValidator(db, &createValidator) err = ctx.CreateValidator(db, nil, &createValidator)
_, _, err = evm.Call(vm.AccountRef(common.Address{}), _, _, err = evm.Call(vm.AccountRef(common.Address{}),
createValidator.ValidatorAddress, createValidator.ValidatorAddress,
[]byte{}, []byte{},

Loading…
Cancel
Save