aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* core/vm/dvm: add tests and benchmarks for dvmvm-skymizerdm42019-04-113-10/+215
| | | | | | Pass WASM bytecode and create DVM contract to test WASM VM and EEI correctness and also create a benchmark for benchmarking ERC20 contract transfer.
* params: grow max code size to 2MB.dm42019-04-111-1/+1
| | | | | Currently our WASM bytecode exceed 1MB, so we need to grow MaxCodeSize to 2MB (2000000).
* core/vm/dvm: add random into eei of dvmdm42019-04-112-0/+32
| | | | random in EEI is the same as opRand implemented in core/vm/evm/instructions.go
* core/vm: add dvm, a wasm-based virtual machinedm42019-04-1156-1/+8838
| | | | | DVM follows DEXON VM interface. It checks bytecode and executes it in a WASM VM.
* core: vm: sqlvm: add jump tableMeng-Ying Yang2019-04-112-3/+27
|
* core: vm: sqlvm: add op testcases with templateMeng-Ying Yang2019-04-116-9/+6207
| | | | | | | | We reduce code of funtion call and nested struct initialization by generating testcases with go template system. Run `go run cmd/gen-op-test/main.go` first before testing instructions, and commit generated code for fully testing on CI.
* core: vm: sqlvm: opcodes and basic structsMeng-Ying Yang2019-04-116-17/+1570
| | | | | For runtime implementation, we define opcodes and basic structs for runtime usage and concrete implementation.
* core: vm: sqlvm: update op codeJhih-Ming Huang2019-04-111-87/+2
| | | | | | * Remove STOREPK. * Split STORE to UPDATE and INSERT. * Remove the examples.
* core: vm: sqlvm: runtime: opLoad load fixed bytes and address in bytesJhih-Ming Huang2019-04-115-23/+15
| | | | | To satisfy the latest spec, the data of type of address and fixed bytes will be stored in bytes instead of decimal value.
* vm: sqlvm: refine after updating dexon-foundation/decimalyenlin.lai2019-04-114-19/+7
| | | | | | Refine behaviors: 1. Check decimal.NewFromString by type instead of string compare. 2. Use Rescale in DecimalEncode.
* misc: replace shopspring/decimal with our forkyenlin.lai2019-04-1117-240/+318
|
* core: vm: sqlvm: schema: make foreign key constraints a sliceTing-Wei Lan2019-04-113-17/+52
| | | | It is allowed to declare multiple foreign key constraints on a column.
* core: vm: sqlvm: add a descriptor field to IdentifierNodeTing-Wei Lan2019-04-112-0/+51
| | | | | It will be used to store the descriptor of the object after the name is resolved.
* core: vm: sqlvm: support SQL three-valued logic on ASTTing-Wei Lan2019-04-115-390/+567
| | | | | | We make the zero value invalid by design. Users must be aware of the difference between SQL boolean and Go boolean and initialize it explicitly.
* core: vm: sqlvm: ast: rename DataTypeUnknown to DataTypePendingTing-Wei Lan2019-04-113-14/+19
| | | | | | | | SQL uses three-valued logic which includes an unknown state. To prevent the reader of the code from confusing the unknown value with the unknown data type defined here, we rename 'unknown' data type to 'pending' because it is intended to be used by nodes whose type has not been determined.
* core: vm: sqlvm: ast: rename TestSizeTing-Wei Lan2019-04-111-1/+1
| | | | | It is the last test function which doesn't mention what kind of data it operates on.
* core: vm: sqlvm: ast: don't calculate min and max values on demandTing-Wei Lan2019-04-113-57/+76
| | | | | | It is unsafe to write a map concurrently. Even if it is unlikely for us to call it from multiple threads, it is better to avoid providing an thread-unsafe API when it is possible.
* core: vm: sqlvm: ast: make DataTypeDecode a method of DataTypeTing-Wei Lan2019-04-113-30/+19
| | | | | | | | Since we have dropped DataTypeEncode in favor of GetType method of TypeNode, rename DataTypeDecode to GetNode and make it a method. Drop unnecessary zero checks because we don't care minor bytes when there is only one type belong to a category.
* core: vm: sqlvm: ast: rename tests for DataType encoding or decodingTing-Wei Lan2019-04-111-31/+31
| | | | | | Since we have both DataType and Decimal functions in this file, we should avoid using generic names such as TestEncode and TestDecode without mentioning what types are going to be tested.
* core: vm: sqlvm: ast: return error messages from GetTypeTing-Wei Lan2019-04-114-45/+85
| | | | | | | | To allow callers to provide precise error messages, return an error message in addition to an error code from GetType of TypeNode. Drop DataTypeEncode because it is never used by any code and it has become a simple wrapper of GetType.
* core: vm: sqlvm: schema: move methods of DataTypeMajorTing-Wei Lan2019-04-111-10/+10
| | | | We will add more methods to DataType.
* core: vm: sqlvm: schema: move Rest to the bottomTing-Wei Lan2019-04-111-1/+3
| | | | It is a special field which should not be accessed by any other files.
* core: vm: sqlvm: schema: unsigned integers can never be negativeTing-Wei Lan2019-04-111-2/+2
|
* core: vm: sqlvm: use common.HashLength instead of 32Ting-Wei Lan2019-04-113-9/+10
| | | | Keep them consisitent with ast/types.go.
* core: vm: remain first byte, if it is not VM enum.Jhih-Ming Huang2019-04-111-3/+1
| | | | | * If first byte is not VM enum, we should reserve it as checking VM type. * Remove debug print.
* core: vm: sqlvm: ast: implement decimal to uint64Jhih-Ming Huang2019-04-114-26/+82
| | | | | deciaml.IntPart() returns int64, so we have to implement a function to convert deciaml to uint64 for reading primary id from Raw.
* core: vm: sqlvm: runtime: implement opLoadJhih-Ming Huang2019-04-112-8/+510
|
* core: vm: sqlvm: common: storage: implement storage util functionsJhih-Ming Huang2019-04-113-1/+201
| | | | | Implement some storage utility functions, including shift slot, get dynamic byte and get primary key hash.
* core: vm: sqlvm: schema: implment get column field type and set offsetJhih-Ming Huang2019-04-112-2/+243
| | | | | Since we have to packing our data in slot, it needs to calculate each column field's slot and byte offset.
* core: vm: sqlvm: runtime: add loadRegister funcJhih-Ming Huang2019-04-112-1/+10
| | | | Implement load register to input operands, before each op.
* core: vm: sqlvm: ast: add size func and move error code to errors.goJhih-Ming Huang2019-04-113-19/+69
| | | | Move error code to errors.go, and implement Size method for column field.
* core: vm: sqlvm: types: fix encode bug when exponent is negative (#270)yenlinlai2019-04-112-4/+10
| | | | | It is possible that the number to encode is produced by arithmetic operations and has negative exponent even when it is an integer. Properly handle this case and modify test cases to check it.
* core: vm: sqlvm: schema: add structs to identify an object in a schemaTing-Wei Lan2019-04-111-0/+26
| | | | | These structs will be used in identifier nodes to store references to objects defined in the schema or the command itself.
* core: vm: sqlvm: schema: mark if an index are referenced by foreign keysTing-Wei Lan2019-04-111-0/+36
| | | | | | | In order to check foreign keys efficiently during deletion, an index should be marked when it is referenced by foreign keys. Since we now have flags which cannot be declared directly from the source code, two helper functions are added to distinguish between two groups of flags.
* core: vm: sqlvm: schema: reorder fields and enumsTing-Wei Lan2019-04-111-6/+19
| | | | | Reorder fields and enums according to the grammar file to make it easier to check whether all features supported by the grammar are implemented.
* core: vm: sqlvm: schema: drop pointers from slicesTing-Wei Lan2019-04-112-9/+9
| | | | | | | The number of tables, columns, indices are all limited to 256, so we don't have to do much memory copying during appending. Drop pointers from slices to save memory for storing pointers and possibly improve locality.
* core: vm: sqlvm: parser: check if a number literal is an integerTing-Wei Lan2019-04-112-976/+1045
| | | | | | ORDER BY and GROUP BY options have to decide whether an expression is a reference to the column specified in SELECT command by checking whether it consists of only one integer literal.
* core: vm: sqlvm: make a common interface for statementsTing-Wei Lan2019-04-115-1622/+2281
| | | | | | | So Parse now returns a []ast.StmtNode instead of a generic []ast.Node, which should be clearer on what the return value looks like. This also adds a field recording the verb use to identify the statement in order to provide better error messages.
* core: vm: sqlvm: errors: remove token fieldTing-Wei Lan2019-04-115-474/+440
| | | | | | | | Now both position and length are both recorded in the error struct, recording the token in the error struct no longer provides any benefit. It is easy to find the token when position and length are known, but requiring all error locations to fill the field is complicated because they have to access the source code to find the token.
* core: vm: fix typoTing-Wei Lan2019-04-111-1/+1
|
* remove dexon/crypto/sha3 pkg.Jhih-Ming Huang2019-04-116-11/+12
|
* core: vm: sqlvm: add shared variables (#228)Meng-Ying Yang2019-04-113-11/+19
|
* core: vm: sqlvm: add ESCAPE grammarwmin02019-04-114-653/+768
| | | | | Provide ESCAPE grammar for specifying escape character in like pattern matching.
* core: vm: sqlvm: errors: add length fieldTing-Wei Lan2019-04-115-442/+484
| | | | | 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.
* core: vm: sqlvm: limit the depth of AST to 1024Ting-Wei Lan2019-04-113-7/+50
| | | | | Since we traverse an AST by calling functions recursively, we have to protect the parser by limiting the depth of an AST.
* core: vm: sqlvm: parser: move generated code to internal packageTing-Wei Lan2019-04-115-1565/+1585
| | | | | | | | 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.
* core: vm: sqlvm: ast: use non-empty interfaces in DataType{En,De}codeTing-Wei Lan2019-04-112-80/+34
| | | | | | | 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.
* core: vm: sqlvm: errors: fix typoTing-Wei Lan2019-04-111-1/+1
|
* core: vm: sqlvm: parser: don't use @, #, $ in unquoted identifiersTing-Wei Lan2019-04-112-35/+34
| | | | | | 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.
* core: sqlvm: schema: define type for table/column/index/sequence sizeyenlin.lai2019-04-112-5/+17
| | | | | The size of table in db and column/index/sequence in a table is bounded by uint8. Define types for better readability.
* core: vm: sqlvm: ast: handle error in AST printerTing-Wei Lan2019-04-112-33/+63
| | | | Catch the error reported by fmt.Fprintf and report it to the caller.
* core: vm: sqlvm: fill source code position in AST nodesTing-Wei Lan2019-04-117-1141/+1510
| | | | | | | | | | | | | | | 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.
* core: vm: sqlvm: ast: use pointer receiversTing-Wei Lan2019-04-111-89/+89
| | | | | | | 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.
* core: vm: sqlvm: ast: remove pointer indicator in printer outputTing-Wei Lan2019-04-111-5/+4
| | | | | | 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.
* core: vm: sqlvm: check if a number is a valid addressTing-Wei Lan2019-04-115-334/+312
| | | | | | | | | | | | 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.
* core: vm: sqlvm: introduce interfaces for AST nodesTing-Wei Lan2019-04-119-1704/+2956
| | | | | | | | | 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.
* core: vm: sqlvm: runtime entrypoing error handlingMeng-Ying Yang2019-04-113-5/+14
| | | | Return error.Error to reveal more information about returned error.
* dex: remove file that should not be committed (#204)Jimmy Hu2019-04-111-0/+0
| | | | | | * dex: remove file that should not be committed * add file to .gitignore
* Update .travis.ymlJimmy Hu2019-04-111-0/+1
|
* core: vm: sqlvm: parser: toDecimal handle .0wmin02019-04-112-0/+4
| | | | | To cover the pitfall of decimal.fromString, we need to add leading 0 at '^\.[0-9]+' case.
* core: rebase dev and fix lintJhih-Ming Huang2019-04-1110-4416/+27
|
* core: vm: sqlvm: types support data rangeMeng-Ying Yang2019-04-112-0/+82
| | | | | The data range is deterministic for specific type, `GetMinMax` is helper function to generate min, max value for clients.
* core: vm: sqlvm: export instruction's member (#197)JM2019-04-112-6/+6
|
* core: vm: sqlvm: revert Tuple structure (#193)JM2019-04-111-4/+5
|
* core: vm: sqlvm: modify Tuple.Data.Value typeJhih-Ming Huang2019-04-111-7/+3
| | | | | Modify Tuple.Data.Value type from *big.Int to interface{} and remove Max, Min.
* core: vm: sqlvm: shared interfaces and paramsJhih-Ming Huang2019-04-116-0/+245
| | | | | | | 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.
* core: vm: sqlvm: add schema define and implement rlp serializationwmin02019-04-114-42/+310
| | | | Implement schema struct and handle its rlp serialization.
* core: vm: sqlvm: ast: add encoder/decoder for decimal to byteswmin02019-04-112-11/+196
| | | | | | | | Add encoder/decoder to convert between decimal and bytes. Also handle issues below. * Signed & Unsigned * Padding * Floating point of fixed
* core: vm: sqlvm: ast: data type encoder and decoderwmin02019-04-112-0/+244
| | | | | Implement encode & decode function to convert between type node and 2-bytes type described on spec.
* core: vm: sqlvm: ast: don't hardcode output and indent in PrintASTTing-Wei Lan2019-04-112-26/+35
| | | | | It is now possible to write AST dump to a writer other than stdout and use indent string other than 2 spaces.
* core: vm: sqlvm: process non-UTF-8 input and escape sequencesTing-Wei Lan2019-04-118-337/+579
| | | | | | | | | | | | | | | 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.
* core: vm: sqlvm: parser: properly handle errorsTing-Wei Lan2019-04-116-1242/+1637
| | | | | | 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.
* core: vm: sqlvm: remove optional interface and add print tag for detailwmin02019-04-113-99/+49
| | | | | | | 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
* core: vm: sqlvm: move AST and parser to their own packagesTing-Wei Lan2019-04-118-1837/+2010
| | | | | | | | 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.
* core: vm: sqlvm: add a tool to run gofmt on pigeon sourcesTing-Wei Lan2019-04-111-0/+253
| | | | | | 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.
* core: vm: sqlvm: add sql language parser prototypingwmin02019-04-1113-0/+11043
| | | | | | | | | 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
* core: vm: vm interface (#164)JM2019-04-1123-84/+805
|
* core: vm: extract stateDB and contract outjm2019-04-1131-439/+509
| | | | | Extract stateDB and contract out from core/vm/evm to core/vm, such that other vm type can use the common modules.
* core: vm: refactor file structurejm2019-04-1196-894/+5306
| | | | | For support other vm types, this pr modified the core/vm file structures.
* core: add reset to dkg private key db (#355)Jimmy Hu2019-04-117-78/+92
| | | | | * vendor: sync to latest core * core: dkg private key db
* fixup! Change import go github.com/dexon-foundation/dexonJhih-Ming Huang2019-04-1015-62/+64
|
* consensus: dexcon: set correct tx fee receiverWei-Ning Huang2019-04-101-1/+1
|
* core: vm: improve MPK reverse lookup performanceWei-Ning Huang2019-04-103-82/+92
| | | | | By storing array offset in the original DKGMasterPublicKeyProposed map, we can locate MPK by proposer ID easily.
* Update README.md (#351)Wei-Ning Huang2019-04-101-8/+6
|
* vendor: sync to latest coreJimmy Hu2019-04-102-41/+63
|
* dex: remove time alignment when force sync (#349)Jimmy Hu2019-04-094-41/+39
| | | | | | * vendor: sync to latest core * dex: remove time alignment when force sync
* dex: reduce agreement result (#348)Jimmy Hu2019-04-091-0/+1
|
* vendor: sync to latest coreJimmy Hu2019-04-092-26/+38
|
* travis-ci: disable GCP build uploadWei-Ning Huang2019-04-091-21/+21
|
* vendor: sync to latest coreJimmy Hu2019-04-096-33/+58
|
* travis, appveyor, Dockerfile: upgrade to Go 1.12Samuel Marks2019-04-098-45/+28
| | | | Include serveral DEXON specific fixes.
* vendor: sync to latest coreJimmy Hu2019-04-095-28/+43
|
* dex: remove RandomnessMsg (#342)Sonic2019-04-091-5/+4
|
* params: update testnet dmoment (#340)Wei-Ning Huang2019-04-091-2/+2
|
* core: fix genesis timestamp (#338)Jimmy Hu2019-04-093-9/+9
|
* vendor: sync to latest coreJimmy Hu2019-04-093-32/+44
|
* core: update mainnet and testnet config and genesis alloc (#337)Wei-Ning Huang2019-04-094-22/+26
|
* cmd: monkey: use suggested gas priceWei-Ning Huang2019-04-091-2/+7
|
* vendor: sync to latest coreWei-Ning Huang2019-04-095-46/+76
|
* build: add end to end integration test for recovery mechanism (#336)Sonic2019-04-094-3/+104
|
* core: vm: cache GPK to prevent DoS (#335)Wei-Ning Huang2019-04-092-17/+34
| | | | Cache GPK so one can not slow the chain down with the ProposeCRS method call.
* core: add cache for DKG MPK and complaint (#334)Wei-Ning Huang2019-04-092-36/+90
| | | | | Since deserializing DKG related items are extremely slow (takes about 3 seconds for 100 items), we cache it in the governance interface.
* vendor: sync to latest coreWei-Ning Huang2019-04-094-31/+79
|
* dex: remove node table (#330)Sonic2019-04-099-549/+35
| | | | | | * dex: remove node table Node table is not so useful, go back to rely on kademlia * p2p: fix direct dial still have resolve delay
* core: vm: fineFailStopDKG if MPK not registered (#329)Jimmy Hu2019-04-092-12/+29
| | | | | * core: vm: fineFailStopDKG if MPK not registered * prevent on-chain randomness
* dex: get synced consensus before sleep (#331)Jimmy Hu2019-04-091-3/+5
|
* dex: try to reduce the chance to pull non-finalized blocks (#327)Mission Liao2019-04-095-57/+156
| | | | | | | | | | | | | | | | * Send non-finalized blocks to notary set only * Update randomness field for blocks in cache upon receiving agreement result * Filter AgreementResult by its position * Avoid overwriting finalized blocks with non-finalized ones * Add blocks to finalized cache when pulling * Update to finalized cache when we have corresponding element in non-finalized one.
* core: vm: fix fineFailStopDKG (#328)Jimmy Hu2019-04-091-1/+1
|
* vendor: sync to latest coreJimmy Hu2019-04-0912-212/+267
|
* p2p, p2p/discover: more aggressive dial strategy for direct dial (#326)Sonic2019-04-093-12/+26
| | | | | * p2p/discover: bump failure counter only if no nodes were provided * p2p: more aggressive dial strategy for direct dial
* dexcon: correctly fine DKGSet for not producing blocks (#325)Wei-Ning Huang2019-04-097-68/+80
|
* core: vm: implement node public key replacement (#324)Wei-Ning Huang2019-04-093-1/+102
|
* vendor: sync to latest core (#320)Jimmy Hu2019-04-0925-393/+275
| | | | | | | | * vendor: sync to latest core * dex, core: fix conflict x
* core: vm: clear DKG the right way (#319)Jimmy Hu2019-04-091-1/+1
|
* core/vm: resetDKG if ttoo less qualified (#318)Jimmy Hu2019-04-091-1/+9
|
* dex: fix a panic (#317)Jimmy Hu2019-04-091-1/+1
|
* params: update bootnode (#316)Wei-Ning Huang2019-04-091-3/+5
|
* Dockerfile: include bootnode in imageWei-Ning Huang2019-04-091-1/+2
|
* vendor: sync to latest coreJimmy Hu2019-04-095-81/+121
|
* core: fix forget connection in resetDKG (#314)Jimmy Hu2019-04-092-1/+12
|
* core: vm: make fail stop fine value configurable (#312)Wei-Ning Huang2019-04-095-74/+121
| | | | A node is now quailified only if it has no pending fine and staked >= minstake.
* dex: fix initial build connection bug (#311)Jimmy Hu2019-04-092-4/+7
|
* vendor: sync to latest coreJimmy Hu2019-04-096-34/+62
|
* dex: rebuild connection if dkg reset, core/vm: fix gov (#308)Jimmy Hu2019-04-095-2/+37
| | | | | * dex: rebuild connection if dkg reset * core: vm: fix governance contract
* core: vm: update set size on node info change (#307)Wei-Ning Huang2019-04-091-8/+4
| | | | | | * core: vm: update set size on node info change * fix typo
* core: merge notarySet and DKGSet (#265)Jimmy Hu2019-04-0932-1033/+1064
| | | | | | | | * vendor: sync to latest core * core: merge notarySet and dkgSet * dex: optimize network traffic for finalized block
* backport from v1.8.23 (#304)Sonic2019-04-0913-88/+435
| | | | | | | | | | | | | | | | | | * dex: backport f6193ad * dex/downloader: backport accc0fa accc0fab 174083c3 * dex: backport 434dd5b * dex: backport 42a914a 0983d02 * dex: backport 48b70ec 31b3334 and some modification * dex/downloader: backport 5f251a6 * dex/downloader: backport 81c3dc7 * dex, dex/downloader: fix typos
* dex: do not propose skip block if not in notary set (#303)Wei-Ning Huang2019-04-091-0/+10
|
* dex: fix missing trie node when fast syncing (#301)Sonic2019-04-092-2/+4
| | | | | | * dex: don't panic when we don't have gov state peer requested * dex: use correct head block Since we are fast syncing, we probably don't have body, receipt, state
* core: fix finalize logic (#302)Jimmy Hu2019-04-092-6/+4
|
* core: set extended round block reward to zero (#298)Wei-Ning Huang2019-04-095-20/+102
| | | | | 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.
* vendor: sync to latest core (#300)Jimmy Hu2019-04-0911-237/+222
|
* dex: fix deadlock (#299)Sonic2019-04-091-1/+1
|
* core: vm: fix DKG reset (#296)Wei-Ning Huang2019-04-093-24/+27
|
* vendor: sync to latest core (#295)Wei-Ning Huang2019-04-095-118/+175
|
* Revert "p2p/discover: increase IP address limits (#60)"Wei-Ning Huang2019-04-091-3/+2
| | | | This reverts commit 3ca44e556bd9561b0c6c64c7d3a4f95726c78be8.
* dex: skip duplicate vote to reduce gas used (#293)Wei-Ning Huang2019-04-091-27/+45
|
* dex: fix fast sync in BP mode (#291)Wei-Ning Huang2019-04-094-44/+78
| | | | Start blockproposer only after fast sync is completed (received ChainHead event), so watchcat is not falsely triggered.
* dex: reduce msg when broadcast tx (#292)Sonic2019-04-092-19/+51
| | | | | | | | | | 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.
* core/vm: remove round from addDKG functions (#279)Jimmy Hu2019-04-0923-365/+1038
| | | | | | | | * vendor: sync to latest core * core/vm: remove addDKG functions * core: fix conflict
* core: vm: deny duplicate public key from registering (#289)Wei-Ning Huang2019-04-092-1/+20
|
* core: vm: pay fine to governance owner and trigger set size recalculation (#288)Wei-Ning Huang2019-04-091-1/+5
|
* indexer: support fast-sync (#287)Chung-Yu Liu2019-04-091-0/+2
|
* dex: recieve bp msg when recovery, use atomic to protect the flag (#286)Sonic2019-04-092-17/+19
|
* dex: ignore acceptableDist when force synchronise (#285)Sonic2019-04-093-5/+23
|
* consensus: dexcon: disqualify dead node (#280)Wei-Ning Huang2019-04-0911-152/+294
| | | | | | | | | | 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.
* core: check coinbase for empty block (#282)Jimmy Hu2019-04-091-6/+13
|
* dex: fix start bp node with empty datadir (#278)Sonic2019-04-092-22/+31
| | | also modify some debug log
* core: vm: emit event when transfering owner (#277)Wei-Ning Huang2019-04-093-0/+48
|
* core: fix headerchain coinbase validationWei-Ning Huang2019-04-091-2/+7
| | | | Coinbase address is the owner address of the node.
* dex: add block confirme latency (#275)Jimmy Hu2019-04-092-0/+3
|
* core: vm: automatically calculate notary set size (#276)Wei-Ning Huang2019-04-096-27/+126
|
* dex: do not start watchcat when blockchain is empty (#273)Wei-Ning Huang2019-04-091-4/+8
|
* core: vm: add extra checks to prevent DKG spamming (#272)Wei-Ning Huang2019-04-096-67/+187
| | | | Add two maps to check the uniqueness of DKGMasterPublicKey and DKGComplaints to prevent malicious actors from spamming it.
* core: vm: fix naming consistencyWei-Ning Huang2019-04-092-11/+11
|
* app: validate gas price while preparing block (#274)bojie2019-04-092-34/+126
| | | | Skip tx which is under price and add test case. Use the key which has balance in test case to run test more correctly.
* dex: align recovery dMoment when resuming consensus (#271)Wei-Ning Huang2019-04-091-1/+16
| | | | | | 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.
* cmd: fix default recovery network RPC URLWei-Ning Huang2019-04-091-4/+5
|
* p2p, dex: add debug log (#269)Sonic2019-04-095-18/+68
|
* core: check reset of dkg types when adding (#268)Jimmy Hu2019-04-098-54/+195
| | | | | | * vendor: sync to latest core * core: check dkg reset
* dex: properly shutdown protocol stack (#267)Wei-Ning Huang2019-04-093-6/+12
|
* dex: properly start and stop the block proposer module (#264)Wei-Ning Huang2019-04-094-19/+11
| | | | Stop blockproposer in the Stop() method of node service so the process doens't hang.
* core: vm: reorder minGasPriceLocWei-Ning Huang2019-04-092-5/+5
|
* core: fill in genesis timstamp and remove dMoment from protocol handshake (#263)Wei-Ning Huang2019-04-0910-35/+33
| | | | | | 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 (#258)Wei-Ning Huang2019-04-0932-435/+2435
| | | | | | | | | * dex: implement recovery mechanism The DEXON recovery protocol allows us to use the Ethereum blockchain as a fallback consensus chain to coordinate recovery. * fix
* app: remove log handler in test (#261)bojie2019-04-091-3/+0
|
* dex: add meter for agreement result (#260)Wei-Ning Huang2019-04-091-12/+14
|
* dex: rename lattice to coreWei-Ning Huang2019-04-097-43/+43
|
* app: set delivered height correctly (#259)bojie2019-04-091-0/+1
|
* core: vm: group min gas price with related state variables (#257)Wei-Ning Huang2019-04-094-24/+24
|
* dex: priority for ba vote (#256)Jimmy Hu2019-04-091-0/+17
| | | | | | | | * dex: priority select on vote * More aggressive priority for vote * collect all queuedVotes
* core: vm: implement transfer node ownership (#255)Wei-Ning Huang2019-04-094-10/+85
|
* p2p: report peer counts to datadog (#254)Cliff Lin2019-04-092-0/+4
|
* core: vm: create new oracle contract instance in each call (#251)Wei-Ning Huang2019-04-093-6/+16
| | | | | 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.
* vendor: sync to latest core (#253)Jimmy Hu2019-04-0916-138/+742
|
* core/vm: use core util to get threshold of tsig (#250)Jimmy Hu2019-04-091-3/+4
|
* params: update testnet config to 40 nodesJimmy Hu2019-04-092-8/+8
|
* vendor: sync to latest core and fix conflictJimmy Hu2019-04-0911-211/+276
|
* params: update taipei bootnode IPWei-Ning Huang2019-04-091-1/+1
|
* p2p/discover: fix peer discovery (#248)Wei-Ning Huang2019-04-091-0/+2
| | | | | | | | | | 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.
* core: touch verifierCache at 90% of round (#247)Jimmy Hu2019-04-091-2/+35
|
* app: new app test flow (#244)bojie2019-04-099-70/+2289
|
* core: vm: remove delegation mechanism (#245)Wei-Ning Huang2019-04-098-1001/+267
| | | | | | | | | | | | | 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.
* dex: fetcher: modify parameters to speedup syncing (#239)Wei-Ning Huang2019-04-093-5/+7
|
* dex: rename IsLatticeSyncing to IsCoreSyncing (#238)Wei-Ning Huang2019-04-093-5/+5
|
* core: vm: expose CRSRound and DKGRound and fix consistency (#236)Wei-Ning Huang2019-04-094-63/+121
|
* vendor: sync to latest core (#237)Jimmy Hu2019-04-096-36/+98
|
* build: ci: extend legacy-evm test timeout to 10m (#235)JM2019-04-091-1/+1
| | | | Since it costs almost 5min on new tests data, this pr extends the timeout to 10min.
* Dockerfile.alltools: update Dockerfile for building tools (#234)Wei-Ning Huang2019-04-092-10/+10
|
* cmd: nodekey: add command to generate and inspect nodekey (#233)Wei-Ning Huang2019-04-091-0/+93
|
* dex, dex/downloader: remove some TODO comments (#232)Sonic2019-04-095-13/+1
|
* misc: update dockerignoreJimmy Hu2019-04-091-1/+2
|
* app: refactor app run as single chain (#226)bojie2019-04-094-290/+161
|
* test: update test parameters (#229)Wei-Ning Huang2019-04-095-24/+26
| | | | | | * test: update test parameters * update smoke test parameter
* vendor: sync to latest core (#231)Jimmy Hu2019-04-094-27/+52
|
* core: fix dkgJimmy Hu2019-04-091-12/+47
|
* params: Change taipei to 40 nodes (#227)Jimmy Hu2019-04-092-4/+4
|
* vendor: sync to latest core (#225)Jimmy Hu2019-04-093-73/+33
|
* dex: fill in correct coinbase address (#223)Wei-Ning Huang2019-04-093-723/+19
| | | Also remove app_test.go because of the refactor bojie@ is working on.
* params: Update config (#224)Jimmy Hu2019-04-092-10/+10
| | | | | | * params: Update config * Update taipei to 30 nodes setup
* core: vm: validate addDKGMasterPublicKey caller properly (#220)Wei-Ning Huang2019-04-094-63/+62
| | | | | | 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.
* core: vm: flatten governanceWei-Ning Huang2019-04-0921-631/+679
|
* core: sync to latest core (#214)Jimmy Hu2019-04-0933-759/+555
| | | | | * vendor: sync to latest core * fix for single chain
* misc: Update DockerfileJimmy Hu2019-04-091-2/+2
|
* test: build bootnode if not existWei-Ning Huang2019-04-091-3/+10
|
* params: add Yilan network (#207)Mission Liao2019-04-0911-5/+96
| | | | | | * Add Yilan network * Fixup: remove dummy log
* core: Fixed gas price (#205)Jimmy Hu2019-04-0912-13/+161
| | | | | | | | | | * 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
* core: set oracle contract's code (#209)Sonic2019-04-094-4/+9
| | | So that other contract can call oracle contract.
* fee: fix wrong gas used (#208)bojie2019-04-091-0/+2
|
* zoo: reduce monkey valueJimmy Hu2019-04-091-2/+2
|
* core: Remove K, Phi and NumChains from Governance (#198)Jimmy Hu2019-04-0940-4707/+1285
| | | | | | * change default sync_core.sh * vendor: sync to latest core * core: Remove K, Phi and NumChain
* copy testnet config to taipeiJimmy Hu2019-04-092-9/+9
|
* misc: add ignore fileJimmy Hu2019-04-091-0/+1
|
* core/vm: fix getConfigState (#203)Jimmy Hu2019-04-091-4/+3
|
* vm: reset DKG (#190)Jimmy Hu2019-04-094-70/+562
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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: some minor improvements (#195)Sonic2019-04-093-144/+117
| | | | | | | | | | * 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 (#188)Sonic2019-04-097-63/+95
| | | | | | | | | * 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
* travis: Add notification to slackJimmy Hu2019-04-091-0/+3
|
* p2p, dex: some fixes (#189)Sonic2019-04-092-1/+4
| | | | | * p2p: try resolving direct dial when dial fail * dex: avoid concurrent map read and map write
* p2p, dex: rework connection management (#183)Sonic2019-04-0911-1084/+424
| | | | | | * p2p, dex: rework connection management * dex: refresh our node record periodically * dex: don't send new record event if no new record
* transaction: use all transaction gas to reduce attack intention (#180)bojie2019-04-092-1/+43
| | | The ci test in /tests will use origin evm logic.
* vendor, param: sync to latest core and update dmoment (#182)Jimmy Hu2019-04-093-25/+29
| | | | | | * vendor: sync to latest core * params: update dmoment
* app: prepare/verify block limit in correct round (#181)bojie2019-04-091-2/+2
|
* core/vm: modify Withdrawn event and add NodeRemoved event (#179)Jimmy Hu2019-04-092-4/+31
| | | | | | * core/vm: add delegatorAddr to withdrawn event * core/vm: update gov abi * core/vm: add NodeRemoved event
* vendor, param: sync to latest core and update testnet config (#178)Jimmy Hu2019-04-093-24/+25
| | | | | * param: update testnet config * vendor: sync to latest core
* params: Update taipei configJimmy Hu2019-04-091-4/+4
|
* params: update testnet config (#177)Jimmy Hu2019-04-095-96/+164
| | | | | * vendor:sync to latest core * params: Update config for testnet
* core: vm: refactor governance and add node info oracle (#174)Wei-Ning Huang2019-04-096-683/+954
|
* core: vm: Add amount to undelegate event (#176)Jimmy Hu2019-04-092-4/+9
|
* core: vm: more change to the randomness calculation (#175)Wei-Ning Huang2019-04-091-5/+5
| | | | To prevent attacker from sending TX through a intermediate contract. Always use the original tx sender's adddress and nonce.
* core: vm: modify randomness calculation algorithm (#173)Wei-Ning Huang2019-04-092-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* consensus: dexcon: snapshot round height when finalizing block (#170)Wei-Ning Huang2019-04-0917-279/+332
| | | | Instead of having BP to send a tx to register the round height, just modify the state when finalizing block.
* dex: reduce pullVote (#172)Jimmy Hu2019-04-091-2/+3
|
* ci: move smoke-test to PR testWei-Ning Huang2019-04-091-17/+17
|
* ci: Only build on dev and master (#171)Jimmy Hu2019-04-091-0/+4
|
* dex: Add rate limit for pullVote (#169)Jimmy Hu2019-04-091-7/+21
|
* core, dex/downloader: polish headers verification and blocks insertion logic ↵Sonic2019-04-0914-625/+1143
| | | | | | | | (#168) Refactor GenerateDexonChain function, move governance tx logic to the user of GenerateDexonChain (testchain_test.go) and move fake node set code to FakeDexcon.
* params: Update testnet dmomentJimmy Hu2019-04-092-2/+2
|
* params: Update testnet config (#167)Jimmy Hu2019-04-0913-79/+122
| | | | | | | | * vendor: sync to latest core * param: update testnet config * params: update dmoment
* param: Update testnet dmoment (#166)Jimmy Hu2019-04-091-1/+1
|
* travis: re-encrypt GCP credential file (#165)bojie2019-04-093-3/+3
|
* params: update testnet dMomentWei-Ning Huang2019-04-091-1/+1
|
* params: update testnet genesis and dMomentWei-Ning Huang2019-04-092-6/+5
|
* p2p: report latency and relative latency to datadog (#162)Wei-Ning Huang2019-04-092-3/+14
|
* travis: add new CI test to test fullnode (#138)bojie2019-04-0910-39/+366
|
* dex: add block number gauge (#140)haoping-ku2019-04-091-18/+25
|
* core, dex: use block hash as witness data (#160)Sonic2019-04-097-74/+30
| | | | | | | | | | 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.
* blockchain: add mutex lock to prevent fork (#159)bojie2019-04-091-1/+6
|
* common: fix big scan from bytes (#157)johnliu-dexon2019-04-092-2/+6
| | | | | | We store string of number, not bytes value into database 10 is stored as 0x3130, not 0x0a Use UnmarshalText instead of SetBytes
* core: sync to latest core (#158)Jimmy Hu2019-04-097-47/+63
| | | | | | * vendor: sync to latest core * param: Update config * core: update genesis alloc