New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed HF5 @ 22800 #19

Merged
merged 31 commits into from Apr 16, 2018

Conversation

1 participant
@aerth
Member

aerth commented Apr 13, 2018

Preface

The (*header).Hash() function is an important one. Maybe the single most important function in the entire codebase. When it is called (example: when validating blocks), the header (nonce and mix digest included) is encoded as rlp, and a round of keccak256 hash is applied, cached, and the result returned. If the requested hash is cached, the hash round is not necessary, as it was already computed.

Currently the header.Hash() function simply returns rlpHash(), using keccak256:

// before HF5 changes
func rlpHash(x interface{}) (h common.Hash) {
	hw := sha3.NewKeccak256()
	rlp.Encode(hw, x)
	hw.Sum(h[:0])
	return h
}

Proposed change allows us to change the algorithm used by header.Hash() at later times. It is worth noting that (in this PR) the header version does NOT need to make it into the block chain, and IS ignored by rlp, and NEVER sent peer-to-peer. The header version is calculated locally with two parameters: block height and current running chain config (Mainnet, Testnet, etc)

If your instance of aqua is expecting block 200 to be hashed with "algorithm A", if you receive a header from a peer, you will not receive the version along with it. The local node calculates which version hash algorithm to apply to a block. The resulting hash would mismatch, and parent hashes would also break validation. 馃憤 For instance, the testnet explorer is able to provide the header version but does not receive the value (currently either 1 or 2) from the blockchain or peers.

"Header Versions"

Header.Version specifies which hashing algorithm to run on the rlp-encoded data.

There are a ton of instances of the header.Hash() function. This PR effects all of those executions.

With these changes, header.Hash() requires that header.Version != 0. I removed the panic, but am considering adding it at a later time.

Testing Argon2id POW

With aquachain command: Run with -testnet flag, create new account with personal.newAccount(), and use miner.start() after synchronizing (a few hundred blocks).

With aquaminer command: Run with -F http://pool.aquachain-foundation.org:8888/<address>/<worker>

The rc2 zips have aquachain-HF5rc2 bundled with aquaminer (standalone miner)

aquachain-HF5rc2-linux.zip
aquachain-HF5rc2-osx.zip
aquachain-HF5rc2-windows.zip

About the testnet

I have switched my explorer to testnet (explorer.aquanetwork.co)

Testnet has one bootnode, and finding peers isn't too bad. Lots of mainnet peers trying to connect, but then disconnect due to unequal genesis blocks (mainnet and testnet have two different genesis blocks)

Previous hard forks are activated on their block number. HF1 is at block one, HF2 at block two, etc.

HF5 (block 5) is where argon2id is activated.

aerth added some commits Apr 13, 2018

@aerth aerth merged commit d2ee733 into master Apr 16, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@aerth aerth deleted the HF5 branch Apr 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment