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

Feat: use cmd to setup data committee #3

Open
wants to merge 129 commits into
base: develop
Choose a base branch
from

Conversation

lesterli
Copy link
Member

@lesterli lesterli commented Sep 6, 2023

Summary

  • SNA-301, add a new CLI command to register DAC node
  • SNA-302, add a new command make run-validium in the makefile

Test Plan

  1. Update the docker image, docker pull snapchain/cdk-validium-node
  2. Run make run-validium

ToniRamirezM and others added 30 commits June 30, 2023 16:40
* Hotfix v0.1.4 to main (0xPolygonHermez#2250)

* fix concurrent web socket writes

* fix eth_syncing

* fix custom trace internal tx call error handling and update prover

* add test to custom tracer depth issue; fix internal call error and gas used

* fix custom tracer for internal tx with error and no more steps after it

* remove debug code

* Make max grpc message size configurable  (0xPolygonHermez#2179)

* make max grpc message size configurable

* fix state tests

* fix tests

* fix tests

* get SequencerNodeURI from SC if empty and not IsTrustedSequencer

* Optimize trace (0xPolygonHermez#2183)

* optimize trace

* fix memory reading

* update docker image

* update prover image

* fix converter

* fix memory

* fix step memory

* fix structlogs

* fix structlogs

* fix structlogs

* fix structlogs

* fix structlogs

* fix structlogs

* fix structlogs

* fix structlogs

* update prover image

* fix struclogs

* fix memory size

* fix memory size

* fix memory size

* refactor memory resize

* refactor memory resize

* move log for the best fitting tx (0xPolygonHermez#2192)

* fix load zkCounters from pool

* remove unnecessary log.info

* add custom tracer support to CREATES opcode without depth increase (0xPolygonHermez#2213)

* logs

* fix getting stateroot from previous batch (GetWIPBatch)

* logs

* Fix GetWipBatch when previous last batch is a forced batch

* fix forcedBatch trusted state

* Revert "fix getting stateroot from previous batch (GetWIPBatch)"

This reverts commit 860f0e7.

* force GHA

* add pool limits (0xPolygonHermez#2189)

* Hotfix/batch l2 data (0xPolygonHermez#2223)

* Fix BatchL2Data

* Force GHA

* remove failed txs from the pool limit check (0xPolygonHermez#2233)

* debug trace by batch number via external rpc requests (0xPolygonHermez#2235)

* fix trace batch remote requests in parallel limitation (0xPolygonHermez#2244)

* Added RPC.TraceBatchUseHTTPS config parameter

* fix executor version

---------

Co-authored-by: tclemos <[email protected]>
Co-authored-by: tclemos <[email protected]>
Co-authored-by: Toni Ramírez <[email protected]>
Co-authored-by: agnusmor <[email protected]>
Co-authored-by: agnusmor <[email protected]>
Co-authored-by: Thiago Coimbra Lemos <[email protected]>

* fix test

* fix test

---------

Co-authored-by: tclemos <[email protected]>
Co-authored-by: tclemos <[email protected]>
Co-authored-by: Toni Ramírez <[email protected]>
Co-authored-by: agnusmor <[email protected]>
Co-authored-by: agnusmor <[email protected]>
Co-authored-by: Thiago Coimbra Lemos <[email protected]>
* effective GasPrice refactor

* bugs fixes and finalizer tests fixes

* fix typo

* fix calculate effective gasprice percentage

* fix test gas price
…#2258)

* effective gas price returned by the rpc in the receipt

* linter
…#2260)

* bugfix: fixing l2blocks timestamp for the fist batch

Signed-off-by: Nikolay Nedkov <[email protected]>

* fix finalizer unit test

---------

Signed-off-by: Nikolay Nedkov <[email protected]>
…ssword from etherman.Config that are not in use
* fix fea2scalar and gas used

* suggestion

* fix fea2scalar

* suggestion
* fix pending tx when duplicate nonce

* set pool.transaction.failed_reason to NULL when updating an existing tx

* add more log details when adding tx to AddrQueue

* fix query to add tx to the pool. Fix lint errors

* change failed_reason for tx discarded due duplicate nonce
…ermez#2273)

* Return a tx from the pool only if it is

* fix TestGetTransactionByHash

---------

Co-authored-by: agnusmor <[email protected]>
…xPolygonHermez#2200-add-documentation-for-node-config-file-2

Feature/0xPolygonHermez#2200 generate json-schema + docs for node config file and network_custom
…add-check-for-fork-id-to-skip-effectivePercentage

improve: adding check to skip appending effectivePercentage if current forkId is under 5.
…stop-sequencer-on-batch-num

feat: adding functionality to stop sequencer on specific batch num from config param.
…d-print-for-X-Real-IP

patch: adding print for X-Real-IP in JSON-RPC
@lesterli lesterli requested a review from bap2pecs September 6, 2023 11:56
@lesterli lesterli changed the title Feat: SNA-301&302 use cmd to setup data committee Feat: SNA-301 & SNA-302 use cmd to setup data committee Sep 7, 2023
@lesterli lesterli changed the title Feat: SNA-301 & SNA-302 use cmd to setup data committee Feat: use cmd to setup data committee Sep 7, 2023
Copy link
Member

@bap2pecs bap2pecs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work! let's discuss whether we want to support multiple DAC member registration at the same time or not

return err
}
if !ctx.Bool(config.FlagYes) {
fmt.Println("*WARNING* Are you sure you want to setup committee? [y/N]: ")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also print out some key info here (e.g. the URL, the address)

return err
}

dataCommitteeContract := c.DataAvailability.L1.DataCommitteeAddress
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is dacSC defined below, this name is a bit confusing

I think we can rename dataCommitteeContract to dacSCAddress

return err
}

const nSignatures = 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this command, we assume the user is always going to only add 1 DAC member. I think we should support multiple per the interface

function setupCommittee(
        uint _requiredAmountOfSignatures,
        string[] calldata urls,
        bytes calldata addrsBytes
    )

so here nSignatures will be a user param

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree

if err != nil {
return err
}
log.Infof("decrypting dac member key from: %v", c.DataAvailability.PrivateKey.Path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we use fmt.Println sometimes and log in other places? do you know the differences?

}
dacMemberAddress := dacMemberKey.Address
fmt.Println("dacMemberAddress: ", dacMemberAddress)
dacServiceURL := fmt.Sprintf("http://%s:%d", c.DataAvailability.RPC.Host, c.DataAvailability.RPC.Port)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if the service url is HTTPS? if we ask the user to specify the URL, this problem will be resolved

addrsBytes := []byte{}
urls := []string{}

// load dac member from keystore file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to load the DAC member from the keystore file. also given that if we were to support multiple DAC member, we need to load multiple files and that will need multiple passwords to decrypt those files which can be too complicated.

can we keep it simple by just asking the user to specify the list of DAC member addresses and URLs in the config file?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, in general, the admin is the one who sends the L1 tx to setup the committee, but this admin:

  • shouldn't be part of the committee
  • shouldn't know the private keys of the committee

this is intentional, as the hole idea is that the DAC and the admin of the network are different entities

Copy link

@arnaubennassar arnaubennassar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DAC config shouldn't be part of the config of the node. Instead, the CLI to setup the committee should have a custom input (either in the form of a config file, or directly through the CLI) that has the following data:

  • N required signatures
  • List of DAC members {address, URL}

&cli.StringFlag{
Name: config.FlagPassword,
Aliases: []string{"pw"},
Usage: "the password do decrypt the key store file",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Usage: "the password do decrypt the key store file",
Usage: "the password to decrypt the key store file",

return err
}

const nSignatures = 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree

addrsBytes := []byte{}
urls := []string{}

// load dac member from keystore file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, in general, the admin is the one who sends the L1 tx to setup the committee, but this admin:

  • shouldn't be part of the committee
  • shouldn't know the private keys of the committee

this is intentional, as the hole idea is that the DAC and the admin of the network are different entities

@bap2pecs
Copy link
Member

bap2pecs commented Sep 7, 2023

@lesterli let's also modify the test at https://github.com/Snapchain/cdk-validium-node/blob/develop/test/e2e/datacommittee_test.go to use the CLI to register the committee so we can test this new feature

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.

10 participants