| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
| |
Provide ESCAPE grammar for specifying escape character in like pattern
matching.
|
|
|
|
|
| |
When an error corresponds to a source code token, it should be able to
report the length of the token in addition to the position.
|
|
|
|
|
| |
Since we traverse an AST by calling functions recursively, we have to
protect the parser by limiting the depth of an AST.
|
|
|
|
|
|
|
|
| |
Code generated by pigeon includes many exported symbols which should not
be used by any other code other than the parser itself. To prevent them
from being misused, we used to hide them by editing the generated code
with sed. This commit removes the unreliable sed trick by putting
generated code to internal package.
|
|
|
|
|
|
|
| |
In addition to changes required to move DataTypeEncode and
DataTypeDecode to use TypeNode interface, this commit also unifies the
meaning of 'Size' field in 'FixedBytesTypeNode'. It always counts the
length in bytes now.
|
| |
|
|
|
|
|
|
| |
These symbols are allowed in Microsoft SQL or PostgreSQL, but the SQL
standard doesn't mention them. It is still possible to use these symbols
as identifiers by putting them in double quotes.
|
|
|
|
|
| |
The size of table in db and column/index/sequence in a table is bounded
by uint8. Define types for better readability.
|
|
|
|
| |
Catch the error reported by fmt.Fprintf and report it to the caller.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now all AST nodes should have position information recorded during
parsing. These fields are intended to be used to report errors and make
debugging easier. However, precise location of each token is currently
unavailable. It can be done in the future if it becomes necessary.
To make it easier to traverse an AST, GetChildren is modified to skip
nil nodes in the output. This means callers of GetChildren don't have
to check for nil in returned slices.
AST printer is modified to print the position and the corresponding
source code token. A few special handling for interfaces are removed
because reflection works better for structs.
|
|
|
|
|
|
|
| |
Since all nodes must be declared as pointers to satisfy the interface,
it is no longer meaningful to use value receivers. It should make the
code look more consistent and reduce the amount of memory copying
during function calls because these structs takes at least 8 bytes.
|
|
|
|
|
|
| |
Since our 'Node' interface includes methods which must be implemented
with pointer receivers, all AST nodes are now referenced with pointers
and the '*' pointer indicator is no longer useful.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit implements isAddress function to allow a number literal to
be considered as an address literal. Since Solidity only allows '0x' to
be written in lower case, we remove the handling of upper case '0X' to
keep the behavior in sync with Solidity.
In addition to isAddress implementation, this commit also removes
'String' methods from AST nodes to prevent them from implementing the
builtin 'Stringer' interface. Therefore, our AST printer is now able to
print struct fields of value nodes instead of only one string.
|
|
|
|
|
|
|
|
|
| |
In order to make our AST easier and safer to use, all declarations with
empty interface type are now removed.
This changes also makes it possible to traverse the AST without using
reflection or understanding what each type means because all AST nodes
have at least one common interface.
|
|
|
|
| |
Return error.Error to reveal more information about returned error.
|
|
|
|
|
|
| |
* dex: remove file that should not be committed
* add file to .gitignore
|
| |
|
|
|
|
|
| |
To cover the pitfall of decimal.fromString, we need to add leading 0 at
'^\.[0-9]+' case.
|
| |
|
|
|
|
|
| |
The data range is deterministic for specific type, `GetMinMax` is
helper function to generate min, max value for clients.
|
| |
|
| |
|
|
|
|
|
| |
Modify Tuple.Data.Value type from *big.Int to interface{}
and remove Max, Min.
|
|
|
|
|
|
|
| |
After reconstructing commits, we move shared interfaces and params as
first runtime implementation. In this commit we define OP codes, runtime
flow and entrypoint, and basic operand structs and minor helper
components.
|
|
|
|
| |
Implement schema struct and handle its rlp serialization.
|
|
|
|
|
|
|
|
| |
Add encoder/decoder to convert between decimal and bytes. Also handle
issues below.
* Signed & Unsigned
* Padding
* Floating point of fixed
|
|
|
|
|
| |
Implement encode & decode function to convert between type node and
2-bytes type described on spec.
|
|
|
|
|
| |
It is now possible to write AST dump to a writer other than stdout and
use indent string other than 2 spaces.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Our parser is able to process queries with invalid UTF-8, provided that
it is compatible with ASCII. Since doing so requires encoding the input
before passing to pigeon, Parse* functions generated by pigeon are
unexported because they should not be used directly.
Escape sequences in string literals and identifiers are now recognized.
In addition to escape sequences supported by solidity, we support \U
similar to the one supported by Go to allow users to specify non-BMP
Unicode code point without using multiple \x escapes.
AST printer is modified to quote non-printable characters in strings to
prevent control characters from messing up the terminal.
|
|
|
|
|
|
| |
Instead of ignoring errors, errors returned from external functions are
normalized and reported to users. Errors which should be impossible to
occur are converted to panic calls.
|
|
|
|
|
|
|
| |
There are some changes in print ast utility.
1. instead of using optional interface to get detail, use reflect
2. implement a `print` field tag for printer switching detail mode or
not
|
|
|
|
|
|
|
|
| |
In order to avoid putting too many different things in single package
and allow other projects to reuse the syntax tree and the parser, these
two components are moved to different packages and all nodes used in AST
are now exported. A lot of comments are added in this commit to pass
golint checks.
|
|
|
|
|
|
| |
This tool is good enough to format our sqlvm grammar file. It is not
guaranteed to work for all valid pigeon files, and it only process
multi-line Go code blocks.
|
|
|
|
|
|
|
|
|
| |
Add sql language parser prototyping along with
1. grammar file implemented with github.com/mna/pigeon
2. ast node struct definition
3. simple parser test which only test if error existed
4. ast printer utility for visualizing parsing result
|
| |
|
|
|
|
|
| |
Extract stateDB and contract out from core/vm/evm to core/vm,
such that other vm type can use the common modules.
|
|
|
|
|
| |
For support other vm types, this pr modified the core/vm file
structures.
|
|
|
|
|
| |
To discourage DKG set from prolonging the round indefinitely, we set the
block reward of the extended round to 0. The gas fee is send to the
DEXON governance owner for safe keeping and later used by the foundation.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This reverts commit 3ca44e556bd9561b0c6c64c7d3a4f95726c78be8.
|
| |
|
|
|
|
| |
Start blockproposer only after fast sync is completed (received
ChainHead event), so watchcat is not falsely triggered.
|
|
|
|
|
|
|
|
|
|
| |
Our network topology is different from ethereum, the nodes in notary set will
connect each other directly. So there is a waste for flooding tx msgs
in notary set. And nodes in notary set are more likely to propose block
successfully, it is not useful to broadcast tx msgs to non notary set
nodes.
This PR will increase some tx confirm latency, but can reduce waste tx
msgs a lot.
|
|
|
|
|
|
|
|
| |
* vendor: sync to latest core
* core/vm: remove addDKG functions
* core: fix conflict
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Since a qualified node might fail stopped, we need to remove them from
qualified nodes to maintain network integrity. We do this by inspect the
previous round to see if there are dead nodes. A dead node is a notary
set node that does not propose any block in the previous round. We
disqualify them by fining them so their staked value is 1 wei below
minStake. This make them unqualified for being notary set in the follow
on rounds.
|
| |
|
|
|
| |
also modify some debug log
|
| |
|
|
|
|
| |
Coinbase address is the owner address of the node.
|
| |
|
| |
|
| |
|
|
|
|
| |
Add two maps to check the uniqueness of DKGMasterPublicKey and DKGComplaints to
prevent malicious actors from spamming it.
|
| |
|
|
|
|
| |
Skip tx which is under price and add test case.
Use the key which has balance in test case to run test more correctly.
|
|
|
|
|
|
| |
In theory BA should tolerant inconsistant start time between every node.
Since the vote cache is limited, we can not keep all the votes and pass
them around all nodes. To fix this, we align the next recovery dmoment
so nodes start at the same time.
|
| |
|
|
|
|
| |
handshake (#263)
|
| |
|
|
|
|
|
|
| |
* vendor: sync to latest core
* core: check dkg reset
|
| |
|
|
|
|
| |
Stop blockproposer in the Stop() method of node service so the process
doens't hang.
|
| |
|
|
|
|
|
| |
Fill in dmoment as genesis block timestamp. This allow us to remove
dMoment check from protocol handshake since genesis block hash itself
will protect us against different dMoment.
|
|
|
|
|
|
|
|
|
| |
* dex: implement recovery mechanism
The DEXON recovery protocol allows us to use the Ethereum blockchain as a
fallback consensus chain to coordinate recovery.
* fix
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
* dex: priority select on vote
* More aggressive priority for vote
* collect all queuedVotes
|
| |
|
| |
|
|
|
|
|
| |
Since the VM might be called from different source (downloader, RPC,
etc.). We need to make the call state separate. Modify the calling
sequence so a new oracle contract instance is used on each run.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The refactor in 4cd90e02e23ecf2bb11bcb4bba4fea2ae164ef74 introduced
livness checks for nodes. However, the change in
86ec742f975d825f42dd69ebf17b0adaa66542c0 did not properly set the
initial liveness check value for verified node. For verified node we
should set livenessCheck to 1 initially.
Without this change, the node entry will not be properly send to other
nodes and the network would be broken.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current delegation mechanism are prone to unstaking attack. i.e. a
malicious attacker could unstake a small amount from a lot of node it
staked before and make them unqualified, which leads to potential
failure of the network.
Since DEXON does not use consensus like DPoS, node is required to have
at least MinStake in order to become a node. Voting mechanism is not
required in our system since qualified node does not depends on the
number of votes. Instead of managing the delegation mechanism in
governance contract, we should let the owner manage the delegation and
reward distribution mechanism on their own.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Since it costs almost 5min on new tests data,
this pr extends the timeout to 10min.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
* test: update test parameters
* update smoke test parameter
|
| |
|
| |
|
| |
|
| |
|
|
|
| |
Also remove app_test.go because of the refactor bojie@ is working on.
|
|
|
|
|
|
| |
* params: Update config
* Update taipei to 30 nodes setup
|
|
|
|
|
|
| |
There are two keys in the system: one is the owner's key which is used
for stake / unstake. The other is the node key which is used for DKG
related operations. We need to allow them to be different so fund
renmains safe even if the the node key is lost.
|
| |
|
|
|
|
|
| |
* vendor: sync to latest core
* fix for single chain
|
| |
|
| |
|
|
|
|
|
|
| |
* Add Yilan network
* Fixup: remove dummy log
|
|
|
|
|
|
|
|
|
|
| |
* core/vm: update abi
* core/vm: add MinGasPrice to gov
* params: Add MinGasPrice to Config
* dex: SuggestPrice from Governance
* test: add minGasPrice to genesis.json
* core: check underpriced tx
* dex: verify with gas price
|
|
|
| |
So that other contract can call oracle contract.
|
| |
|
| |
|
|
|
|
|
|
| |
* change default sync_core.sh
* vendor: sync to latest core
* core: Remove K, Phi and NumChain
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* vm: Update gov abi
* vm: Add DKGResetCount to state helper
* vm: add getter
* vm: Add DKGReset event
* vm: Add resetDKG method
* vm: check resetDKG criteria
* vm: Add new CRS
* vm: add helper pop2DByteArray
* vm: emit event
* vm: Add CoreMock to GovernanceContract
* vm: bug fix
* add test for resetDKG
* vm: Add test
* fix test
* Modify mock interface
|
|
|
|
|
|
|
|
|
|
| |
* dex: improve some msg propagation
* dex: support send a batch of lattice blocks, votes, randomnesses
To reduce msgs number of PullBlocks, PullVotes, PullRandomness
* dex: minor improvement
|
|
|
|
|
|
|
|
|
| |
* dex: Add a flag to GetBlockHeadersMsg and GetBlockBodiesMsg
So that we can dispatch the response msg to fetcher or downloader
easily.
* fixup! dex: Add a flag to GetBlockHeadersMsg and GetBlockBodiesMsg
|
| |
|
|
|
|
|
| |
* p2p: try resolving direct dial when dial fail
* dex: avoid concurrent map read and map write
|
|
|
|
|
|
| |
* p2p, dex: rework connection management
* dex: refresh our node record periodically
* dex: don't send new record event if no new record
|
|
|
| |
The ci test in /tests will use origin evm logic.
|
|
|
|
|
|
| |
* vendor: sync to latest core
* params: update dmoment
|
| |
|
|
|
|
|
|
| |
* core/vm: add delegatorAddr to withdrawn event
* core/vm: update gov abi
* core/vm: add NodeRemoved event
|
|
|
|
|
| |
* param: update testnet config
* vendor: sync to latest core
|
| |
|
|
|
|
|
| |
* vendor:sync to latest core
* params: Update config for testnet
|
| |
|
| |
|
|
|
|
| |
To prevent attacker from sending TX through a intermediate contract.
Always use the original tx sender's adddress and nonce.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The original algorithm used for calculating algorithm is vulnerable to
cross context re-entry attack. Example as follows:
contract B {
event Value(uint256 value);
uint256 public value;
function call() public {
value = rand;
emit Value(value);
}
}
contract A {
function randTwice(address bAddr) public {
B b = B(bAddr);
b.call.gas(100000)();
b.call.gas(100000)();
}
}
The two `b.call` will result in the same randomness value. This commit
fix the issue by recording a called index used to store how many times
opRand is called, and use it as argument to the Keccak call.
|
|
|
|
| |
Instead of having BP to send a tx to register the round height, just
modify the state when finalizing block.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
(#168)
Refactor GenerateDexonChain function, move governance tx logic to
the user of GenerateDexonChain (testchain_test.go) and move fake node set
code to FakeDexcon.
|
| |
|
|
|
|
|
|
|
|
| |
* vendor: sync to latest core
* param: update testnet config
* params: update dmoment
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Using only state root and receipt root as witness data can not protect
other fields in block header, ex: bloom, difficulty, gas limit, gas
used...
So that everyone can manipulate these fields to create as many valid blocks
at the same height as he want. Although this will not effect the state,
one can spam us when syncing.
Using block hash as witness data can solve this.
|
| |
|
|
|
|
|
|
| |
We store string of number, not bytes value into database
10 is stored as 0x3130, not 0x0a
Use UnmarshalText instead of SetBytes
|
|
|
|
|
|
| |
* vendor: sync to latest core
* param: Update config
* core: update genesis alloc
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
* app: fix reward bug with empty block
* make block generation consistent
* revert change to dmoment in genesis.json
|
|
|
|
|
|
| |
* vendor: sync to latest core with BA3.0
* params: Update dmoment
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Add totalSupply and totalStaked in the governance contract for the
preperation of DEXON cryptoeconomics 4.0.
Also removed the unstaked variable in node info and improve tests for
delegate/undeleate.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Pass following network related params:
* Genesis block
* Network ID
And sync mode for indexer configuration.
|
|
|
|
|
|
| |
* fixup! app: use gcp storage instead of azure for builds (#81)
* dex: remove unused log
|
| |
|
|
|
|
| |
(#118)
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
* Add missing cpp file
* Align root and sub folder hash
|
| |
|
| |
|
|
|
|
|
|
|
| |
When starts a bp node to sync with the network, bc.chainLastHeight map
may not be initialized yet.
Just return error if we can not get chain last height when preparing
payload and verify block.
|
|
|
|
| |
Let roundHeightMap be corret whenever we starting a bp node.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
* indexer: ReadOnlyBlockchain returns underlying engine
* indexer: plugin configs support custom flags
|
| |
|
|
|
|
| |
The ubuntu trusty distribution binutils-aarch64-linux-gnu package does
not contain the gold linker. Use the xenial distribution instead.
|
| |
|
|
|
|
| |
For restoring mock componenets (such as: VM, Backend, ...etc),
blockchain related configs should be exposed.
|
| |
|
| |
|
|
|
|
|
| |
* vendor: add dependencies for using GCP storage
* app: use gcp storage instead of azure for builds
|
|
|
|
|
|
|
|
| |
* core/vm: Add Fined field to nodeInfo.
* core/vm: Add PayFine to Governance
* Not qualify if staked-fine < minStake()
* Add test for fine
* Update genesis hash
|
| |
|
|
|
|
|
|
|
|
|
| |
To support more effective and flexible blockchain info exploring, we add
`indexer` package, defines the flow of indexer dameon, and integrate
into dex.Dexon fullnode.
For more export options, we use Golang built-in `plugin` package to
support mulitple implementations.
|
| |
|
|
|
|
|
| |
Since blocks will interleave around round change, we will probably need
to verify blocks at previous round.
|
| |
|
|
|
|
|
| |
* vendor: sync to latest core
* dex: Add PullRandomness
|
|
|
|
|
| |
- Add String() for common usage which call original `big.Int`'s `String()`
- Add ToBigInt() for type convertion
|
|
|
|
|
|
|
|
|
| |
* core: types: add database/sql support for BlockNonce
* common: add database/sql support with Big
New Big type is declared to let big.Int support database/sql by
implementing Scan() and Value() on new type.
|
|
|
|
|
|
|
| |
Merging these commits in DEXON consensus core:
- https://github.com/dexon-foundation/dexon-consensus/commit/dce509a13ef5873b9cae3c1cabdb97e219b6fb7d
- https://github.com/dexon-foundation/dexon-consensus/commit/6d1c1aeea0d3e75d10cbb2712c68b4c422ba8ba6
- https://github.com/dexon-foundation/dexon-consensus/commit/c1ed57c4abaf1f4758e52f082bb7114ad00c8b39
|
| |
|
|
|
|
| |
Add ERC20 token (Banana) and feeder
Fix call contract parameters
|
| |
|
|
|
|
|
|
| |
* core/types: SigCache with a limited size
* minor tweaks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* dex, internal: block proposer syncing (first iteration)
* core: find block from db if not in memory
This fix handles stopping proposing and then restarting
* core: no need to reorg when reset
Dexon will not fork. This commit also fix when a block confirm but
its parent is not in db yet, during restarting proposing.
* dex: always accept NewBlockMsg, NewBlockHashesMsg
We need to accept NewBlockMsg, NewBlockHashesMsg to sync current block with
other peers in block proposer mode when syncing lattice data. It's a waste
when the node is synced and start proposing.
Todo: control msg processing on/off more granular, accept NewBlockMsg,
NewBlockHashesMsg when syncing, but stop when synced.
|
|
|
|
|
|
| |
* core/vm: Add DKGMPKReady
* param: update GenesisHash
* vendor: sync to latest core
|
| |
|
|
|
|
| |
Remove duplicate declaration of WitnessData and remove the TxHash field
in witness data since it does not need to be witnessed.
|
| |
|
|
|
|
|
| |
Only allow a user to withdraw funds after a certain lockup
period. This way, the fund of a bad actor could be confiscated before he
could escape.
|
| |
|
| |
|
|
|
|
|
|
| |
- Implement new methods in db to cache DKG
private key.
- Implement new methods in db to cache compaction
chain tip.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
* Dockerfile: fix path and dependency
* Update Dockerfile
Co-Authored-By: s60912frank <s60912frank@gmail.com>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Broadcasting blocks at chain head event is not correct when the full
node is not running in block proposer mode. Introduce NewFinalizedBlockEvent,
this event is post by the full node which runs in block proposer mode when a
block is witnessed and resulting in some blocks are considered finalized.
- Non block proposer node will still broadcast blocks
at the following moment (same as ethereum):
1. a sync with a peer is terminated successfully
2. a block passes the fetcher's header check during inserting blocks
3. a block is successfully inserted by fetcher
- Don't trigger a sync when we are not behind other peers more than
acceptable distance. Fetcher is able to cover this.
|
|
|
|
|
| |
* README.md: add gitter.im badges
* Update README.md
|
|
|
|
| |
Use sync map to prevent concurrent read write.
Use last pending state to prepare/verify transactions.
|
|
|
|
|
|
|
| |
In dexon, we don't "mine" and the blockchain won't and shouldn't fork, so
there is no difficulty concept, just replace it with block number.
Note: this commit only replace total difficulty related logic and code
in dex, dex/downloader package.
|
|
|
|
|
|
| |
* Timeout on prepare payload
* Leave 2 CPU for others
* Add hardLimit and softLimit to PreparePayload
|
| |
|
| |
|
| |
|