Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fractalplatform/fractal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.0.24
Choose a base ref
...
head repository: fractalplatform/fractal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: dev
Choose a head ref
Loading
Showing 476 changed files with 19,804 additions and 31,534 deletions.
91 changes: 90 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,86 @@
# [fractal](https://github.com/fractalplatform/fractal) Changelog
## [1.0.0] - 2019-12-09
### Forked
- [DPOS] allow contract asset transfer (#525)(#528)
- [FEE] other people pay transaction fee (#531)(#533)(#536)
### Fixed
- [FEE]fee transfer internal record (#495)
- [BLOCKCHIAN] fixed export blockchain error (#498)
- [GAS] modify gas price (#501)
- [MINER] add setcoinbase check (#500) and fix miner bug (#499)(#511)(#512)(#513)(#514)(#516)
- [P2P] fixed bug that may close a nil channel (#503)and fixed ddos check error (#519)
- [DOWNLOAD]add node into blacklist if it had too much errors(#519)(#523)
### Added
- [CMD] add version cmd compile date info (#505)(#521)
- [CMD] cmd/ft: add method 'seednodes' into sub-cmd 'p2p' (#497)
- [CMD] add txpool cmd gettxsbyaccount (#502)
- [P2P] p2p,rpc: add rpc to query seed nodes from db(#496)
- [TEST] add each code module unit test or note (#492)(#493)(#504)(#508)(#507)(#509)


## [0.0.30] - 2019-09-20
### Fixed
- [DOWNLOADER] blockchain/downloader: if there were two different blocks in same height, it may cause download error (#481)(#490)
- [BLOCKCHAIN] blockchain: fixed bug that use nanosecond compared with second (#474)
### Changed
- [RAWDB] modify fractal db interface (#487)
- [BLOCKCHAIN] modify the blockchain code (#489)
### Added
- [GASPRICE] returns the recommended gas price (#486)
- [TEST] add each code module unit test or note (#471)(#472)(#473)(#475)(#476)(#478)(#482)(#483)(#485)


## [0.0.29] - 2019-09-04
### Fixed
- [P2P] blockchain/downloader: fixed bug that may don't download the new block (#469)
### Added
- [CMD] add chain command forkstatus (#468)
- [TEST] add each code module unit test or note.(#467)(#466)


## [0.0.28] - 2019-09-04
### Fixed
- [P2P] bootnode in genesis is ft finder.(#439)
- [DPOS]dpos api epoch add url. (#437)
- [INTERNALTX]modify internal tx log hash. (#441)
- [FILTER]fix rpc output format. (#440)
### Changed
- [RPCAPI] modify setStatePruning rpc private (#464),modify blockchain misspelling and change ft_getTransactions (#457)
### Added
- [RPCAPI] add rpc api ft_forkStatus.(#463)
- [TEST] add each code module unit test or note.(#442)(#446)(#447)(#448)(#450)(#451)(#454)(#455)(#456)(#458)(#459)(#461)(#462)(#465)


## [0.0.27] - 2019-08-16
### Fixed
- [VIM] vm fix stack valid (#416)
### Added
- [RPC] add rpc interface: ft_getTransBatch


## [0.0.26] - 2019-08-14
### Fixed
- [LOG] fix vendor log bug, patch for version 0.0.25


## [0.0.25] - 2019-08-07
### Forked
- [DPOS] fork3: reduce CandidateAvailableMinQuantity (#416)
### Fixed
- [MINER] fixed some bugs (#421)(#422)
- [TXPOOL] fixed txpool add remotes not check the same tx was exist (#423)
- [TXPOOL] fixed txpool rpc send same tx err (#430)
- [ACCOUNT] fix internal action bug (#424)
### Changed
- [RPCAPI] modify api get account by name and id (#428)
- [GASPRICE] modify gas price oracle (#417)
- [ACCOUNT] modify account fliter balance zero (#414)
### Added
- [FILTERS] add filters rpc (#431)
- [MOD] support go mod (#429)
- [VM] add timeout func (#419) and add callwithpay (#425)


## [0.0.24] - 2019-07-30
### Fixed
- [BLOCKCHAIN] blockchain store irreversible number
@@ -114,7 +196,7 @@
## [0.0.13] - 2019-05-18
### Add
- [GPO] add add gas price oracle unit test
- [VM] move gas to GasTableInstanse
- [VM] move gas to GasTableInstance
### Fixed
- [PARAMS] change genesis gas limit to 30 million
- [VM] opCreate doing nothing but push zero into stack and distributeGasByScale distribute right num
@@ -203,6 +285,13 @@
- [MAKEFILE] add check fmt tag_release release command


[1.0.0]: https://github.com/fractalplatform/fractal/compare/v0.0.30...v1.0.0
[0.0.30]: https://github.com/fractalplatform/fractal/compare/v0.0.29...v0.0.30
[0.0.29]: https://github.com/fractalplatform/fractal/compare/v0.0.28...v0.0.29
[0.0.28]: https://github.com/fractalplatform/fractal/compare/v0.0.27...v0.0.28
[0.0.27]: https://github.com/fractalplatform/fractal/compare/v0.0.26...v0.0.27
[0.0.26]: https://github.com/fractalplatform/fractal/compare/v0.0.25...v0.0.26
[0.0.25]: https://github.com/fractalplatform/fractal/compare/v0.0.24...v0.0.25
[0.0.24]: https://github.com/fractalplatform/fractal/compare/v0.0.23...v0.0.24
[0.0.23]: https://github.com/fractalplatform/fractal/compare/v0.0.22...v0.0.23
[0.0.22]: https://github.com/fractalplatform/fractal/compare/v0.0.21...v0.0.22
39 changes: 17 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -14,25 +14,24 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# default target is 'all'
all:

SHELL:=/bin/bash
REPO := $(shell pwd)
GOFILES_NOVENDOR := $(shell go list -f "{{.Dir}}" ./...)
PACKAGES_NOVENDOR := $(shell go list ./... | grep -v test)
WORK_SPACE := ${REPO}/build/_workspace
FT_DIR :=${WORK_SPACE}/src/github.com/fractalplatform
TEMP_GOPATH := $(GOPATH)
GOFILES_NOVENDOR := $(shell GOFLAGS="-mod=vendor" go list -f "{{.Dir}}" ./...)
PACKAGES_NOVENDOR := $(shell GOFLAGS="-mod=vendor" go list ./... | grep -v test)

export GOPATH := ${WORK_SPACE}
export GOFLAGS=-mod=vendor

define build
@cd ${FT_DIR}/fractal && go build -ldflags " \
@go build -ldflags " \
-X github.com/fractalplatform/fractal/cmd/utils.commit=$(shell cat commit_hash.txt) \
-X github.com/fractalplatform/fractal/cmd/utils.date=$(shell date '+%Y-%m-%d') \
-X github.com/fractalplatform/fractal/cmd/utils.date=$(shell date '+%Y-%m-%d-%H:%M:%S') \
-X 'github.com/fractalplatform/fractal/cmd/utils.goversion=$(shell go version)'" \
-o ${FT_DIR}/fractal/build/bin/$(1) ./cmd/$(1)
-o ${REPO}/build/bin/$(1) ./cmd/$(1)
endef


### Check and format code

# check the code for style standards; currently enforces go formatting.
@@ -64,44 +63,40 @@ vet:
commit_hash:
@git status &> /dev/null && scripts/commit_hash.sh > commit_hash.txt || true

.PHONY: build_workspace
build_workspace:
@[ -d ${FT_DIR} ] || mkdir -p ${FT_DIR}
@[ -d ${FT_DIR}/fractal ] || ln -s ${REPO} ${FT_DIR}/fractal

# build all targets
.PHONY: all
all:check build_workspace build_ft build_ftfinder
all:check build_ft build_ftfinder

# build ft
.PHONY: build_ft
build_ft: commit_hash check build_workspace
build_ft: commit_hash check
@echo "Building ft."
$(call build,ft)


# build ftfinder
.PHONY: build_ftfinder
build_ftfinder: commit_hash check build_workspace
build_ftfinder: commit_hash check
@echo "Building ftfinder."
$(call build,ftfinder)

### Test

.PHONY: test
test: all
@cd ${FT_DIR}/fractal && scripts/test.sh
@scripts/test.sh

.PHONY: test_win
test_win:
@export GOPATH=${TEMP_GOPATH} && bash scripts/test.sh
@bash scripts/test.sh

### Clean up

# clean removes the target folder containing build artefacts
.PHONY: clean
clean:
-rm -rf ./build/bin ./build/_workspace
-rm -rf ./build/bin

### Release and versioning

@@ -129,9 +124,9 @@ tag_release: test check docs
.PHONY: release
release: check docs
@scripts/is_checkout_dirty.sh || (echo "checkout is dirty so not releasing!" && exit 1)
@export GOPATH=${TEMP_GOPATH} && scripts/release.sh
@scripts/release.sh

.PHONY: tmp_release
tmp_release: check
@echo "Building and releasing"
@export GOPATH=${TEMP_GOPATH} && goreleaser --snapshot --rm-dist
@goreleaser --snapshot --rm-dist
20 changes: 14 additions & 6 deletions NOTES.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
### Forked
- [DPOS] allow contract asset transfer (#525)(#528)
- [FEE] other people pay transaction fee (#531)(#533)(#536)
### Fixed
- [BLOCKCHAIN] blockchain store irreversible number
- [TXPOOL] fixed txpool test failed in travis CI
### Changed
- [DPOS] update some dpos apis
- [FEE]fee transfer internal record (#495)
- [BLOCKCHIAN] fixed export blockchain error (#498)
- [GAS] modify gas price (#501)
- [MINER] add setcoinbase check (#500) and fix miner bug (#499)(#511)(#512)(#513)(#514)(#516)
- [P2P] fixed bug that may close a nil channel (#503)and fixed ddos check error (#519)
- [DOWNLOAD]add node into blacklist if it had too much errors(#519)(#523)
### Added
- [LOG] add some log print
- [RPC] add rpc dpos_snapShotStake and fixed GetActivedCandidate
- [CMD] add version cmd compile date info (#505)(#521)
- [CMD] cmd/ft: add method 'seednodes' into sub-cmd 'p2p' (#497)
- [CMD] add txpool cmd gettxsbyaccount (#502)
- [P2P] p2p,rpc: add rpc to query seed nodes from db(#496)
- [TEST] add each code module unit test or note (#492)(#493)(#504)(#508)(#507)(#509)

37 changes: 21 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Fractal

[![Build Status](https://travis-ci.org/fractalplatform/fractal.svg?branch=master)](https://travis-ci.org/fractalplatform/fractal)
[![GoDoc](https://godoc.org/github.com/fractalplatform/fractal?status.svg)](https://godoc.org/github.com/fractalplatform/fractal)
[![Coverage Status](https://coveralls.io/repos/github/fractalplatform/fractal/badge.svg?branch=master)](https://coveralls.io/github/fractalplatform/fractal?branch=master)
@@ -7,51 +8,55 @@
Welcome to the Fractal source code repository!

## What is Fractal?
Fractal is a high-level blockchain framework that can implement the issuance, circulation, and dividends of tokens efficiently and reliably. Fractal can also steadily implement various community governance functions with voting as the core and foundation. These functions are the foundation for building the token economy of future.

home page: https://fractalproject.com/
Fractal is a high-level blockchain framework that can implement the issuance, circulation, and dividends of tokens efficiently and reliably. Fractal can also steadily implement various community governance functions with voting as the core and foundation. These functions are the foundation for building the token economy of future.

home page: https://fractalproject.com/

## Executables

The fractal project comes with several wrappers/executables found in the `cmd` directory.

| Command | Description |
|:----------:|-------------|
| **`ft`** | Our main fractal CLI client. It is the entry point into the fractal network (main-, test- or private net), It can be used by other processes as a gateway into the fractal network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. `ft -h` and the [Command Line Options](https://github.com/fractalplatform/fractal/wiki/Command-Line-Options) for command line options. |
| **`ftfinder`** | ftfinder is a fractal node discoverer.`ftfinder -h ` and the [Command Line Options](https://github.com/fractalplatform/fractal/wiki/Command-Line-Options) for command line options. |

| Command | Description |
| :------------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`ft`** | Our main fractal CLI client. It is the entry point into the fractal network (main-, test- or private net), It can be used by other processes as a gateway into the fractal network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. `ft -h` and the [Command Line Options](https://github.com/fractalplatform/fractal/wiki/Command-Line-Options) for command line options. |
| **`ftfinder`** | ftfinder is a fractal node discoverer.`ftfinder -h` and the [Command Line Options](https://github.com/fractalplatform/fractal/wiki/Command-Line-Options) for command line options. |

## Getting Started

The following instructions overview the process of getting the code, building it, and start node.

### How to create first account

You can use [fractal wallet](https://m.ft.im/download) to create first account.

### Getting the code

To download all of the code:

`git clone https://github.com/fractalplatform/fractal`

### Setting up a build/development environment

Install latest distribution of [Go](https://golang.org/) if you don't have it already. (go version >= go1.10 )
Install latest distribution of [Go](https://golang.org/) if you don't have it already. (go version >= go1.10 )

Currently supports the following operating systems:
Currently supports the following operating systems:

* Ubuntu 16.04
* Ubuntu 18.04
* MacOS Darwin 10.12 and higher
- Ubuntu 16.04
- Ubuntu 18.04
- MacOS Darwin 10.12 and higher

### Build Fractal

`make all`

more information see: [Installing Fractal](https://github.com/fractalplatform/fractal/wiki/Build-Fractal)


### Running a node

To run `./ft ` , you can run your own FT instance.
To run `./ft` , you can run your own FT instance.

`$ ft `
`$ ft`

Join the fractal main network see: [Main Network](https://github.com/fractalplatform/fractal/wiki/Main-Network)

@@ -65,8 +70,8 @@ Operating a private network see:[Private Network](https://github.com/fractalplat

[Fractal Blog](https://fractalproject.com/blog.html)


More Documentation see [the Fractal wiki](https://github.com/fractalplatform/fractal/wiki)

## License

Fractal is distributed under the terms of the [GPLv3 License](./License).
39 changes: 17 additions & 22 deletions accountmanager/account.go
Original file line number Diff line number Diff line change
@@ -53,28 +53,23 @@ func newAssetBalance(assetID uint64, amount *big.Int) *AssetBalance {

//Account account object
type Account struct {
//LastTime *big.Int
AcctName common.Name `json:"accountName"`
Founder common.Name `json:"founder"`
AccountID uint64 `json:"accountID"`
Number uint64 `json:"number"`
//ChargeRatio uint64 `json:"chargeRatio"`
Nonce uint64 `json:"nonce"`
Code []byte `json:"code"`
CodeHash common.Hash `json:"codeHash"`
CodeSize uint64 `json:"codeSize"`
Threshold uint64 `json:"threshold"`
UpdateAuthorThreshold uint64 `json:"updateAuthorThreshold"`
AuthorVersion common.Hash `json:"authorVersion"`
//sort by asset id asc
Balances []*AssetBalance `json:"balances"`
//realated account, pubkey and address
Authors []*common.Author `json:"authors"`
//code Suicide
Suicide bool `json:"suicide"`
//account destroy
Destroy bool `json:"destroy"`
Description string `json:"description"`
AcctName common.Name
Founder common.Name
AccountID uint64
Number uint64
Nonce uint64
Code []byte
CodeHash common.Hash
CodeSize uint64
Threshold uint64
UpdateAuthorThreshold uint64
AuthorVersion common.Hash
Balances []*AssetBalance //sort by asset id asc
Authors []*common.Author //related account, pubkey and address
Suicide bool //code Suicide
Destroy bool //account destroy
Description string
//ChargeRatio uint64
}

// NewAccount create a new account object.
Loading