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

Provide endpoint for querying L1 costs #110

Open
MujkicA opened this issue Aug 26, 2024 · 3 comments · May be fixed by #146
Open

Provide endpoint for querying L1 costs #110

MujkicA opened this issue Aug 26, 2024 · 3 comments · May be fixed by #146
Assignees
Labels
enhancement New feature or request

Comments

@MujkicA
Copy link
Contributor

MujkicA commented Aug 26, 2024

The following interface was discussed with the client team:

struct Bundle {
	sequence_number: u64,
	blocks_range: Range<BlockHeight>,
	// The DA block height of the last transaciton in the bundle.
	da_block_height: DaBlockHeight,
	// Cost of the bundle
	cost: u128,
	// Size of the bundle
	size: u64,
	// Total cost of all bundles for the whole history.
	total_cost: u256,
	// Total size of all bundles for the whole history.
	total_size: u256,
}

trait CommitterAPI {
	fn get_n_last_bundle(&self, number: u64) -> Result<Bundle>;
}

To support the proposed interface, the database schema will need to be updated to store the final costs and sizes associated with each bundle. It's important to note that we can only provide cost information for contiguous block ranges, which were selected to be a bundle by our gas_per_uncompressed_bytes minimization algorithm.

The number of blocks contained in a bundle is variable but can be bounded through a config parameter with a preference towards including more blocks to achieve better compression. Limited experimentation on the testnet has shown good results when targeting up to 3600 blocks per bundle.

The client team also requested retrieving bundles based on a range of block heights:

fn get_bundles_by_range(&self, range: Range<u64>) -> Result<Vec<Bundle>>;

This method allows querying for bundles that overlap with a specific block range. For example, if the existing bundles have the following inclusive ranges:
[10, 19] [20, 29] [30, 39] [40, 49]
And the requested range is [25, 35], the system will return all bundles that intersect with the requested range:
[20, 29], [30, 39]

@MujkicA
Copy link
Contributor Author

MujkicA commented Oct 1, 2024

@MitchTurner , @rymnc

@rymnc
Copy link
Member

rymnc commented Oct 1, 2024

hmm, i think it should return a value only if the bundle is "wholly" included in the range.

@MujkicA
Copy link
Contributor Author

MujkicA commented Oct 1, 2024

We can do that too but you will need to know the exact start and end height of a bundle. You can always infer the start height from the previous bundle but there is no way of determining the end height unless you've retrieved it previously.

@MujkicA MujkicA linked a pull request Oct 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants