DERO-HE STARGATE Testnet Release31
This commit is contained in:
parent
b98d31ed18
commit
484639b7b9
@ -42,7 +42,7 @@ type MiniBlock struct {
|
|||||||
Final bool // bit 5
|
Final bool // bit 5
|
||||||
PastCount uint8 // previous count // bits 6,7
|
PastCount uint8 // previous count // bits 6,7
|
||||||
|
|
||||||
Timestamp uint16 // can represent time from first block
|
Timestamp uint16 // represents rolling time
|
||||||
Height uint64 // 5 bytes serialized in 5 bytes,
|
Height uint64 // 5 bytes serialized in 5 bytes,
|
||||||
|
|
||||||
Past [2]uint32 // 8 bytes used to build DAG of miniblocks and prevent number of attacks
|
Past [2]uint32 // 8 bytes used to build DAG of miniblocks and prevent number of attacks
|
||||||
|
@ -820,7 +820,7 @@ func (chain *Blockchain) Add_Complete_Block(cbl *block.Complete_Block) (err erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we will directly use graviton to mov in to history
|
// we will directly use graviton to mov in to history
|
||||||
logger.V(3).Info("Full order data", "full_order", full_order, "base_topo_index", base_topo_index)
|
logger.V(1).Info("Full order data", "full_order", full_order, "base_topo_index", base_topo_index)
|
||||||
|
|
||||||
if base_topo_index < 0 {
|
if base_topo_index < 0 {
|
||||||
logger.Error(nil, "negative base topo, not possible, probably disk corruption or core issue")
|
logger.Error(nil, "negative base topo, not possible, probably disk corruption or core issue")
|
||||||
@ -880,7 +880,7 @@ func (chain *Blockchain) Add_Complete_Block(cbl *block.Complete_Block) (err erro
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.V(3).Info("reading block snapshot", "blid", full_order[i-1], "i", i, "record_version", record_version)
|
logger.V(1).Info("reading block snapshot", "blid", full_order[i-1], "i", i, "record_version", record_version)
|
||||||
|
|
||||||
ss, err = chain.Store.Balance_store.LoadSnapshot(record_version)
|
ss, err = chain.Store.Balance_store.LoadSnapshot(record_version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -987,12 +987,12 @@ func (chain *Blockchain) Add_Complete_Block(cbl *block.Complete_Block) (err erro
|
|||||||
chain.StoreBlock(bl_current, commit_version)
|
chain.StoreBlock(bl_current, commit_version)
|
||||||
topos_written = true
|
topos_written = true
|
||||||
chain.Store.Topo_store.Write(current_topo_block, full_order[i], commit_version, chain.Load_Block_Height(full_order[i]))
|
chain.Store.Topo_store.Write(current_topo_block, full_order[i], commit_version, chain.Load_Block_Height(full_order[i]))
|
||||||
if logger.V(3).Enabled() {
|
if logger.V(1).Enabled() {
|
||||||
merkle_root, err := chain.Load_Merkle_Hash(commit_version)
|
merkle_root, err := chain.Load_Merkle_Hash(commit_version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
logger.V(3).Info("storing topo", "i", i, "blid", full_order[i].String(), "topoheight", current_topo_block, "commit_version", commit_version, "committed_merkle", merkle_root)
|
logger.V(1).Info("storing topo", "i", i, "blid", full_order[i].String(), "topoheight", current_topo_block, "commit_version", commit_version, "committed_merkle", merkle_root)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1024,7 +1024,7 @@ func (chain *Blockchain) Add_Complete_Block(cbl *block.Complete_Block) (err erro
|
|||||||
|
|
||||||
for i := range tips {
|
for i := range tips {
|
||||||
tip_height := int64(chain.Load_Height_for_BL_ID(tips[i]))
|
tip_height := int64(chain.Load_Height_for_BL_ID(tips[i]))
|
||||||
if (chain_height - tip_height) < 2 {
|
if (chain_height - tip_height) == 0 {
|
||||||
|
|
||||||
new_tips[tips[i]] = tips[i]
|
new_tips[tips[i]] = tips[i]
|
||||||
} else { // this should be a rare event, unless network has very high latency
|
} else { // this should be a rare event, unless network has very high latency
|
||||||
|
@ -352,11 +352,7 @@ func ConvertBlockToMiniblock(bl block.Block, miniblock_miner_address rpc.Address
|
|||||||
mbl.Height = bl.Height
|
mbl.Height = bl.Height
|
||||||
|
|
||||||
timestamp := uint64(globals.Time().UTC().UnixMilli())
|
timestamp := uint64(globals.Time().UTC().UnixMilli())
|
||||||
diff := timestamp - bl.Timestamp
|
mbl.Timestamp = uint16(timestamp) // this will help us better understand network conditions
|
||||||
mbl.Timestamp = 0xffff
|
|
||||||
if diff > 0xffff {
|
|
||||||
mbl.Timestamp = 0xffff
|
|
||||||
}
|
|
||||||
|
|
||||||
mbl.PastCount = byte(len(bl.Tips))
|
mbl.PastCount = byte(len(bl.Tips))
|
||||||
for i := range bl.Tips {
|
for i := range bl.Tips {
|
||||||
|
@ -158,8 +158,9 @@ func (chain *Blockchain) execute_sc_function(w_sc_tree *Tree_Wrapper, data_tree
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
signer, err := extract_signer(&tx)
|
signer, err := extract_signer(&tx)
|
||||||
if err != nil {
|
if err != nil { // allow anonymous SC transactions with condition that SC will not call Signer
|
||||||
return
|
// this allows anonymous voting and numerous other applications
|
||||||
|
// otherwise SC receives signer as all zeroes
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup block hash, height, topoheight correctly
|
// setup block hash, height, topoheight correctly
|
||||||
|
@ -550,6 +550,7 @@ func (chain *Blockchain) process_transaction_sc(cache map[crypto.Hash]*graviton.
|
|||||||
func extract_signer(tx *transaction.Transaction) (signer [33]byte, err error) {
|
func extract_signer(tx *transaction.Transaction) (signer [33]byte, err error) {
|
||||||
for t := range tx.Payloads {
|
for t := range tx.Payloads {
|
||||||
if uint64(len(tx.Payloads[t].Statement.Publickeylist_compressed)) != tx.Payloads[t].Statement.RingSize {
|
if uint64(len(tx.Payloads[t].Statement.Publickeylist_compressed)) != tx.Payloads[t].Statement.RingSize {
|
||||||
|
panic("tx is not expanded")
|
||||||
return signer, fmt.Errorf("tx is not expanded")
|
return signer, fmt.Errorf("tx is not expanded")
|
||||||
}
|
}
|
||||||
if tx.Payloads[t].SCID.IsZero() && tx.Payloads[t].Statement.RingSize == 2 {
|
if tx.Payloads[t].SCID.IsZero() && tx.Payloads[t].Statement.RingSize == 2 {
|
||||||
|
@ -518,6 +518,44 @@ func readline_loop(l *readline.Instance, chain *blockchain.Blockchain, logger lo
|
|||||||
|
|
||||||
case command == "print_tree": // prints entire block chain tree
|
case command == "print_tree": // prints entire block chain tree
|
||||||
//WriteBlockChainTree(chain, "/tmp/graph.dot")
|
//WriteBlockChainTree(chain, "/tmp/graph.dot")
|
||||||
|
case command == "install_block":
|
||||||
|
var hash crypto.Hash
|
||||||
|
|
||||||
|
if len(line_parts) == 2 && len(line_parts[1]) == 64 {
|
||||||
|
bl_raw, err := hex.DecodeString(strings.ToLower(line_parts[1]))
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("err while decoding blid err %s\n", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
copy(hash[:32], []byte(bl_raw))
|
||||||
|
} else {
|
||||||
|
fmt.Printf("install_block needs a single block id as argument\n")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
var bl block.Block
|
||||||
|
var cbl *block.Complete_Block
|
||||||
|
|
||||||
|
if block_data, err := os.ReadFile(fmt.Sprintf("/tmp/blocks/%s", hash)); err == nil {
|
||||||
|
|
||||||
|
if err = bl.Deserialize(block_data); err != nil { // we should deserialize the block here
|
||||||
|
logger.Error(err, "fError deserialiing block, block id %x len(data) %d data %x", hash[:], len(block_data), block_data, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
cbl = &block.Complete_Block{Bl: &bl}
|
||||||
|
} else {
|
||||||
|
fmt.Printf("err reading block %s\n", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// bl, err := chain.Load_BL_FROM_ID(hash)
|
||||||
|
// if err != nil {
|
||||||
|
// fmt.Printf("Err %s\n", err)
|
||||||
|
// }
|
||||||
|
|
||||||
|
err, _ = chain.Add_Complete_Block(cbl)
|
||||||
|
fmt.Printf("err adding block %s\n", err)
|
||||||
|
|
||||||
case command == "print_block":
|
case command == "print_block":
|
||||||
|
|
||||||
@ -661,7 +699,7 @@ func readline_loop(l *readline.Instance, chain *blockchain.Blockchain, logger lo
|
|||||||
if supply > (1000000 * 1000000000000) {
|
if supply > (1000000 * 1000000000000) {
|
||||||
supply -= (1000000 * 1000000000000) // remove premine
|
supply -= (1000000 * 1000000000000) // remove premine
|
||||||
}
|
}
|
||||||
fmt.Printf("Network %s Height %d NW Hashrate %0.03f MH/sec TH %s Peers %d inc, %d out MEMPOOL size %d REGPOOL %d Total Supply %s DERO \n", globals.Config.Name, chain.Get_Height(), float64(chain.Get_Network_HashRate())/1000000.0, chain.Get_Top_ID(), inc, out, mempool_tx_count, regpool_tx_count, globals.FormatMoney(supply))
|
fmt.Printf("Network %s Height %d NW Hashrate %0.03f MH/sec Peers %d inc, %d out MEMPOOL size %d REGPOOL %d Total Supply %s DERO \n", globals.Config.Name, chain.Get_Height(), float64(chain.Get_Network_HashRate())/1000000.0, inc, out, mempool_tx_count, regpool_tx_count, globals.FormatMoney(supply))
|
||||||
if chain.LocatePruneTopo() >= 1 {
|
if chain.LocatePruneTopo() >= 1 {
|
||||||
fmt.Printf("Chain is pruned till %d\n", chain.LocatePruneTopo())
|
fmt.Printf("Chain is pruned till %d\n", chain.LocatePruneTopo())
|
||||||
} else {
|
} else {
|
||||||
@ -670,6 +708,14 @@ func readline_loop(l *readline.Instance, chain *blockchain.Blockchain, logger lo
|
|||||||
fmt.Printf("Integrator address %s\n", chain.IntegratorAddress().String())
|
fmt.Printf("Integrator address %s\n", chain.IntegratorAddress().String())
|
||||||
fmt.Printf("UTC time %s (as per system clock) \n", time.Now().UTC())
|
fmt.Printf("UTC time %s (as per system clock) \n", time.Now().UTC())
|
||||||
fmt.Printf("UTC time %s (offset %s) (as per daemon) should be close to 0\n", globals.Time().UTC(), time.Now().Sub(globals.Time()))
|
fmt.Printf("UTC time %s (offset %s) (as per daemon) should be close to 0\n", globals.Time().UTC(), time.Now().Sub(globals.Time()))
|
||||||
|
fmt.Printf("Local time %s (as per system clock) \n", time.Now())
|
||||||
|
fmt.Printf("Local time %s (offset %s) (as per daemon) should be close to 0\n", globals.Time(), time.Now().Sub(globals.Time()))
|
||||||
|
tips := chain.Get_TIPS()
|
||||||
|
fmt.Printf("Tips ")
|
||||||
|
for _, tip := range tips {
|
||||||
|
fmt.Printf(" %s(%d)", tip, chain.Load_Height_for_BL_ID(tip))
|
||||||
|
}
|
||||||
|
fmt.Printf("\n")
|
||||||
|
|
||||||
// print hardfork status on second line
|
// print hardfork status on second line
|
||||||
hf_state, _, _, threshold, version, votes, window := chain.Get_HF_info()
|
hf_state, _, _, threshold, version, votes, window := chain.Get_HF_info()
|
||||||
|
@ -103,7 +103,7 @@ var Mainnet = CHAIN_CONFIG{Name: "mainnet",
|
|||||||
}
|
}
|
||||||
|
|
||||||
var Testnet = CHAIN_CONFIG{Name: "testnet", // testnet will always have last 3 bytes 0
|
var Testnet = CHAIN_CONFIG{Name: "testnet", // testnet will always have last 3 bytes 0
|
||||||
Network_ID: uuid.FromBytesOrNil([]byte{0x59, 0xd7, 0xf7, 0xe9, 0xdd, 0x48, 0xd5, 0xfd, 0x13, 0x0a, 0xf6, 0xe0, 0x72, 0x00, 0x00, 0x00}),
|
Network_ID: uuid.FromBytesOrNil([]byte{0x59, 0xd7, 0xf7, 0xe9, 0xdd, 0x48, 0xd5, 0xfd, 0x13, 0x0a, 0xf6, 0xe0, 0x73, 0x00, 0x00, 0x00}),
|
||||||
P2P_Default_Port: 40401,
|
P2P_Default_Port: 40401,
|
||||||
RPC_Default_Port: 40402,
|
RPC_Default_Port: 40402,
|
||||||
Wallet_RPC_Default_Port: 40403,
|
Wallet_RPC_Default_Port: 40403,
|
||||||
|
@ -20,4 +20,4 @@ import "github.com/blang/semver/v4"
|
|||||||
|
|
||||||
// right now it has to be manually changed
|
// right now it has to be manually changed
|
||||||
// do we need to include git commitsha??
|
// do we need to include git commitsha??
|
||||||
var Version = semver.MustParse("3.4.91-1.DEROHE.STARGATE+25112021")
|
var Version = semver.MustParse("3.4.92-1.DEROHE.STARGATE+25112021")
|
||||||
|
@ -56,34 +56,35 @@ const MAX_CLOCK_DATA_SET = 16
|
|||||||
|
|
||||||
// This structure is used to do book keeping for the connection and keeps other DATA related to peer
|
// This structure is used to do book keeping for the connection and keeps other DATA related to peer
|
||||||
// golang restricts 64 bit uint64/int atomic on a 64 bit boundary
|
// golang restricts 64 bit uint64/int atomic on a 64 bit boundary
|
||||||
// therefore all atomics are on the top
|
// therefore all atomics are on the top, As suggested by Slixe
|
||||||
type Connection struct {
|
type Connection struct {
|
||||||
|
Height int64 // last height sent by peer ( first member alignments issues)
|
||||||
|
StableHeight int64 // last stable height
|
||||||
|
TopoHeight int64 // topo height, current topo height, this is the only thing we require for syncing
|
||||||
|
Pruned int64 // till where chain has been pruned on this node
|
||||||
|
LastObjectRequestTime int64 // when was the last item placed in object list
|
||||||
|
Latency int64 // time.Duration // latency to this node when sending timed sync
|
||||||
|
BytesIn uint64 // total bytes in
|
||||||
|
BytesOut uint64 // total bytes out
|
||||||
|
Top_Version uint64 // current hard fork version supported by peer
|
||||||
|
Peer_ID uint64 // Remote peer id
|
||||||
|
Port uint32 // port advertised by other end as its server,if it's 0 server cannot accept connections
|
||||||
|
State uint32 // state of the connection
|
||||||
|
|
||||||
Client *rpc2.Client
|
Client *rpc2.Client
|
||||||
Conn net.Conn // actual object to talk
|
Conn net.Conn // actual object to talk
|
||||||
ConnTls net.Conn // tls layered conn
|
ConnTls net.Conn // tls layered conn
|
||||||
|
|
||||||
Height int64 // last height sent by peer ( first member alignments issues)
|
|
||||||
StableHeight int64 // last stable height
|
|
||||||
TopoHeight int64 // topo height, current topo height, this is the only thing we require for syncing
|
|
||||||
StateHash crypto.Hash // statehash at the top
|
StateHash crypto.Hash // statehash at the top
|
||||||
Pruned int64 // till where chain has been pruned on this node
|
|
||||||
|
|
||||||
Created time.Time // when was object created
|
Created time.Time // when was object created
|
||||||
LastObjectRequestTime int64 // when was the last item placed in object list
|
|
||||||
BytesIn uint64 // total bytes in
|
|
||||||
BytesOut uint64 // total bytes out
|
|
||||||
Latency int64 // time.Duration // latency to this node when sending timed sync
|
|
||||||
|
|
||||||
Incoming bool // is connection incoming or outgoing
|
Incoming bool // is connection incoming or outgoing
|
||||||
Addr net.Addr // endpoint on the other end
|
Addr net.Addr // endpoint on the other end
|
||||||
Port uint32 // port advertised by other end as its server,if it's 0 server cannot accept connections
|
|
||||||
Peer_ID uint64 // Remote peer id
|
|
||||||
SyncNode bool // whether the peer has been added to command line as sync node
|
SyncNode bool // whether the peer has been added to command line as sync node
|
||||||
Top_Version uint64 // current hard fork version supported by peer
|
|
||||||
ProtocolVersion string
|
ProtocolVersion string
|
||||||
Tag string // tag for the other end
|
Tag string // tag for the other end
|
||||||
DaemonVersion string
|
DaemonVersion string
|
||||||
State uint32 // state of the connection
|
|
||||||
Top_ID crypto.Hash // top block id of the connection
|
Top_ID crypto.Hash // top block id of the connection
|
||||||
|
|
||||||
logger logr.Logger // connection specific logger
|
logger logr.Logger // connection specific logger
|
||||||
@ -100,7 +101,6 @@ type Connection struct {
|
|||||||
clock_offsets [MAX_CLOCK_DATA_SET]time.Duration
|
clock_offsets [MAX_CLOCK_DATA_SET]time.Duration
|
||||||
delays [MAX_CLOCK_DATA_SET]time.Duration
|
delays [MAX_CLOCK_DATA_SET]time.Duration
|
||||||
clock_offset int64 // duration updated on every miniblock
|
clock_offset int64 // duration updated on every miniblock
|
||||||
|
|
||||||
onceexit sync.Once
|
onceexit sync.Once
|
||||||
|
|
||||||
Mutex sync.Mutex // used only by connection go routine
|
Mutex sync.Mutex // used only by connection go routine
|
||||||
|
Loading…
x
Reference in New Issue
Block a user