Repository navigation
fix: refresh the basefee sharing percentage from the inbox at runtime - #4
Closed
davidtaikocha wants to merge 1 commit into
Closed
davidtaikocha wants to merge 1 commit into
davidtaikocha wants to merge 1 commit into
Conversation
The percentage stamped into every preconfirmed block's extraData was read once at startup, copied by value into ProtocolConfig and cloned into the block advancer, so it could only change with a restart. It is an immutable of the inbox implementation and changes when the DAO upgrades the inbox proxy (taikoxyz/taiko-mono#22127 raises it from 75 to 100). A node still on the stale value after the upgrade builds blocks the driver re-derives with the new value once they are proposed: the same transactions with a different extraData and state root, i.e. one preconfirmation reorg per block until the node restarts. ProtocolConfig now keeps the percentage behind an Arc<AtomicU8> shared by every clone, and the shasta node spawns a task that re-reads it from Inbox.getConfig() every L1 slot, logging a change, keeping the last value on RPC errors and exiting on shutdown. Blocks built from the next slot after an upgrade carry the new value with no restart. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🧩 What was the bug?
The basefee sharing percentage stamped into every preconfirmed block's
extraData(byte 0) was read fromInbox.getConfig()exactly once, at startup:ProtocolConfig::frominTaiko::newcopied it into a plainu8, andNode::newcloned that struct into the block advancer. Nothing ever updated it.The percentage is an immutable of the inbox implementation, so it changes whenever the DAO upgrades the inbox proxy. taikoxyz/taiko-mono#22127 (Proposal0024) does exactly that on mainnet, raising it from 75 to 100. The driver derives the blocks of a proposal with the value the inbox emits in the
Proposedevent, so a Catalyst node still on the cached 75 after the upgrade keeps building blocks that get replaced once they are proposed: same transactions, differentextraDataand state root. That is one preconfirmation reorg per block, for as long as the node is not restarted.📎 Related issues (optional)
taikoxyz/taiko-mono#22127 (Proposal0024, the upgrade that changes the value).
🔧 What's been fixed?
ProtocolConfigkeepsbasefee_sharing_pctgbehind anArc<AtomicU8>, so every clone of the config (the block advancer's included) sees the current value.ProtocolConfig::new(chain_id, pctg)is added andfromdelegates to it;set_basefee_sharing_pctgreturns the previous value.ProtocolConfig::spawn_basefee_sharing_pctg_refreshruns a background task that re-reads the percentage through a caller-suppliedfetcheveryperiod, logs a change atinfo, keeps the last value on an RPC error (retried next tick), and exits when the cancellation token fires. It returns theJoinHandle.create_shasta_nodespawns it withEthereumL1::fetch_inbox_configand a period of one L1 slot (L1_SLOT_DURATION_SEC), right afterTaikois built. OnegetConfigcall per L1 slot, off the block-building path.After an inbox upgrade, blocks built from the next L1 slot on carry the new value, with no restart.
💬 Anything else reviewers should know?
ProtocolConfig(realtime/src/l1/protocol_config.rs) and passes the percentage by value into its node and submitter. It is not touched here.cargo clippy --teststrips a pre-existingunusual_byte_groupingslint inshasta/src/l2/extra_data.rs(a test literal); CI lints without--tests, and this PR leaves that file alone.✅ Checklist
refresh_tracks_the_inbox_and_keeps_the_last_value_on_errorsdrives the refresh loop with a fake inbox under paused time, sees the value flip 75 → 100 on the next tick, stay at 100 through a failed read, and the task exit on cancellation;clones_share_the_basefee_sharing_pctgpins that the block advancer's clone observes the update.cargo test -p shasta --lib --locked(64 tests),cargo fmt --all -- --check,cargo clippy -p shasta --all-features --locked -- -D warnings.bugfix/<name>:bugfix/refresh-basefee-sharing-pctg.🤖 Generated with Claude Code