mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-31 04:01:55 +00:00
cleanup, drop ClearBase
This commit is contained in:
@@ -807,7 +807,7 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
|
||||
permFlag := tx.SNative.PermFlag()
|
||||
// check permission
|
||||
if !hasSNativePermission(blockCache, inAcc, permFlag) {
|
||||
return fmt.Errorf("Account %X does not have permission to call snative %s (%b)", tx.Input.Address, tx.SNative, permFlag)
|
||||
return fmt.Errorf("Account %X does not have permission to call snative %s (%b)", tx.Input.Address, ptypes.SNativePermFlagToString(permFlag), permFlag)
|
||||
}
|
||||
|
||||
// pubKey should be present in either "inAcc" or "tx.Input"
|
||||
@@ -843,11 +843,9 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
|
||||
err = permAcc.Permissions.Base.Unset(args.Permission)
|
||||
case *ptypes.SetGlobalArgs:
|
||||
if permAcc = blockCache.GetAccount(ptypes.GlobalPermissionsAddress); permAcc == nil {
|
||||
// PanicSanity("can't find global permissions account")
|
||||
PanicSanity("can't find global permissions account")
|
||||
}
|
||||
err = permAcc.Permissions.Base.Set(args.Permission, args.Value)
|
||||
case *ptypes.ClearBaseArgs:
|
||||
//
|
||||
case *ptypes.HasRoleArgs:
|
||||
return fmt.Errorf("HasRole is for contracts, not humans. Just look at the blockchain")
|
||||
case *ptypes.AddRoleArgs:
|
||||
@@ -865,7 +863,7 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
|
||||
return fmt.Errorf("Role (%s) does not exist for account %X", args.Role, args.Address)
|
||||
}
|
||||
default:
|
||||
// PanicSanity("invalid snative")
|
||||
PanicSanity(Fmt("invalid snative: %s", ptypes.SNativePermFlagToString(permFlag)))
|
||||
}
|
||||
|
||||
// TODO: maybe we want to take funds on error and allow txs in that don't do anythingi?
|
||||
|
@@ -836,6 +836,9 @@ func TestCreateAccountPermission(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
// holla at my boy
|
||||
var DougAddress = append([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, []byte("THISISDOUG")...)
|
||||
|
||||
func TestSNativeCALL(t *testing.T) {
|
||||
stateDB := dbm.GetDB("state")
|
||||
genDoc := newBaseGenDoc(PermsAllFalse, PermsAllFalse)
|
||||
@@ -851,7 +854,7 @@ func TestSNativeCALL(t *testing.T) {
|
||||
|
||||
// make the main contract once
|
||||
doug := &acm.Account{
|
||||
Address: ptypes.DougAddress,
|
||||
Address: DougAddress,
|
||||
Balance: 0,
|
||||
Code: nil,
|
||||
Sequence: 0,
|
||||
@@ -925,9 +928,6 @@ func TestSNativeCALL(t *testing.T) {
|
||||
return nil
|
||||
})
|
||||
|
||||
// ClearBase
|
||||
// TODO
|
||||
|
||||
fmt.Println("\n#### HasRole")
|
||||
// HasRole
|
||||
snativeAddress, data = snativeRoleTestInputCALL("HasRole", user[3], "bumble")
|
||||
@@ -1022,9 +1022,6 @@ func TestSNativeTx(t *testing.T) {
|
||||
t.Fatal("expected permission to be set true")
|
||||
}
|
||||
|
||||
// ClearBase
|
||||
// TODO
|
||||
|
||||
fmt.Println("\n#### AddRole")
|
||||
// AddRole
|
||||
snativeArgs = snativeRoleTestInputTx("AddRole", user[3], "chuck")
|
||||
@@ -1184,7 +1181,6 @@ func snativePermTestInputCALL(name string, user *acm.PrivAccount, perm ptypes.Pe
|
||||
case "SetGlobal":
|
||||
data = Uint64ToWord256(uint64(perm)).Bytes()
|
||||
data = append(data, boolToWord256(val).Bytes()...)
|
||||
case "ClearBase":
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -1199,7 +1195,6 @@ func snativePermTestInputTx(name string, user *acm.PrivAccount, perm ptypes.Perm
|
||||
snativeArgs = &ptypes.SetBaseArgs{user.Address, perm, val}
|
||||
case "SetGlobal":
|
||||
snativeArgs = &ptypes.SetGlobalArgs{perm, val}
|
||||
case "ClearBase":
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user