Skip to content

Commit

Permalink
fix(relayer): don't use fixed fee pricing (#590)
Browse files Browse the repository at this point in the history
## Summary
Updates the fee payments to use default pricing.

## Background
Where were spending .1 TIA for each blob, and it can/should be much
cheaper.

## Changes
- removes the gas limit config for relayer
- relies on market pricing from node to write data to celestia

## Breaking Changes
Removed a config entry

## Testing
CI + Deployed against mocha network to test pricing
  • Loading branch information
joroshiba authored Nov 18, 2023
1 parent fbf7139 commit fe9b8d5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 20 deletions.
3 changes: 0 additions & 3 deletions crates/astria-sequencer-relayer/local.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ ASTRIA_SEQUENCER_RELAYER_CELESTIA_ENDPOINT="http://127.0.0.1:26659"
# on the host running the celestia node.
ASTRIA_SEQUENCER_RELAYER_CELESTIA_BEARER_TOKEN="<JWT Bearer token>"

# The gas limit when paying for submitting blobs to celestia
ASTRIA_SEQUENCER_RELAYER_GAS_LIMIT=1000000

# The duration in milliseconds that sequencer-relayer sleeps before
# requesting a new block from sequencer.
ASTRIA_SEQUENCER_RELAYER_BLOCK_TIME=1000
Expand Down
1 change: 0 additions & 1 deletion crates/astria-sequencer-relayer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pub struct Config {
pub sequencer_endpoint: String,
pub celestia_endpoint: String,
pub celestia_bearer_token: String,
pub gas_limit: u64,
pub block_time: u64,
pub relay_only_validator_key_blocks: bool,
pub validator_key_file: Option<String>,
Expand Down
21 changes: 6 additions & 15 deletions crates/astria-sequencer-relayer/src/relayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ pub(crate) struct Relayer {
// The http client for submitting sequencer blocks to celestia.
data_availability: celestia_client::jsonrpsee::http_client::HttpClient,

// The fee that relayer will pay for submitting sequencer blocks to the DA.
fee: u64,

// The limit that relayer will pay for submitting sequencer blocks to the DA.
gas_limit: u64,

// If this is set, only relay blocks to DA which are proposed by the same validator key.
validator: Option<Validator>,

Expand Down Expand Up @@ -116,9 +110,6 @@ impl Relayer {
sequencer,
sequencer_poll_period: Duration::from_millis(cfg.block_time),
data_availability,
// FIXME (https://github.com/astriaorg/astria/issues/509): allow configuring this
fee: 100_000,
gas_limit: cfg.gas_limit,
validator,
state_tx,
queued_blocks: Vec::new(),
Expand Down Expand Up @@ -251,6 +242,10 @@ impl Relayer {
// Then report update the internal state or report if submission failed
match submission_result {
Ok(height) => self.state_tx.send_modify(|state| {
debug!(
celestia_height=%height,
"successfully submitted blocks to data availability layer"
);
state.current_data_availability_height.replace(height);
}),
// TODO: add more context to this error, maybe inject a span?
Expand Down Expand Up @@ -414,8 +409,6 @@ impl Relayer {
let client = self.data_availability.clone();
self.submission_task = Some(task::spawn(submit_blocks_to_celestia(
client,
self.fee,
self.gas_limit,
self.queued_blocks.clone(),
)));
self.queued_blocks.clear();
Expand Down Expand Up @@ -465,8 +458,6 @@ fn convert_block_response_to_sequencer_block_data(
#[instrument(skip_all)]
async fn submit_blocks_to_celestia(
client: celestia_client::jsonrpsee::http_client::HttpClient,
fee: u64,
gas_limit: u64,
sequencer_block_data: Vec<SequencerBlockData>,
) -> eyre::Result<u64> {
use celestia_client::{
Expand All @@ -483,8 +474,8 @@ async fn submit_blocks_to_celestia(
.submit_sequencer_blocks(
sequencer_block_data,
SubmitOptions {
fee: Some(fee),
gas_limit: Some(gas_limit),
fee: None,
gas_limit: None,
},
)
.await
Expand Down
1 change: 0 additions & 1 deletion crates/astria-sequencer-relayer/tests/blackbox/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ pub async fn spawn_sequencer_relayer(
sequencer_endpoint: sequencer.uri(),
celestia_endpoint: format!("http://{celestia_addr}"),
celestia_bearer_token: String::new(),
gas_limit: 100_000,
block_time: 1000,
relay_only_validator_key_blocks,
validator_key_file: Some(keyfile.path().to_string_lossy().to_string()),
Expand Down

0 comments on commit fe9b8d5

Please sign in to comment.