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

Add IP and ZKCounter Validation, Refactor Batch Configs #2298

Merged
merged 8 commits into from
Aug 18, 2023

Conversation

Psykepro
Copy link
Contributor

@Psykepro Psykepro commented Jul 18, 2023

Closes #2284.

What does this PR do?

This pull request introduces some crucial enhancements aimed at optimizing our system's resource management and ensuring a more consistent operation.

Changes

  1. Transaction Pool IP Verification:

    • We've incorporated an IP verification process in the tryToAddTxToPool function. This new feature checks the validity of IP addresses obtained from the X-Forwarded-For header.
  2. Worker's IP Verification:

    • To further solidify the validity of IP addresses, we've added IP verification to the Worker.AddTxTracker. This helps ensure that all transactions are associated with valid IP addresses before being added to the efficiency list.
  3. BatchConfig Integration and Verification:

    • The BatchConstraints and BatchResourceWeights configuration values have been streamlined into a unified BatchConfig structure. The JSON-RPC now utilizes this to check if a transaction stays within the predefined resource constraints. Transactions surpassing these constraints will be prevented from entering the transaction pool. Similarly, the Sequencer will sidestep such transactions, ensuring they are not added to the Worker's efficiency list.

    • The State, StateDB and Batch Config Parameters now will look like that:

    [State]
        [State.DB]
        User = "state_user"
        Password = "state_password"
        Name = "state_db"
        Host = "zkevm-state-db"
        Port = "5432"
        EnableLog = false	
        MaxConns = 200
        [State.Batch]
    	    [State.Batch.Constraints]
    	    MaxTxsPerBatch = 300
    	    MaxBatchBytesSize = 120000
    	    MaxCumulativeGasUsed = 30000000
    	    MaxKeccakHashes = 2145
    	    MaxPoseidonHashes = 252357
    	    MaxPoseidonPaddings = 135191
    	    MaxMemAligns = 236585
    	    MaxArithmetics = 236585
    	    MaxBinaries = 473170
    	    MaxSteps = 7570538
    	    [State.Batch.ResourceWeights]
    	    WeightBatchBytesSize = 1
    	    WeightCumulativeGasUsed = 1
    	    WeightKeccakHashes = 1
    	    WeightPoseidonHashes = 1
    	    WeightPoseidonPaddings = 1
    	    WeightMemAligns = 1
    	    WeightArithmetics = 1
    	    WeightBinaries = 1
    	    WeightSteps = 1

Reviewers

Codeowner reviewers:

@cla-bot cla-bot bot added the cla-signed label Jul 18, 2023
@Psykepro Psykepro self-assigned this Jul 18, 2023
@Psykepro Psykepro force-pushed the bugfix/ip-validation branch 2 times, most recently from e60b3f4 to 8af4eb9 Compare July 18, 2023 14:40
@Psykepro Psykepro added this to the v0.3.0 milestone Jul 18, 2023
@Psykepro Psykepro force-pushed the bugfix/ip-validation branch 2 times, most recently from 7ede197 to 6edbb17 Compare July 19, 2023 09:59
@Psykepro Psykepro changed the title Enhance Security: Add IP and ZKCounter Validation, Refactor Batch Configs Add IP and ZKCounter Validation, Refactor Batch Configs Jul 19, 2023
config/environments/local/local.node.config.toml Outdated Show resolved Hide resolved
pool/config.go Outdated Show resolved Hide resolved
sequencer/efficiencylist.go Outdated Show resolved Hide resolved
test/config/debug.node.config.toml Outdated Show resolved Hide resolved
test/config/test.node.config.toml Outdated Show resolved Hide resolved
Signed-off-by: Nikolay Nedkov <nikolai_nedkov@yahoo.com>
Signed-off-by: Nikolay Nedkov <nikolai_nedkov@yahoo.com>
Signed-off-by: Nikolay Nedkov <nikolai_nedkov@yahoo.com>
@Psykepro Psykepro force-pushed the bugfix/ip-validation branch 2 times, most recently from cf3b3e7 to 0372625 Compare July 27, 2023 13:30
Signed-off-by: Nikolay Nedkov <nikolai_nedkov@yahoo.com>
Signed-off-by: Nikolay Nedkov <nikolai_nedkov@yahoo.com>
Signed-off-by: Nikolay Nedkov <nikolai_nedkov@yahoo.com>
…ix env vars resolving for 'permisionless-node'.

Signed-off-by: Nikolay Nedkov <nikolai_nedkov@yahoo.com>
Signed-off-by: Nikolay Nedkov <nikolai_nedkov@yahoo.com>
@Psykepro Psykepro merged commit b8f23d2 into develop Aug 18, 2023
17 checks passed
@Psykepro Psykepro deleted the bugfix/ip-validation branch August 18, 2023 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance System Robustness with Improved Validations and Configuration Management
3 participants