-
Notifications
You must be signed in to change notification settings - Fork 444
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
Timeboost Bulk BlockMetadata API #2754
base: add-timeboosted-broadcastfeedmessage
Are you sure you want to change the base?
Timeboost Bulk BlockMetadata API #2754
Conversation
I'm afraid I cannot realistically review this with everything going on with BoLD. Sorry. Removing myself as a reviewer for now. |
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.
looks good, just a question about hexutil.Uint64
use instead of rpc.BlockNumber
and some nitpicks
} | ||
} | ||
|
||
func (b *BulkBlockMetadataFetcher) Fetch(fromBlock, toBlock hexutil.Uint64) ([]NumberAndBlockMetadata, error) { |
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.
is there a reason for using hexutil.Uint64
here instead of rpc.BlockNumber
?
@@ -41,6 +43,90 @@ import ( | |||
"github.com/stretchr/testify/require" | |||
) | |||
|
|||
func TestTimeboosBulkBlockMetadataAPI(t *testing.T) { |
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.
Timeboos
typo :)
@@ -99,6 +103,9 @@ func ConfigAddOptions(prefix string, f *flag.FlagSet) { | |||
f.Uint64(prefix+".tx-lookup-limit", ConfigDefault.TxLookupLimit, "retain the ability to lookup transactions by hash for the past N blocks (0 = all blocks)") | |||
f.Bool(prefix+".enable-prefetch-block", ConfigDefault.EnablePrefetchBlock, "enable prefetching of blocks") | |||
StylusTargetConfigAddOptions(prefix+".stylus-target", f) | |||
f.Int(prefix+".block-metadata-api-cache-size", ConfigDefault.BlockMetadataApiCacheSize, "size of lru cache storing the blockMetadata to service arb_getRawBlockMetadata.\n"+ | |||
"Note: setting a non-zero value would mean the blockMetadata might be outdated (if the block was reorged out).\n"+ |
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.
can we somehow trigger clearing the cache on reorg?
} | ||
|
||
func (a *ArbAPI) CheckPublisherHealth(ctx context.Context) error { | ||
return a.txPublisher.CheckHealth(ctx) | ||
} | ||
|
||
func (a *ArbAPI) GetRawBlockMetadata(ctx context.Context, fromBlock, toBlock hexutil.Uint64) ([]NumberAndBlockMetadata, error) { |
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.
similarly to (b *BulkBlockMetadataFetcher) Fetch
, is there a reason to not use rpc.BlockNumber
here?
defer cleanup() | ||
|
||
arbDb := builder.L2.ConsensusNode.ArbDB | ||
dbKey := func(prefix []byte, pos uint64) []byte { |
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.
nitpick: looks like dbKey
is only used here []byte("t")
prefix - can we rename it to something like blockMetadataInputFeedKey
and take only block number as argument?
or alternatively we might define a const blockMetadataInputFeedPrefix = []byte("t")
in the test?
This PR introduces an RPC method to the
arb
namespace calledarb_getRawBlockMetadata
, which takes a range and returns an array ofNumberAndBlockMetadata
struct which contains theblockNumber
andblockMetadata
in hex encoding, for all the blocks in the range that the node hasblockMetadata
for.To enhance performance, the api uses LRU cache to store the newly fetched blockMetadata from local DB, this can be enabled by setting
--execution.block-metadata-api-cache-size
to a positive value.Resolves NIT-2837