Skip to content
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

fork LTS (merge main into release-lts-1) #1215

Merged
merged 11 commits into from
Dec 11, 2023
Merged

fork LTS (merge main into release-lts-1) #1215

merged 11 commits into from
Dec 11, 2023

Conversation

altergui
Copy link
Contributor

  • cleanup unused leftovers
  • vochain: pass whole vochainCfg to NewBaseApplication
  • renamed confusing VochainCfg.Chain -> VochainCfg.Network
  • util: move zk.BigToFF and zk.BytesToArboStr to util package
  • vochain fork: refactor ZkCircuits handling
  • vochain/indexer: add an Options struct
  • vochain/indexer: invert "live results" option
  • vochain/indexer: move DataDir to Options
  • vochain/indexer: add support for backups
  • vochain fork: bump vocdoni/STAGE/9 ForkBlock

altergui and others added 11 commits December 5, 2023 11:55
* TransactionHandler.ZkVKs
* genesis.Circuits
this avoids an import cycle in upcoming refactor of circuit package
* circuit package now has a Global() circuit, and all packages (including TransactionHandler) use that
* circuit/config.go: rename `dev` -> `v0.0.1` and add voceremony as `v1.0.0`
* circuit/config.go: rename `tag` concept into `version`
* circuit/config.go: now ZkCircuitConfig has Version field, drop app.circuitConfigTag
* circuit/config.go: now PublicSignals is a property of each circuit (previously hardcoded in prover)
* prover: use PubSignals from circuit.Global() instead of hardcoded indexes
* api: /chain/info now returns circuitVersion (instead of misspelt cicuitConfigurationTag)
* apiclient: small fix, LoadZkCircuit once on NewHTTPclient instead of every Vote
* testsuite: mount zkCircuits cache dir in test container as well
* vochain/app.go: SetZkCircuit during beginBlock
* add config/forks.go
* circuit: add DownloadArtifacts funcs
  * DownloadArtifactsForChainID
  * DownloadDefaultArtifacts
* NewBaseApplication now calls circuit.DownloadDefaultArtifacts instead of transactionHandler.LoadZkCircuit
* newTendermint now calls circuit.DownloadArtifactsForChainID
We will add more options like a backup file to restore from,
and more boolean or string parameters will start getting confusing.
A struct also allows us to add more options in the future
without immediately breaking existing users.

While here, rename indexer.NewIndexer to indexer.New to avoid repetition.
This matches IndexerCfg.IgnoreLiveResults and Indexer.ignoreLiveResults,
so the logic is now overall simpler and we don't negate twice.

Moreover, the vast majority of calls do want to count live results,
such as all the calls to newTestIndexer, so those can default to false.
Simplifies the function calls a bit.
A new SaveBackup method which creates a backup to a file on disk,
and a new RestoreBackup method which can restore them.
Note that the restoring can only happen shortly after calling New,
since otherwise any indexing or queries happening at the same time
can easily lead to bad data since they would race to lock the database.

This only implements backing up and restoring from a file on disk.
Future changes will integrate this with the rest of the codebase,
such as taking regular backups or listing the stored backups.

Updates #1062.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 7167888524

  • 196 of 250 (78.4%) changed or added relevant lines in 24 files are covered.
  • 8 unchanged lines in 5 files lost coverage.
  • Overall coverage increased (+0.05%) to 61.952%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crypto/ethereum/vocdoni_sik.go 4 5 80.0%
crypto/zk/circuit/inputs.go 3 4 75.0%
util/zk.go 18 19 94.74%
vochain/transaction/election_tx.go 1 2 50.0%
api/chain.go 14 16 87.5%
apiclient/client.go 3 5 60.0%
config/forks.go 3 5 60.0%
crypto/zk/circuit/config.go 4 6 66.67%
crypto/zk/prover/prover.go 10 13 76.92%
vochain/start.go 7 10 70.0%
Files with Coverage Reduction New Missed Lines %
cmd/end2endtest/account.go 1 66.31%
vochain/indexer/indexer.go 1 68.87%
api/accounts.go 2 54.76%
apiclient/account.go 2 40.53%
crypto/zk/prover/prover.go 2 80.85%
Totals Coverage Status
Change from base Build 7046960729: 0.05%
Covered Lines: 14861
Relevant Lines: 23988

💛 - Coveralls

@altergui altergui merged commit b8a8d92 into release-lts-1 Dec 11, 2023
40 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants