[log] More log (#1958)

pull/1959/head
Edgar Aroutiounian 5 years ago committed by GitHub
parent 242a1a99ac
commit 67f2e4f57f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      internal/chain/engine.go
  2. 7
      shard/committee/assignment.go
  3. 2
      staking/types/messages.go

@ -6,6 +6,7 @@ import (
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/rlp"
"github.com/harmony-one/bls/ffi/go/bls"
"github.com/harmony-one/harmony/block"
@ -175,7 +176,15 @@ func (e *engineImpl) VerifyShardState(bc engine.ChainReader, beacon engine.Chain
if err != nil {
headerSS = shard.State{}
}
return ctxerror.New("[VerifyShardState] ShardState is Invalid", "shardStateEpoch", shardState.Epoch, "headerEpoch", header.Epoch(), "headerShardStateEpoch", headerSS.Epoch, "beaconEpoch", beacon.CurrentHeader().Epoch())
utils.Logger().Error().
Str("shard-state", hexutil.Encode(shardStateBytes)).
Str("header-shard-state", hexutil.Encode(headerShardStateBytes)).
Msg("Shard states did not match, use rlpdump to inspect")
return ctxerror.New(
"[VerifyShardState] ShardState is Invalid", "shardStateEpoch", shardState.Epoch, "headerEpoch",
header.Epoch(), "headerShardStateEpoch", headerSS.Epoch, "beaconEpoch",
beacon.CurrentHeader().Epoch(),
)
}
return nil

@ -10,6 +10,7 @@ import (
shardingconfig "github.com/harmony-one/harmony/internal/configs/sharding"
"github.com/harmony-one/harmony/internal/params"
"github.com/harmony-one/harmony/internal/utils"
"github.com/harmony-one/harmony/numeric"
"github.com/harmony-one/harmony/shard"
"github.com/harmony-one/harmony/staking/effective"
staking "github.com/harmony-one/harmony/staking/types"
@ -178,20 +179,26 @@ func eposStakedCommittee(
stakedSlotsCount = l
}
totalStake := numeric.ZeroDec()
for i := 0; i < stakedSlotsCount; i++ {
shardID := int(new(big.Int).Mod(staked[i].BlsPublicKey.Big(), shardBig).Int64())
slot := staked[i]
totalStake = totalStake.Add(slot.Dec)
shardState.Shards[shardID].Slots = append(shardState.Shards[shardID].Slots, shard.Slot{
slot.Address,
staked[i].BlsPublicKey,
&slot.Dec,
})
}
if c := len(candidates); c != 0 {
utils.Logger().Info().Int("staked-candidates", c).
Str("total-staked-by-validators", totalStake.String()).
RawJSON("staked-super-committee", []byte(shardState.JSON())).
Msg("EPoS based super-committe")
}
return shardState, nil
}

@ -60,7 +60,7 @@ type CreateValidator struct {
MinSelfDelegation *big.Int `json:"min_self_delegation" yaml:"min_self_delegation"`
MaxTotalDelegation *big.Int `json:"max_total_delegation" yaml:"max_total_delegation"`
SlotPubKeys []shard.BlsPublicKey `json:"slot_pub_keys" yaml:"slot_pub_keys"`
SlotKeySigs []shard.BlsSignature `json:"slot_key_sigs" yarml:"slot_key_sigs"`
SlotKeySigs []shard.BlsSignature `json:"slot_key_sigs" yaml:"slot_key_sigs"`
Amount *big.Int `json:"amount" yaml:"amount"`
}

Loading…
Cancel
Save