Skip to content

feat: blob mode for loadtest #292

Merged
jhkimqd merged 6 commits into
0xPolygon:mainfrom
jhkimqd:jihwan/loadtest-blob
Jun 4, 2024
Merged

feat: blob mode for loadtest #292
jhkimqd merged 6 commits into
0xPolygon:mainfrom
jhkimqd:jihwan/loadtest-blob

Conversation

@jhkimqd
Copy link
Copy Markdown
Contributor

@jhkimqd jhkimqd commented Jun 3, 2024

Description

This PR includes blob mode for polycli loadtest. The new mode sends an EIP-4844 blob transaction. Usage is identical to other loadtest modes e.g.- loadtest --requests 10 --rpc-url <rpc_url> --to-random --verbosity 700 --rate-limit 1 --concurrency 1 --mode \"blob\" --private-key <private_key> will send 10 blob transactions with randomly generated blob and its sidecars:

	blobTx := ethtypes.BlobTx{
		ChainID:    uint256.NewInt(chainID.Uint64()),
		Nonce:      nonce,
		GasTipCap:  uint256.NewInt(gasTipCap.Uint64()),
		GasFeeCap:  uint256.NewInt(gasPrice.Uint64()),
		BlobFeeCap: uint256.NewInt(blobFeeCap),
		Gas:        gasLimit,
		To:         *to,
		Value:      uint256.NewInt(amount.Uint64()),
		Data:       nil,
		AccessList: nil,
		BlobHashes: make([]common.Hash, 0),
		Sidecar: &types.BlobTxSidecar{
			Blobs:       make([]kzg4844.Blob, 0),
			Commitments: make([]kzg4844.Commitment, 0),
			Proofs:      make([]kzg4844.Proof, 0),
		},
	}

The blob fee cap is adjustable using the --blob-fee-cap flag, and the default value is at 100,000 Gwei.

Jira / Linear Tickets

Testing

Tested on a Kurtosis-CDK Geth node.

Blob transaction using cast shows a successful transaction of type 0x03

cast-send-blob

Blob transaction using polycli loadtest --mode "blob" similarly shows the same transaction type when queried using cast receipt <blob_txn_hash>

polycli-blob-receipt

@jhkimqd jhkimqd requested a review from praetoriansentry June 3, 2024 07:09
@gitguardian
Copy link
Copy Markdown

gitguardian Bot commented Jun 3, 2024

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
- Generic High Entropy Secret 8d9038c cmd/loadtest/loadtest.go View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Signed-off-by: Ji Hwan <jkim@polygon.technology>
@jhkimqd jhkimqd force-pushed the jihwan/loadtest-blob branch from 6a34103 to 8d9038c Compare June 3, 2024 07:27
Comment thread cmd/loadtest/loadtest.go
leovct
leovct previously approved these changes Jun 3, 2024
Copy link
Copy Markdown
Member

@leovct leovct left a comment

Choose a reason for hiding this comment

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

lgtm

nit: I find that the function names are not very clear, especially parseBlobRefs and e/EncodeBlobData (two methods with the same name).

Signed-off-by: Ji Hwan <jkim@polygon.technology>
@leovct
Copy link
Copy Markdown
Member

leovct commented Jun 3, 2024

lgtm

nit: I find that the function names are not very clear, especially parseBlobRefs.

I was thinking more along the lines of:

  • encodeBlobData(data []byte) kzg4844.Blob could be renamed createBlob(data []byte) kzg4844.Blob.
  • encodeBlob(data []byte) (*BlobCommitment, error) => generateBlobCommitment(data []byte) (*BlobCommitment, error).
  • parseBlobCommitment(tx *types.BlobTx) error => appendBlobCommitment(tx *types.BlobTx) error.
  • randomBlobData(size int) ([]byte, error) => generateRandomBlobData(size int) ([]byte, error).

What do you think?

Comment thread cmd/loadtest/loadtest.go Outdated
leovct
leovct previously approved these changes Jun 3, 2024
Copy link
Copy Markdown
Member

@leovct leovct left a comment

Choose a reason for hiding this comment

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

lgtm

Signed-off-by: Ji Hwan <jkim@polygon.technology>
Signed-off-by: Ji Hwan <jkim@polygon.technology>
@jhkimqd jhkimqd merged commit 86be30b into 0xPolygon:main Jun 4, 2024
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.

2 participants