Commit Graph

119 Commits

Author SHA1 Message Date
Arnau B
5097939b12 Avoid using pointers in common 2020-10-08 16:42:16 +02:00
laisolizq
1c54beca5a Update ethclient rollup iteration 2 2020-10-08 13:18:34 +02:00
Eduard S
b14495cfcc Replace all []*Foo by []Foo in sql db return values
- Implement SlicePtrsToSlice and use it in all `meddler.QueryAll` sql db functions to always return []Foo instead of []*Foo
2020-10-07 17:03:39 +02:00
Eduard S
0277210c39 Extend ethclient test, implement new TxID spec
- Implement new TxID spec that distinguishes L1UserTx and L1CoordinatorTx
- Replace some type []*Foo by []Foo
- Fix HistoryDB & L2DB bug: in case of error, a rollback was applied and the returned error was nil
- Reorder inserts in historydb.NewHistoryDB() to follow foreign key dependencies
- Add initial synchronizer test with test.Client (for now, only tested l1UserTxs, blocks, addToken)
- Update L1UserTx event in test.Client
2020-10-07 16:41:51 +02:00
Eduard S
1a85f15d27 Fix conflicts and update dependencies of ethclient 2020-10-06 18:16:59 +02:00
laisolizq
202b98b3e6 Update ethclient contracts & rollup iteration 1 2020-10-06 12:15:16 +02:00
arnau
15a122a6a0 Merge pull request #178 from hermeznetwork/feature/codec-funcs
Add L1CoordTx & L2Tx byte parsers functions
2020-10-06 11:12:58 +02:00
a_bennassar
49366e3fa4 Feature/null refactor (#173)
* WIP: rebase

* Make nullable fields use pointers
2020-10-06 10:34:49 +02:00
laisolizq
aef6da38af Add codec functions 2020-10-05 17:00:10 +02:00
arnaucube
9bb4a4ec1b Add TxID calculation & New{Layer}Tx Type
Add TxID calculation & New{Layer}Tx Type

New{Layer}Tx methods that compute the `TxID` & `TxType` values from the
transaction values:
- NewL1Tx
- NewL2Tx
- NewPoolL2Tx

Add TxID Scanner & Valuer for database/sql

HistoryDB & L2DB & API packages tests will need to be addapted to the
TestTransaction generation once is done.
2020-09-30 15:37:13 +02:00
a_bennassar
c6f70f3177 Feature/merge history l2 tables (#156)
* WIP rebase

* Combine both SQL DBs

* API and DB refactor
2020-09-29 18:27:07 +02:00
a_bennassar
0c9a6e3f2d Merge pull request #150 from hermeznetwork/feature/historydb-sync2
Helper methods for Synchronizer and TX refactor
2020-09-23 18:22:07 +02:00
ToniRamirezM
ac677694fe Helper methods for Synchronizer and TX refactor 2020-09-23 17:05:38 +02:00
arnaucube
06703aecad Idx to 6 bytes (48 bits) 2020-09-22 18:01:14 +02:00
a_bennassar
c0336f485f Merge pull request #148 from hermeznetwork/feature/txsel-l2logic
Add TxSelector L2Tx filtering logic
2020-09-22 15:40:40 +02:00
Eduard S
b86d21902b Merge pull request #142 from hermeznetwork/feature/api-boilerplate
Add GET histroy-transactions endpoint
2020-09-22 15:39:13 +02:00
arnaucube
5d6f8cd3ec Add TxSelector L2Tx filtering logic 2020-09-22 13:31:48 +02:00
Arnau B
85fe885265 Add GET histroy-transactions endpoint 2020-09-22 13:21:28 +02:00
arnaucube
934b6120ae Add StateDB set & get Idx by EthAddr & BJJ methods 2020-09-21 22:02:20 +02:00
Eduard S
05b273cc00 Merge pull request #128 from hermeznetwork/feature/l1txbytes
Update common.L1Tx parsers, add test checks
2020-09-21 15:40:49 +02:00
arnaucube
3013fbacb6 Change endianness to BigEndian :(
Change endianness to BigEndian (ಥ﹏ಥ), spec has been updated to achieve
compatibility with js & smart contracts & circuits implementations.
2020-09-21 15:10:01 +02:00
Eduard S
35a558f6c9 Merge pull request #135 from hermeznetwork/feature/synchronizer-sc
Smart Contracts Data Synchronization
2020-09-21 14:40:10 +02:00
Eduard S
9f83fcf520 Review synchronizer, rearange some stuff, add notes and TODOs. 2020-09-21 14:33:07 +02:00
arnaucube
92fa8aa439 Update common.L1Tx parsers, add test checks 2020-09-18 20:52:43 +02:00
Arnau B
94e1f11a98 Implement L2DB 2020-09-18 10:17:51 +02:00
ToniRamirezM
145f37b135 Smart Contracts Data Synchronization 2020-09-17 15:19:54 +02:00
a_bennassar
8a21cd1b5c Add HistoryDB SQL triggers (#125) 2020-09-17 11:57:42 +02:00
a_bennassar
05d183d07b Merge pull request #127 from hermeznetwork/feature/txsel-txsselection-v0
TxSelector GetL2TxSelection & GetL1L2TxSelection integrated with dbs
2020-09-16 13:54:53 +02:00
arnaucube
41715e47ba TxSel integrated with L2DB, Add L1CoordTx creation
- GetL2TxSelection & GetL1L2TxSelection integrated with dbs
- Create L1CoordinatorTx of type CreateAccountDeposit when a L2
requires it (and the AccountCreationAuth exists)
2020-09-16 12:40:56 +02:00
arnau
b0cfcb0d50 Merge pull request #111 from hermeznetwork/feature/L1TxCodec
L1Tx Codec
2020-09-15 11:57:07 +02:00
Eduard S
d416203f10 Merge pull request #114 from hermeznetwork/feature/compute-zkinputs
Feature/compute zkinputs
2020-09-10 18:02:19 +02:00
arnaucube
69fe471f11 Add StateTree leafs & ExtTree data ZKI calculation 2020-09-10 17:58:08 +02:00
ToniRamirezM
a8f6488eb1 L1Tx Codec 2020-09-10 13:32:22 +02:00
Eduard S
475614cc3a Implement first iteration of node
The coordinator implementation has been refactored to allow all the goroutines
to be handled from the node.
2020-09-10 11:36:58 +02:00
arnaucube
aa0bde61d2 Add StateDB ZKInputs generation for L1 & L2 Txs 2020-09-09 14:40:55 +02:00
arnaucube
a7fe80f150 Refactor ZKInputs & add struct initialization
Refactor ZKInputs & add struct initialization & add BJJCompressedTo256BigInts util
2020-09-09 14:16:09 +02:00
Eduard S
56604ecc69 Use int64 for blockNum (like it's sroted in DB) 2020-09-07 18:09:27 +02:00
Eduard S
003c353f05 Add ethclient full skeleton 2020-09-07 17:29:55 +02:00
krlosMata
4d02308057 update zkInputs (#104)
* update zkInputs

* ZKInputs clean uncomment use nolint

Co-authored-by: arnaucube <root@arnaucube.com>
2020-09-04 09:49:23 +02:00
arnaucube
fdaf2c9ce2 Update log package with fields & file log
Update log package with fields & file log, and update constants in the
repository code to be MixedCase.

resolves #91, resolves #92, resolves #95
2020-09-02 10:56:48 +02:00
arnaucube
cbbcb65c8c Add lint checks: gofmt, goimports, golint
- gofmt - Gofmt checks whether code was gofmt-ed. By default this tool runs
  with -s option to check for code simplification
- goimports - Goimports does everything that gofmt does. Additionally it checks
  unused imports
- golint - Golint differs from gofmt. Gofmt reformats Go source code, whereas
  golint prints out style mistakes
    - checks the uncommented exported functions & types

Update the code to fix the lint checks.
2020-08-31 12:32:05 +02:00
arnaucube
fd1e9c25ee Add linter checks to GHA & Fix code to pass lints
Add linter checks to GHA & Fix code to pass lints.
The linters added are:
- whitespace: Tool for detection of leading and trailing whitespace
- gosec: Inspects source code for security problems
- gci: Gci control golang package import order and make it always deterministic
- misspell: Finds commonly misspelled English words in comments
- gomnd: An analyzer to detect magic numbers

The file utils/utils.go is excluded from the checks of gomnd, as uses magic numbers through the code
2020-08-28 09:58:39 +02:00
arnaucube
9309722dfc Update StateDB to new & ExitInfo struct & BatchNum
Update StateDB to new & ExitInfo struct & BatchNum
Also a small fix at txselector & log packages
2020-08-26 18:28:53 +02:00
Arnau B
3e7173b1da Impl historyDB methods for sync main loop 2020-08-26 14:31:24 +02:00
Arnau B
c108739c24 Add usefull methods for reorg 2020-08-25 14:15:12 +02:00
Arnau B
1cbf54acc7 Add sync interface 2020-08-25 14:14:51 +02:00
arnaucube
b4044a2ef7 Add abstraction method of processTxs to StateDB
- Update GHA lint.yml increasing timeout time to avoid GHA Lint errors
- Update common.BatchNum & common.Idx & common.Nonce usage in StateDB
- Add abstraction method of processTxs to StateDB
    - Which will be used by Synchronizer & BatchBuilder
2020-08-24 13:06:51 +02:00
arnaucube
b33d18ff55 Import & adapt iden/go-iden3-core/eth/client 2020-08-24 11:19:39 +02:00
arnaucube
7fa658cc84 Add PoolL2Tx verify signature needed methods
Implements the hash to be signed from PoolL2Tx, compatible with javascript version.
Implements the signature verification for a given PoolL2Tx.
2020-08-24 09:46:25 +02:00
arnaucube
a28c81f4ae Add TxCompressedData & V2 with some extra parsers for common 2020-08-21 15:35:31 +02:00