Skip to content

Commit

Permalink
Several bugs fixes. Thanks to Slixe.
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainDero committed Feb 19, 2023
1 parent 358fab6 commit e855701
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 14 deletions.
24 changes: 14 additions & 10 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
### Welcome to the DEROHE Testnet
### DERO HE Changelog

[Explorer](https://testnetexplorer.dero.io) [Source](https://github.com/deroproject/derohe) [Twitter](https://twitter.com/DeroProject) [Discord](https://discord.gg/H95TJDp) [Wiki](https://wiki.dero.io) [Github](https://github.com/deroproject/derohe) [DERO CryptoNote Mainnet Stats](http://network.dero.io) [Mainnet WebWallet](https://wallet.dero.io/)

### DERO HE Changelog
### Release 116
* Added miniblock spam fix(Bug reported by Slixe)
* Pruned chain can be rewinded till its pruned height only(Bug reported by Slixe)
* Added a wallet crash fix
* Fixed github issue 112
* Fixed github issue 98

[From Wikipedia: ](https://en.wikipedia.org/wiki/Homomorphic_encryption)

###At this point in time, DERO blockchain has the first mover advantage in the following
### At this point in time, DERO blockchain has the first mover advantage in the following

* Private SCs ( no one knows who owns what tokens and who is transferring to whom and how much is being transferred.)
* Homomorphic protocol
Expand All @@ -22,11 +25,10 @@
- Multi-send is now possible. sending to multiple destination per tx
- DERO Simulator for faster development/testing
- Few more ideas implemented and will be tested for review in upcoming technology preview.
-



###3.4
### 3.4

- DAG/MINIDAG with blocks flowing every second
- Mining Decentralization.No more mining pools, daily 100000 reward blocks, no need for pools and thus no attacks
Expand All @@ -36,21 +38,21 @@
- Implemented gas estimation
- DVM simulator to test all edge cases for SC dev, see dvm/simulator_test.go to see it in action for lotter SC.

###3.3
### 3.3

* Private SCs are now supported. (90% completed).
* Sample Token contract is available with guide.
* Multi-send is now possible. sending to multiple destination per tx
* Few more ideas implemented and will be tested for review in upcoming technology preview.

###3.2
### 3.2

* Open SCs are now supported
* Private SCs which have their balance encrypted at all times (under implementation)
* SCs can now update themselves. however, new code will only run on next invocation
* Multi Send is under implementation.

###3.1
### 3.1

* TX now have significant savings of around 31 * ringsize bytes for every tx
* Daemon now supports pruned chains.
Expand All @@ -69,3 +71,5 @@
###3.0

* DERO HE implemented


5 changes: 5 additions & 0 deletions blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,11 @@ func (chain *Blockchain) Rewind_Chain(rewind_count int) (result bool) {
return
}

// a pruned chain can only be rewinded upto it pruned height only
if chain.Load_TOPO_HEIGHT() - int64(rewind_count) <= pruned_till {
return false
}

top_block_topo_index := chain.Load_TOPO_HEIGHT()
rewinded := int64(0)

Expand Down
13 changes: 11 additions & 2 deletions cmd/derod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var command_line string = `derod
DERO : A secure, private blockchain with smart-contracts
Usage:
derod [--help] [--version] [--testnet] [--debug] [--sync-node] [--timeisinsync] [--fastsync] [--socks-proxy=<socks_ip:port>] [--data-dir=<directory>] [--p2p-bind=<0.0.0.0:18089>] [--add-exclusive-node=<ip:port>]... [--add-priority-node=<ip:port>]... [--min-peers=<11>] [--max-peers=<100>] [--rpc-bind=<127.0.0.1:9999>] [--getwork-bind=<0.0.0.0:18089>] [--node-tag=<unique name>] [--prune-history=<50>] [--integrator-address=<address>] [--clog-level=1] [--flog-level=1]
derod [--help] [--version] [--testnet] [--debug] [--sync-node] [--timeisinsync] [--fastsync] [--socks-proxy=<socks_ip:port>] [--data-dir=<directory>] [--p2p-bind=<0.0.0.0:18089>] [--add-exclusive-node=<ip:port>]... [--add-priority-node=<ip:port>]... [--min-peers=<11>] [--max-peers=<100>] [--rpc-bind=<127.0.0.1:9999>] [--getwork-bind=<0.0.0.0:18089>] [--node-tag=<unique name>] [--prune-history=<50>] [--integrator-address=<address>] [--clog-level=1] [--flog-level=1] [--log-dir=<dir>]
derod -h | --help
derod --version
Expand All @@ -85,6 +85,7 @@ Options:
--min-peers=<31> Node will try to maintain atleast this many connections to peers
--max-peers=<101> Node will maintain maximim this many connections to peers and will stop accepting connections
--prune-history=<50> prunes blockchain history until the specific topo_height
--log-dir=<directory> Logs will be placed in this directory
`

Expand Down Expand Up @@ -139,8 +140,16 @@ func main() {

// parse arguments and setup logging , print basic information
exename, _ := os.Executable()
logdir := ""
filename := exename + ".log"
if _, ok := globals.Arguments["--log-dir"]; ok && globals.Arguments["--log-dir"] != nil {
logdir = globals.Arguments["--log-dir"].(string)
filename = filepath.Base(exename) + ".log"
filename = filepath.Join(logdir,filename)
}

globals.InitializeLog(l.Stdout(), &lumberjack.Logger{
Filename: exename + ".log",
Filename: filename,
MaxSize: 100, // megabytes
MaxBackups: 2,
})
Expand Down
2 changes: 1 addition & 1 deletion cmd/derod/rpc/rpc_dero_getsc.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func GetSC(ctx context.Context, p rpc.GetSC_Params) (result rpc.GetSC_Result, er
}
switch v.Type {
case dvm.Uint64:
result.ValuesString = append(result.ValuesUint64, fmt.Sprintf("%d", v.ValueUint64))
result.ValuesString = append(result.ValuesString, fmt.Sprintf("%d", v.ValueUint64))
case dvm.String:
result.ValuesString = append(result.ValuesString, fmt.Sprintf("%x", []byte(v.ValueString)))
default:
Expand Down
2 changes: 1 addition & 1 deletion config/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ import "github.com/blang/semver/v4"

// right now it has to be manually changed
// do we need to include git commitsha??
var Version = semver.MustParse("3.5.2-114.DEROHE.STARGATE+01102022")
var Version = semver.MustParse("3.5.3-116.DEROHE.STARGATE+16022023")
6 changes: 6 additions & 0 deletions p2p/rpc_notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,17 @@ func (c *Connection) NotifyMiniBlock(request Objects, response *Dummy) (err erro

var mbls []block.MiniBlock

height := chain.Get_Height()
for i := range request.MiniBlocks {
var mbl block.MiniBlock
if err = mbl.Deserialize(request.MiniBlocks[i]); err != nil {
return err
}
if height > 4 { // activate check a bit after genesis, thanks Slixe
if height-2 <= int64(mbl.Height) && int64(mbl.Height) <= (height+1){
} else{
return fmt.Errorf("Stale Miniblock")
}}
mbls = append(mbls, mbl)
}

Expand Down
4 changes: 4 additions & 0 deletions walletapi/daemon_communication.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,11 @@ func (w *Wallet_Memory) Random_ring_members(scid crypto.Hash) (alist []string) {
}

// sync history of wallet from blockchain
var sync_multilock sync.Mutex // make sync history single threaded
func (w *Wallet_Memory) SyncHistory(scid crypto.Hash) (balance uint64) {
sync_multilock.Lock()
defer sync_multilock.Unlock()

defer func() {
if r := recover(); r != nil {
logger.V(1).Error(nil, "Recovered while syncing connecting", "r", r, "stack", debug.Stack())
Expand Down

0 comments on commit e855701

Please sign in to comment.