-
Notifications
You must be signed in to change notification settings - Fork 43
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(provider): add a local bedrock DA provider #836
Conversation
async fn get_block_da_data(&self, block: BlockHashOrNumber) -> ProviderResult<BlockDAData> { | ||
assert!(self.is_fjord().await); | ||
|
||
let base_fee_scalar = self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: use a helper contract to make this 1 network call.
|
||
fn fjord_l1_fee(data: Bytes, block_da_data: &BlockDAData) -> u128 { | ||
let mut buf = vec![0; data.len() * 2]; | ||
let compressed = rundler_bindings_fastlz::compress(&data, &mut buf); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: consider doing this on a specific blocking thread pool
fn fjord_l1_fee(data: Bytes, block_da_data: &BlockDAData) -> u128 { | ||
let mut buf = vec![0; data.len() * 2]; | ||
let compressed = rundler_bindings_fastlz::compress(&data, &mut buf); | ||
let compressed_length = compressed.len() as u64; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: cache this value.
ce9b0ef
to
0d5b477
Compare
// This test may begin to fail if an optimism sepolia fork changes how the L1 gas oracle works. | ||
// If that happens, we should update the local bedrock oracle to match the new fork logic in | ||
// a backwards compatible way based on the fork booleans in the contract. | ||
#[tokio::test] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likely have to set these tests to #[ignore]
due to the flakey-ness of the RPC endpoint.
0d5b477
to
efb0953
Compare
sol! { | ||
#[sol(rpc)] | ||
interface GasPriceOracle { | ||
bool public isFjord; | ||
|
||
function baseFeeScalar() public view returns (uint32); | ||
function l1BaseFee() public view returns (uint32); | ||
function blobBaseFeeScalar() public view returns (uint32); | ||
function blobBaseFee() public view returns (uint32); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when react! {...}
so we can do everything in rust XD
this is really cool
gas_price: u128, | ||
) -> ProviderResult<u128> { | ||
let block_da_data = { | ||
let mut cache = self.block_da_data_cache.lock().await; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol these names are amazing "block da data cache" "estimate da gas" -- "do da thing".
ok I'm done these comments are not at all helpful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol I read it the same way. Got 50 cent stuck in my head writing this
Related to #744
Proposed Changes
fastlz
binding at a specific commit. This commit is specifically the same used byLibZip.sol
, which is used by the optimism DA oracle contract.TODO:
BlockDAData
in a singleeth_call
fastlz
compression on each block for each user operation. Its highly likely we need the following:fastlz
compressed size for each UO by hash. This only needs to be done once.fastlz
compression to a specific threadpool for blocking operations.