mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-13 13:21:20 +00:00
fixes for develop+permissions merge
This commit is contained in:
@ -28,6 +28,12 @@ func (w Word256) Compare(other Word256) int {
|
||||
return bytes.Compare(w[:], other[:])
|
||||
}
|
||||
|
||||
func Uint64ToWord256(i uint64) Word256 {
|
||||
buf := [8]byte{}
|
||||
PutUint64BE(buf[:], i)
|
||||
return LeftPadWord256(buf[:])
|
||||
}
|
||||
|
||||
func Int64ToWord256(i int64) Word256 {
|
||||
buf := [8]byte{}
|
||||
PutInt64BE(buf[:], i)
|
||||
@ -44,6 +50,11 @@ func LeftPadWord256(bz []byte) (word Word256) {
|
||||
return
|
||||
}
|
||||
|
||||
func Uint64FromWord256(word Word256) uint64 {
|
||||
buf := word.Postfix(8)
|
||||
return GetUint64BE(buf)
|
||||
}
|
||||
|
||||
func Int64FromWord256(word Word256) int64 {
|
||||
buf := word.Postfix(8)
|
||||
return GetInt64BE(buf)
|
||||
|
@ -3,6 +3,7 @@ package state
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/tendermint/tendermint/account"
|
||||
. "github.com/tendermint/tendermint/common"
|
||||
|
@ -24,19 +24,19 @@ var GenDocKey = []byte("GenDocKey")
|
||||
|
||||
type BasicAccount struct {
|
||||
Address []byte `json:"address"`
|
||||
Amount uint64 `json:"amount"`
|
||||
Amount int64 `json:"amount"`
|
||||
}
|
||||
|
||||
type GenesisAccount struct {
|
||||
Address []byte `json:"address"`
|
||||
Amount uint64 `json:"amount"`
|
||||
Amount int64 `json:"amount"`
|
||||
Name string `json:"name"`
|
||||
Permissions *ptypes.AccountPermissions `json:"permissions"`
|
||||
}
|
||||
|
||||
type GenesisValidator struct {
|
||||
PubKey account.PubKeyEd25519 `json:"pub_key"`
|
||||
Amount uint64 `json:"amount"`
|
||||
Amount int64 `json:"amount"`
|
||||
Name string `json:"name"`
|
||||
UnbondTo []BasicAccount `json:"unbond_to"`
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ var send1, name1, call1 = 1, 1, 0
|
||||
var perms, setbit = 66, 70
|
||||
var accName = "me"
|
||||
var roles1 = []string{"master", "universal-ruler"}
|
||||
var amt1 uint64 = 1000000
|
||||
var amt1 int64 = 1000000
|
||||
var g1 = fmt.Sprintf(`
|
||||
{
|
||||
"chain_id":"%s",
|
||||
|
@ -478,7 +478,7 @@ func TestCreatePermission(t *testing.T) {
|
||||
t.Fatal("Transaction failed", err)
|
||||
}
|
||||
// ensure the contract is there
|
||||
contractAddr := NewContractAddress(tx.Input.Address, uint64(tx.Input.Sequence))
|
||||
contractAddr := NewContractAddress(tx.Input.Address, tx.Input.Sequence)
|
||||
contractAcc := blockCache.GetAccount(contractAddr)
|
||||
if contractAcc == nil {
|
||||
t.Fatalf("failed to create contract %X", contractAddr)
|
||||
@ -503,7 +503,7 @@ func TestCreatePermission(t *testing.T) {
|
||||
t.Fatal("Transaction failed", err)
|
||||
}
|
||||
// ensure the contract is there
|
||||
contractAddr = NewContractAddress(tx.Input.Address, uint64(tx.Input.Sequence))
|
||||
contractAddr = NewContractAddress(tx.Input.Address, tx.Input.Sequence)
|
||||
contractAcc = blockCache.GetAccount(contractAddr)
|
||||
if contractAcc == nil {
|
||||
t.Fatalf("failed to create contract %X", contractAddr)
|
||||
|
@ -254,8 +254,8 @@ func (s *State) releaseValidator(val *Validator) {
|
||||
s.SetValidatorInfo(valInfo)
|
||||
|
||||
// Send coins back to UnbondTo outputs
|
||||
// SANITY CHECK
|
||||
accounts, err := getOrMakeOutputs(s, nil, valInfo.UnbondTo)
|
||||
// SANITY CHECK
|
||||
if err != nil {
|
||||
panic("Couldn't get or make unbondTo accounts")
|
||||
}
|
||||
|
Reference in New Issue
Block a user