-
Notifications
You must be signed in to change notification settings - Fork 31
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Optimistic fast finality #316
Commits on Sep 7, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 95c8922 - Browse repository at this point
Copy the full SHA 95c8922View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6586619 - Browse repository at this point
Copy the full SHA 6586619View commit details -
feat: implement bls accounts and keymanager (#298)
* feat: implement bls accounts and keymanager * chore: Implement `CreateAccountsKeystore` function * chore: remove prysm import from keymanager
Configuration menu - View commit details
-
Copy full SHA for 068a74f - Browse repository at this point
Copy the full SHA 068a74fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5f8920d - Browse repository at this point
Copy the full SHA 5f8920dView commit details -
Configuration menu - View commit details
-
Copy full SHA for ec15ae4 - Browse repository at this point
Copy the full SHA ec15ae4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2fe0f4a - Browse repository at this point
Copy the full SHA 2fe0f4aView commit details -
crypto/bls: fix bls signature batch unit test (#306)
We randomly observe this failure when running unit test go test -test.v -run=^TestSignatureBatch_AggregateBatch/common_and_uncommon_messages_in_batch_with_multiple_messages === RUN TestSignatureBatch_AggregateBatch === RUN TestSignatureBatch_AggregateBatch/common_and_uncommon_messages_in_batch_with_multiple_messages signature_batch_test.go:643: AggregateBatch() Descriptions got = [test signature bls aggregated signature test signature bls aggregated signature test signature bls aggregated signature], want [bls aggregated signature test signature bls aggregated signature test signature bls aggregated signature test signature] --- FAIL: TestSignatureBatch_AggregateBatch (0.02s) --- FAIL: TestSignatureBatch_AggregateBatch/common_and_uncommon_messages_in_batch_with_multiple_messages (0.02s) The problem is that the signature sort forgets to swap the description when a swap occurs. This commit adds the description swap when swap occurs.
Configuration menu - View commit details
-
Copy full SHA for 42e63c6 - Browse repository at this point
Copy the full SHA 42e63c6View commit details -
core/vote: implement finality vote manager and pool (#301)
* feat: implement vote manager logics * chore: remove SourceNumber and SourceHash from vote * chore: Add `Debug` function which allow debugging within `VoteManager` * nit: Remove unused code * chore: rename `VoteAddress` to `PublicKey` * core/vote: validator only votes for the higher block height This commit implements new rule that allow validator to only vote for higher block height than its previous vote. With this vote journal is not necessary anymore so we remove it. * cmd, eth: init the vote manager and vote pool * vote_signer: clean up code --------- Co-authored-by: Bui Quang Minh <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 7b2f9cf - Browse repository at this point
Copy the full SHA 7b2f9cfView commit details -
core/types/vote: introduce RawVoteEnvelop (#308)
RawVoteEnvelop is the same as VoteEnvelop without cached hash
Configuration menu - View commit details
-
Copy full SHA for 039e4dd - Browse repository at this point
Copy the full SHA 039e4ddView commit details -
core/vote/vote_pool: protect pool against malicious peer (#309)
This commit limits the number of votes in future queue per peer as the vote in future queue is not fully verified. The check happens before the costly basicVerify which has to verify the BLS signature.
Configuration menu - View commit details
-
Copy full SHA for 6d0a974 - Browse repository at this point
Copy the full SHA 6d0a974View commit details -
build: add cflags to build portable blst library (#310)
We randomly get error in CI Caught SIGILL in blst_cgo_init, consult <blst>/bindinds/go/README.md. As in blst documentation, we need to provide CGO_CFLAGS="-O -D__BLST_PORTABLE__" to make the compiled blst portable across different CPU. This commit adds this CGO_CFLAGS to the build process.
Configuration menu - View commit details
-
Copy full SHA for cc76bf6 - Browse repository at this point
Copy the full SHA cc76bf6View commit details -
consortium/v2: add finality vote to consensus layer (#299)
* param: introduce Shillin hardfork * consortium/v2: add finality vote to consensus layer This commit extends the snapshot to contains additional BLS public key of the validators. The new information is also added to header's extra data like aggregated BLS signature and voted validator information. A new system transaction is created to reward the finality voted validators. * consortium/v2: test header encoding and finality signature verification
Configuration menu - View commit details
-
Copy full SHA for d5a271d - Browse repository at this point
Copy the full SHA d5a271dView commit details -
blockchain, rpc, backend: add new forkchoice and finalized block query (
#303) * core/blockchain: choose the chain with highest justified block in fork choice This commit introduces the new logic to fork choice to choose the fork with higher justified block before comparing total diffculty. In case the justified blocks in forks have the same height, we fallback to compare total difficulty same as before. * rpc, backend: add finalized block the block query
Configuration menu - View commit details
-
Copy full SHA for 2b01e56 - Browse repository at this point
Copy the full SHA 2b01e56View commit details -
eth/protocols: implement finality vote communication via ronin protoc…
…ol (#307) * eth/protocols: implement finality vote communication via ronin protocol ronin protocol is an extension protocol of eth, a peer is required to support eth protocol to run ronin protocol. ronin protocol currently only supports NewVotePacket which contains a list of finality votes. * eth/protocols: don't broadcast known finality vote to peer If a vote is broadcasted from a peer or we have broadcasted to that peer already, we mark this vote is known by that peer and does not broadcast this vote to that peer again. * eth/protocols: test finality vote broadcast via ronin protocol
Configuration menu - View commit details
-
Copy full SHA for d3e0b17 - Browse repository at this point
Copy the full SHA d3e0b17View commit details -
vote/vote_pool: use TryRLock in FetchVoteByBlockHash (#311)
The FetchVoteByBlockHash is called by the consensus engine and we don't want this function to block the consensus engine's operations. Currently, FetchVoteByBlockHash uses RLock to wait to acquire the read lock but as the writers are uncontrolled, it can be blocked when there are a lot of spamming writers. This commit makes FetchVoteByBlockHash to use TryRLock to keep polling for the lock n times and returns nil in case it cannot acquire the lock. This helps to bound the max duration a caller must wait on this function.
Configuration menu - View commit details
-
Copy full SHA for 46a63f5 - Browse repository at this point
Copy the full SHA 46a63f5View commit details -
core/vm: add precompiled contract to verify finality vote violation p…
…roof (#314) This precompiled contract is called by system contract to verify signature from the provided proof of finality vote violation. It checkes if there is a validator has contributed to 2 aggregated signatures on the 2 distinct block with the same height.
Configuration menu - View commit details
-
Copy full SHA for 9aa5709 - Browse repository at this point
Copy the full SHA 9aa5709View commit details -
monitor/finality_vote: add finality vote monitor (#312)
* consortium: add GetActiveValidatorAt to get validators can vote for a block * monitor/finality_vote: add finality vote monitor This monitor gets the information from block header and check if a voter votes for 2 distinct block at the same height.
Configuration menu - View commit details
-
Copy full SHA for 654a936 - Browse repository at this point
Copy the full SHA 654a936View commit details -
consortium/v2: fix snapshot save after Shillin (#317)
The blsCommon.PublicKey cannot be un/marshalled to json, this commit converts that field to hex string before marshalling to json.
Configuration menu - View commit details
-
Copy full SHA for 27e6cac - Browse repository at this point
Copy the full SHA 27e6cacView commit details -
build: add CGO flags to all build targets (#322)
Currently, we only add CGO flags when running 'make ronin', so sometimes we still get the error related to blst library built without the CGO_CFLAGS. This commit adds the CGO flags to all places when we use 'go run' to build the binary.
Configuration menu - View commit details
-
Copy full SHA for acb814b - Browse repository at this point
Copy the full SHA acb814bView commit details -
consortium/v2: add contract interaction to get BLS public key (#320)
This commit adds the contract interaction to get BLS public when preparing checkpoint block. This also creates a getCheckpointValidatorsFromContract function to be used in both Prepare and Finalize the checkpoint block. Besides, a new interface ContractInteraction is created for mock test contract interaction.
Configuration menu - View commit details
-
Copy full SHA for 2d51eb5 - Browse repository at this point
Copy the full SHA 2d51eb5View commit details -
eth/backend: add vote pool to consortium engine (#323)
When the vote pool is enabled, make the consortium consensus engine use it.
Configuration menu - View commit details
-
Copy full SHA for 7318ee4 - Browse repository at this point
Copy the full SHA 7318ee4View commit details -
consortium/v2: fix the finality vote fetch from pool (#319)
The commit fixes the bug when collects and aggregates signatures from vote pool.
Configuration menu - View commit details
-
Copy full SHA for 835c313 - Browse repository at this point
Copy the full SHA 835c313View commit details -
blockchain: check total difficulty only when having same justified bl…
…ock number (#321) In fork choice, we only need to compare the difficulty of forks when the justified block numbers are the same in those forks. Otherwise, we choose the fork with higher justified block number. This commit fixes a bug in current fork choice to make it follow the correct behavior.
Configuration menu - View commit details
-
Copy full SHA for cb16894 - Browse repository at this point
Copy the full SHA cb16894View commit details -
consortium/v2: edit the finality vote threshold (#324)
Due to the change in REP-0003, a block is finalized when there are at least floor(2/3*numValidators) + 1, this commit changes the calculation to follow the rule.
Configuration menu - View commit details
-
Copy full SHA for 6f2bf3a - Browse repository at this point
Copy the full SHA 6f2bf3aView commit details -
consortium/v2: add RPC API for querying finality vote easily (#318)
This commit adds 2 APIs in consortiumv2 namespace: consortiumv2_getValidatorAtHash, consortiumv2_getFinalityVoteAtHash. consortiumv2_getValidatorAtHash returns the authorized validators that can seal block hash with BLS public key. consortiumv2_getFinalityVoteAtHash returns the finality vote information in the block header at block hash.
Configuration menu - View commit details
-
Copy full SHA for 555a252 - Browse repository at this point
Copy the full SHA 555a252View commit details -
accountcmd, entrypoint: add BLS key management commands (#325)
This commit adds account commands: - listbls: show the BLS accounts information - importbls: import BLS secret key - checkbls: check if the BLS account with the provided secret key already exists - generatebls: generate BLS secret key This commit also adds BLS management code to entrypoint.sh for running node using docker.
Configuration menu - View commit details
-
Copy full SHA for 0f0e06f - Browse repository at this point
Copy the full SHA 0f0e06fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4a11959 - Browse repository at this point
Copy the full SHA 4a11959View commit details -
consortium/v2: add VerifyVote and fix blsPublicKey access (#327)
* consortium: add VerifyVote to the outer consortium As required by the FastFinalityPoSA interface, VerifyVote is needed in the outer consortium. We add VerifyVote to outer consortium which simply forwards to the consortium v2 function. * consortium/v2: access blsPublicKey only after Shillin The BLS public key is only available in checkpoint header after Shillin, so don't access this field before Shillin.
Configuration menu - View commit details
-
Copy full SHA for c46cf70 - Browse repository at this point
Copy the full SHA c46cf70View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9255cdb - Browse repository at this point
Copy the full SHA 9255cdbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2e6d7d7 - Browse repository at this point
Copy the full SHA 2e6d7d7View commit details -
consortium/v2: fix the incorrect snapshot lookup in GetFinalizedBlock (…
…#330) Currently, to check if the justified block number - 1 is justfied, we look at the snapshot at justfied block number - 1. This is incorrect because at the snapshot N, the maximum justified block number is N - 1. So, we need to look at the snapshot at justified block number to check if the justified block number - 1 is justified.
Configuration menu - View commit details
-
Copy full SHA for a0faee0 - Browse repository at this point
Copy the full SHA a0faee0View commit details -
Dockerfile, entrypoint: fix start script and install additional packa…
…ge (#326) * entrypoint: fix bash script syntax * Dockerfile: add required libstdc++ package
Configuration menu - View commit details
-
Copy full SHA for 60b52c1 - Browse repository at this point
Copy the full SHA 60b52c1View commit details -
protocols/ronin, vote/votepool: improve vote channel queue (#336)
* protocols/ronin: remove redudant finality vote channel put * vote/vote_pool: make PutVote non-blocking, drop vote in case of failure
Configuration menu - View commit details
-
Copy full SHA for 96febbb - Browse repository at this point
Copy the full SHA 96febbbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 857e078 - Browse repository at this point
Copy the full SHA 857e078View commit details -
vote/vote_pool: reject older than justified block number vote (#334)
* vote/vote_pool: reject older than justified block number vote The vote which targets the block number that is older or equal to justified block number is not useful anymore. We can reject and prune those votes from pool. * vote/vote_pool: prune the future vote map and queue
Configuration menu - View commit details
-
Copy full SHA for ab7efcc - Browse repository at this point
Copy the full SHA ab7efccView commit details -
consortium/v2: make SealHash return unchanged hash after Shillin (#332)
As we delay assembling finality vote until Seal function, it means the seal hash can be updated after the FinalizeAndAssemble. This breaks the worker which uses seal hash to store and look up seal tasks between FinalizeAndAssemble and Seal function. Worker uses SealHash function to get the header hash and this function is used by worker only not by any other parts in the consensus. So in this commit, we make this function returns a hash of header without the finality vote. This is not the real hash used for sealing but it remains unchanged after FinalizeAndAssemble which meet the requirement of the worker.
Configuration menu - View commit details
-
Copy full SHA for c59e820 - Browse repository at this point
Copy the full SHA c59e820View commit details -
consortium/v2: protect the contract interaction under mutex (#339)
The contract field in consortium v2 consensus engine is written under the call to Authorize. The Authorize function is called only once in startup and can run concurrently with other funtions that read the contract field which leads to data race. We move this write under the mutex lock and the read of this field into readSignerAndContract function to avoid data race.
Configuration menu - View commit details
-
Copy full SHA for c0b28d6 - Browse repository at this point
Copy the full SHA c0b28d6View commit details -
consortium/v2: reject the vote with wrong target number (#338)
Currently, a vote with wrong target number is not assembled into block as there is a check in assembleFinalityVote. In this commit, we move that check to VerifyVote to reject the vote earlier in vote pool, avoid the vote pool to be DOSed.
Configuration menu - View commit details
-
Copy full SHA for e677d26 - Browse repository at this point
Copy the full SHA e677d26View commit details -
Configuration menu - View commit details
-
Copy full SHA for efe0841 - Browse repository at this point
Copy the full SHA efe0841View commit details -
go.mod: bump blst to v0.3.11 (#348)
blst v0.3.11 fixes this vulnerability. This vulnerability does not affect us because the wrapper we use does not call SigValidate with sigInfcheck argument set to true. However, it is not bad to bump to the latest version.
Configuration menu - View commit details
-
Copy full SHA for aa6a2cc - Browse repository at this point
Copy the full SHA aa6a2ccView commit details -
consortium/v2: distribute finality reward for the voters in parent bl…
…ock (#337) * consortium/v2: distribute finality reward for the voters in parent block Because the finality votes are assembled after we FinalizeAndAssemble the block and the finality reward distribution transaction is in FinalizeAndAssemble, we cannot reward the finality voters in the current block right away. Instead, the reward distribution is delayed until next block. So in the FinalizeAndAssemble, we look at the finality voters in the parent header and distribute reward to them. * consortium/v2: integrate with the finality tracking contract This commit integrates with the finality tracking contract (axieinfinity/ronin-dpos-contracts#279) to record the finality reward for voters.
Configuration menu - View commit details
-
Copy full SHA for 64b67de - Browse repository at this point
Copy the full SHA 64b67deView commit details -
params: add optimistic fast finality testnet configuration (#353)
This commit adds a Shillin hardfork on testnet to enable optimistic fast finality. The hardfork is scheduled around Sept 12 2023, 7:00 GMT+7 (https://saigon-app.roninchain.com/block/20268000)
Configuration menu - View commit details
-
Copy full SHA for 716f8b5 - Browse repository at this point
Copy the full SHA 716f8b5View commit details