Add gas payment enforcement policy to require a minimum payment (#1031)

* Add gas payment enforcement policy

* Add infra, prettier

* Better logs, add IGPs into configs

* Fix e2e

* Fix clippy
pull/1058/head
Trevor Porter 2 years ago committed by GitHub
parent a164a783c7
commit f544a5df03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      rust/abacus-core/src/db/abacus_db.rs
  2. 37
      rust/agents/relayer/src/msg/gas_payment_enforcer.rs
  3. 28
      rust/agents/relayer/src/msg/gelato_submitter/fwd_req_op.rs
  4. 11
      rust/agents/relayer/src/msg/gelato_submitter/mod.rs
  5. 1
      rust/agents/relayer/src/msg/mod.rs
  6. 22
      rust/agents/relayer/src/msg/serial_submitter.rs
  7. 23
      rust/agents/relayer/src/relayer.rs
  8. 15
      rust/agents/relayer/src/settings/mod.rs
  9. 3
      rust/config/mainnet/arbitrum_config.json
  10. 3
      rust/config/mainnet/avalanche_config.json
  11. 3
      rust/config/mainnet/bsc_config.json
  12. 3
      rust/config/mainnet/celo_config.json
  13. 3
      rust/config/mainnet/ethereum_config.json
  14. 3
      rust/config/mainnet/optimism_config.json
  15. 3
      rust/config/mainnet/polygon_config.json
  16. 3
      rust/config/testnet2/alfajores_config.json
  17. 3
      rust/config/testnet2/arbitrumrinkeby_config.json
  18. 3
      rust/config/testnet2/bsctestnet_config.json
  19. 3
      rust/config/testnet2/fuji_config.json
  20. 3
      rust/config/testnet2/kovan_config.json
  21. 3
      rust/config/testnet2/mumbai_config.json
  22. 3
      rust/config/testnet2/optimismkovan_config.json
  23. 1
      rust/helm/abacus-agent/values.yaml
  24. 2
      rust/utils/run-locally/src/main.rs
  25. 13
      typescript/infra/config/environments/mainnet/agent.ts
  26. 9
      typescript/infra/config/environments/test/agent.ts
  27. 17
      typescript/infra/config/environments/testnet2/agent.ts
  28. 19
      typescript/infra/src/config/agent.ts

@ -289,7 +289,7 @@ impl AbacusDB {
}
/// Retrieve the total gas payment for a leaf index
fn retrieve_gas_payment_for_leaf(&self, leaf_index: u32) -> Result<U256, DbError> {
pub fn retrieve_gas_payment_for_leaf(&self, leaf_index: u32) -> Result<U256, DbError> {
Ok(self
.retrieve_keyed_decodable(GAS_PAYMENT_FOR_LEAF, &leaf_index)?
.unwrap_or(U256::zero()))

@ -0,0 +1,37 @@
use abacus_core::db::{AbacusDB, DbError};
use ethers::types::U256;
use crate::settings::GasPaymentEnforcementPolicy;
#[derive(Debug)]
pub struct GasPaymentEnforcer {
policy: GasPaymentEnforcementPolicy,
db: AbacusDB,
}
impl GasPaymentEnforcer {
pub fn new(policy: GasPaymentEnforcementPolicy, db: AbacusDB) -> Self {
Self { policy, db }
}
/// Returns (gas payment requirement met, current payment according to the DB)
pub fn message_meets_gas_payment_requirement(
&self,
msg_leaf_index: u32,
) -> Result<(bool, U256), DbError> {
let current_payment = self.get_message_gas_payment(msg_leaf_index)?;
let meets_requirement = match self.policy {
GasPaymentEnforcementPolicy::None => true,
GasPaymentEnforcementPolicy::Minimum {
payment: min_payment,
} => current_payment >= min_payment,
};
Ok((meets_requirement, current_payment))
}
fn get_message_gas_payment(&self, msg_leaf_index: u32) -> Result<U256, DbError> {
self.db.retrieve_gas_payment_for_leaf(msg_leaf_index)
}
}

@ -21,7 +21,7 @@ use tokio::{
};
use tracing::instrument;
use crate::msg::SubmitMessageArgs;
use crate::msg::{gas_payment_enforcer::GasPaymentEnforcer, SubmitMessageArgs};
/// The max fee to use for Gelato ForwardRequests.
/// Gelato isn't charging fees on testnet. For now, use this hardcoded value
@ -36,6 +36,13 @@ const DEFAULT_MAX_FEE: u64 = 10u64.pow(18);
/// limit so that Gelato does the estimation for us.
const DEFAULT_GAS_LIMIT: u64 = 5000000;
/// The period to sleep between ticks, in seconds.
const TICK_SLEEP_PERIOD_SECS: u64 = 5;
/// The period to sleep after observing the message's gas payment
/// as insufficient, in secs.
const INSUFFICIENT_GAS_PAYMENT_SLEEP_PERIOD_SECS: u64 = 15;
#[derive(Debug, Clone)]
pub struct ForwardRequestOpArgs<S> {
pub opts: ForwardRequestOptions,
@ -49,6 +56,8 @@ pub struct ForwardRequestOpArgs<S> {
pub sponsor_chain: Chain,
pub destination_chain: Chain,
pub gas_payment_enforcer: Arc<GasPaymentEnforcer>,
/// A channel to send the message over upon the message being successfully processed.
pub message_processed_sender: UnboundedSender<SubmitMessageArgs>,
}
@ -98,7 +107,7 @@ where
}
self.0.message.num_retries += 1;
sleep(Duration::from_secs(5)).await;
sleep(Duration::from_secs(TICK_SLEEP_PERIOD_SECS)).await;
}
}
@ -108,10 +117,25 @@ where
return Ok(MessageStatus::Processed);
}
// If the gas payment requirement hasn't been met, sleep briefly and wait for the next tick.
let (meets_gas_requirement, gas_payment) = self
.gas_payment_enforcer
.message_meets_gas_payment_requirement(self.0.message.leaf_index)?;
if !meets_gas_requirement {
tracing::info!(gas_payment=?gas_payment, "Gas payment requirement not met yet");
sleep(Duration::from_secs(
INSUFFICIENT_GAS_PAYMENT_SLEEP_PERIOD_SECS,
))
.await;
return Ok(MessageStatus::None);
}
// Send the forward request.
let fwd_req_result = self.send_forward_request_call().await?;
tracing::info!(
msg=?self.0.message,
gas_payment=?gas_payment,
task_id=fwd_req_result.task_id,
"Sent forward request",
);

@ -1,3 +1,5 @@
use std::sync::Arc;
use abacus_base::{CoreMetrics, InboxContracts};
use abacus_core::AbacusCommon;
use abacus_core::{db::AbacusDB, Signers};
@ -15,6 +17,7 @@ use crate::msg::gelato_submitter::fwd_req_op::{
ForwardRequestOp, ForwardRequestOpArgs, ForwardRequestOptions,
};
use super::gas_payment_enforcer::GasPaymentEnforcer;
use super::SubmitMessageArgs;
mod fwd_req_op;
@ -43,6 +46,8 @@ pub(crate) struct GelatoSubmitter {
message_processed_sender: UnboundedSender<SubmitMessageArgs>,
/// Channel to receive from ForwardRequestOps that a message has been successfully processed.
message_processed_receiver: UnboundedReceiver<SubmitMessageArgs>,
/// Used to determine if messages have made sufficient gas payments.
gas_payment_enforcer: Arc<GasPaymentEnforcer>,
}
impl GelatoSubmitter {
@ -52,8 +57,8 @@ impl GelatoSubmitter {
inbox_contracts: InboxContracts,
abacus_db: AbacusDB,
gelato_sponsor_signer: Signers,
http_client: reqwest::Client,
metrics: GelatoSubmitterMetrics,
gas_payment_enforcer: Arc<GasPaymentEnforcer>,
) -> Self {
let (message_processed_sender, message_processed_receiver) =
mpsc::unbounded_channel::<SubmitMessageArgs>();
@ -66,10 +71,11 @@ impl GelatoSubmitter {
db: abacus_db,
gelato_sponsor_address: gelato_sponsor_signer.address(),
gelato_sponsor_signer,
http_client,
http_client: reqwest::Client::new(),
metrics,
message_processed_sender,
message_processed_receiver,
gas_payment_enforcer,
}
}
@ -116,6 +122,7 @@ impl GelatoSubmitter {
sponsor_chain: self.outbox_gelato_chain,
destination_chain: self.inbox_gelato_chain,
message_processed_sender: self.message_processed_sender.clone(),
gas_payment_enforcer: self.gas_payment_enforcer.clone(),
});
self.metrics.active_forward_request_ops_gauge.add(1);

@ -4,6 +4,7 @@ use abacus_core::{accumulator::merkle::Proof, CommittedMessage, MultisigSignedCh
use tokio::time::Instant;
pub mod gas_payment_enforcer;
pub mod gelato_submitter;
pub mod processor;
pub mod serial_submitter;

@ -1,4 +1,5 @@
use std::collections::VecDeque;
use std::sync::Arc;
use abacus_base::CoreMetrics;
use abacus_base::InboxContracts;
@ -17,6 +18,7 @@ use tracing::debug;
use tracing::instrument;
use tracing::{info, info_span, instrument::Instrumented, Instrument};
use super::gas_payment_enforcer::GasPaymentEnforcer;
use super::SubmitMessageArgs;
/// SerialSubmitter accepts undelivered messages over a channel from a MessageProcessor. It is
@ -124,6 +126,8 @@ pub(crate) struct SerialSubmitter {
db: AbacusDB,
/// Metrics for serial submitter.
metrics: SerialSubmitterMetrics,
/// Used to determine if messages have made sufficient gas payments.
gas_payment_enforcer: Arc<GasPaymentEnforcer>,
}
impl SerialSubmitter {
@ -132,6 +136,7 @@ impl SerialSubmitter {
inbox_contracts: InboxContracts,
db: AbacusDB,
metrics: SerialSubmitterMetrics,
gas_payment_enforcer: Arc<GasPaymentEnforcer>,
) -> Self {
Self {
rx,
@ -140,6 +145,7 @@ impl SerialSubmitter {
inbox_contracts,
db,
metrics,
gas_payment_enforcer,
}
}
@ -215,15 +221,25 @@ impl SerialSubmitter {
.await?
{
info!(
"Unexpected status for message with leaf index '{}' (already processed): '{:?}'",
msg.leaf_index, msg
msg_leaf_index=msg.leaf_index,
msg=?msg,
"Message already processed",
);
self.record_message_process_success(&msg)?;
return Ok(());
}
// If the gas payment requirement hasn't been met, move to the next tick.
let (meets_gas_requirement, gas_payment) = self
.gas_payment_enforcer
.message_meets_gas_payment_requirement(msg.leaf_index)?;
if !meets_gas_requirement {
tracing::info!(msg_leaf_index=msg.leaf_index, gas_payment=?gas_payment, "Gas payment requirement not met yet");
return Ok(());
}
// Go ahead and attempt processing of message to destination chain.
debug!(msg=?msg, "Ready to process message");
debug!(gas_payment=?gas_payment, msg=?msg, "Ready to process message");
// TODO: consider differentiating types of processing errors, and pushing to the front of the
// run queue for intermittent types of errors that can occur even if a message's processing isn't
// reverting, e.g. timeouts or txs being dropped from the mempool. To avoid consistently retrying

@ -11,12 +11,13 @@ use abacus_base::{
};
use abacus_core::{AbacusCommon, AbacusContract, MultisigSignedCheckpoint, Signers};
use crate::msg::gas_payment_enforcer::GasPaymentEnforcer;
use crate::msg::gelato_submitter::{GelatoSubmitter, GelatoSubmitterMetrics};
use crate::msg::processor::{MessageProcessor, MessageProcessorMetrics};
use crate::msg::serial_submitter::SerialSubmitter;
use crate::msg::SubmitMessageArgs;
use crate::settings::matching_list::MatchingList;
use crate::settings::RelayerSettings;
use crate::settings::{GasPaymentEnforcementPolicy, RelayerSettings};
use crate::{checkpoint_fetcher::CheckpointFetcher, msg::serial_submitter::SerialSubmitterMetrics};
/// A relayer agent
@ -25,6 +26,7 @@ pub struct Relayer {
signed_checkpoint_polling_interval: u64,
multisig_checkpoint_syncer: MultisigCheckpointSyncer,
core: AbacusAgentCore,
gas_payment_enforcement_policy: GasPaymentEnforcementPolicy,
whitelist: Arc<MatchingList>,
blacklist: Arc<MatchingList>,
}
@ -69,6 +71,7 @@ impl BaseAgent for Relayer {
.unwrap_or(5),
multisig_checkpoint_syncer,
core,
gas_payment_enforcement_policy: settings.gaspaymentenforcementpolicy,
whitelist,
blacklist,
})
@ -83,6 +86,11 @@ impl BaseAgent for Relayer {
let mut tasks = Vec::with_capacity(inboxes.len() + 3);
let gas_payment_enforcer = Arc::new(GasPaymentEnforcer::new(
self.gas_payment_enforcement_policy.clone(),
self.outbox().db(),
));
for (inbox_name, inbox_contracts) in inboxes {
let signer = self
.core
@ -95,6 +103,7 @@ impl BaseAgent for Relayer {
signed_checkpoint_receiver.clone(),
self.core.settings.inboxes[inbox_name].gelato.as_ref(),
signer,
gas_payment_enforcer.clone(),
));
}
@ -152,6 +161,7 @@ impl Relayer {
message_receiver: mpsc::UnboundedReceiver<SubmitMessageArgs>,
inbox_contracts: InboxContracts,
signer: Signers,
gas_payment_enforcer: Arc<GasPaymentEnforcer>,
) -> GelatoSubmitter {
let inbox_chain_name = inbox_contracts.inbox.chain_name().to_owned();
GelatoSubmitter::new(
@ -160,12 +170,12 @@ impl Relayer {
inbox_contracts,
self.outbox().db(),
signer,
reqwest::Client::new(),
GelatoSubmitterMetrics::new(
&self.core.metrics,
self.outbox().outbox().chain_name(),
&inbox_chain_name,
),
gas_payment_enforcer,
)
}
@ -176,6 +186,7 @@ impl Relayer {
signed_checkpoint_receiver: watch::Receiver<Option<MultisigSignedCheckpoint>>,
gelato: Option<&GelatoConf>,
signer: Signers,
gas_payment_enforcer: Arc<GasPaymentEnforcer>,
) -> Instrumented<JoinHandle<Result<()>>> {
let outbox = self.outbox().outbox();
let outbox_name = outbox.chain_name();
@ -187,7 +198,12 @@ impl Relayer {
let (msg_send, msg_receive) = mpsc::unbounded_channel();
let submit_fut = match gelato {
Some(cfg) if cfg.enabled.parse::<bool>().unwrap() => self
.make_gelato_submitter_for_inbox(msg_receive, inbox_contracts.clone(), signer)
.make_gelato_submitter_for_inbox(
msg_receive,
inbox_contracts.clone(),
signer,
gas_payment_enforcer,
)
.spawn(),
_ => {
let serial_submitter = SerialSubmitter::new(
@ -199,6 +215,7 @@ impl Relayer {
outbox_name,
inbox_contracts.inbox.chain_name(),
),
gas_payment_enforcer,
);
serial_submitter.spawn()
}

@ -1,16 +1,27 @@
//! Configuration
use abacus_base::decl_settings;
use ethers::types::U256;
pub mod matching_list;
/// Config for a MultisigCheckpointSyncer
#[derive(Debug, Clone, serde::Deserialize)]
#[serde(tag = "type", rename_all = "camelCase")]
pub enum GasPaymentEnforcementPolicy {
/// No requirement - all messages are processed regardless of gas payment
None,
/// Messages that have paid a minimum amount will be processed
Minimum { payment: U256 },
}
decl_settings!(Relayer {
/// The polling interval to check for new signed checkpoints in seconds
signedcheckpointpollinginterval: String,
/// The maximum number of times a relayer will try to process a message
maxprocessingretries: String,
/// The multisig checkpoint syncer configuration
multisigcheckpointsyncer: abacus_base::MultisigCheckpointSyncerConf,
/// The gas payment enforcement policy configuration
gaspaymentenforcementpolicy: GasPaymentEnforcementPolicy,
/// This is optional. If no whitelist is provided ALL messages will be considered on the
/// whitelist.
whitelist: Option<String>,

@ -89,7 +89,8 @@
},
"outbox": {
"addresses": {
"outbox": "0x0761b0827849abbf7b0cC09CE14e1C93D87f5004"
"outbox": "0x0761b0827849abbf7b0cC09CE14e1C93D87f5004",
"interchainGasPaymaster": "0x376aD181E8cd45eAd5403F78d5A871D08c3c4D77"
},
"domain": "6386274",
"name": "arbitrum",

@ -89,7 +89,8 @@
},
"outbox": {
"addresses": {
"outbox": "0x0761b0827849abbf7b0cC09CE14e1C93D87f5004"
"outbox": "0x0761b0827849abbf7b0cC09CE14e1C93D87f5004",
"interchainGasPaymaster": "0xed9a722c543883FB7e07E78F3879762DE09eA7D5"
},
"domain": "1635148152",
"name": "avalanche",

@ -89,7 +89,8 @@
},
"outbox": {
"addresses": {
"outbox": "0xc3F23848Ed2e04C0c6d41bd7804fa8f89F940B94"
"outbox": "0xc3F23848Ed2e04C0c6d41bd7804fa8f89F940B94",
"interchainGasPaymaster": "0x47bf94790241B1764fC41A35a8329A15569E121C"
},
"domain": "6452067",
"name": "bsc",

@ -89,7 +89,8 @@
},
"outbox": {
"addresses": {
"outbox": "0xe042D1fbDf59828dd16b9649Ede7abFc856F7a6c"
"outbox": "0xe042D1fbDf59828dd16b9649Ede7abFc856F7a6c",
"interchainGasPaymaster": "0xCDeb368Db32ecCefaf7018e152DA9120565cb572"
},
"domain": "1667591279",
"name": "celo",

@ -89,7 +89,8 @@
},
"outbox": {
"addresses": {
"outbox": "0x2f9DB5616fa3fAd1aB06cB2C906830BA63d135e3"
"outbox": "0x2f9DB5616fa3fAd1aB06cB2C906830BA63d135e3",
"interchainGasPaymaster": "0x17E216fBb22dF4ef8A6640ae9Cb147C92710ac84"
},
"domain": "6648936",
"name": "ethereum",

@ -89,7 +89,8 @@
},
"outbox": {
"addresses": {
"outbox": "0x0be2Ae2f6D02a3e0e00ECB57D3E1fCbb7f8F38F4"
"outbox": "0x0be2Ae2f6D02a3e0e00ECB57D3E1fCbb7f8F38F4",
"interchainGasPaymaster": "0xc5D6aCaafBCcEC6D7fD7d92F4509befce641c563"
},
"domain": "28528",
"name": "optimism",

@ -89,7 +89,8 @@
},
"outbox": {
"addresses": {
"outbox": "0x8249cD1275855F2BB20eE71f0B9fA3c9155E5FaB"
"outbox": "0x8249cD1275855F2BB20eE71f0B9fA3c9155E5FaB",
"interchainGasPaymaster": "0x60B8d195f1b2EcaC26d54b95C69E6399cFD64b53"
},
"domain": "1886350457",
"name": "polygon",

@ -89,7 +89,8 @@
},
"outbox": {
"addresses": {
"outbox": "0x5C7D9B5f38022dB78416D6C0132bf8c404deDe27"
"outbox": "0x5C7D9B5f38022dB78416D6C0132bf8c404deDe27",
"interchainGasPaymaster": "0x1Fb165396FB26AC4178ca4240b3724039F75EED7"
},
"domain": "1000",
"name": "alfajores",

@ -89,7 +89,8 @@
},
"outbox": {
"addresses": {
"outbox": "0xB6a4129c305056d80fFfea96DdbDCf1F58BC8240"
"outbox": "0xB6a4129c305056d80fFfea96DdbDCf1F58BC8240",
"interchainGasPaymaster": "0x76D20943b68985dF999C5bb13d6E7AdF3CFc276F"
},
"domain": "1634872690",
"name": "arbitrumrinkeby",

@ -89,7 +89,8 @@
},
"outbox": {
"addresses": {
"outbox": "0xE023239c8dfc172FF008D8087E7442d3eBEd9350"
"outbox": "0xE023239c8dfc172FF008D8087E7442d3eBEd9350",
"interchainGasPaymaster": "0x155b1F1801030Ea4dF038107d3cc1b4bA496916e"
},
"domain": "1651715444",
"name": "bsctestnet",

@ -89,7 +89,8 @@
},
"outbox": {
"addresses": {
"outbox": "0xc507A7c848b59469cC44A3653F8a582aa8BeC71E"
"outbox": "0xc507A7c848b59469cC44A3653F8a582aa8BeC71E",
"interchainGasPaymaster": "0x4834a491f78BBF48e983F9Ce0E20D1E4DbE013D8"
},
"domain": "43113",
"name": "fuji",

@ -89,7 +89,8 @@
},
"outbox": {
"addresses": {
"outbox": "0xE199902fb97726e3D924bF6606382af11a954c85"
"outbox": "0xE199902fb97726e3D924bF6606382af11a954c85",
"interchainGasPaymaster": "0x74234D5EEb6229fD75fF5370fab7D9819295F0D5"
},
"domain": "3000",
"name": "kovan",

@ -89,7 +89,8 @@
},
"outbox": {
"addresses": {
"outbox": "0xe17c37212d785760E8331D4A4395B17b34Ba8cDF"
"outbox": "0xe17c37212d785760E8331D4A4395B17b34Ba8cDF",
"interchainGasPaymaster": "0x9A27744C249A11f68B3B56f09D280599585DFBb8"
},
"domain": "80001",
"name": "mumbai",

@ -89,7 +89,8 @@
},
"outbox": {
"addresses": {
"outbox": "0x981f5C4070bC048186CDE1CcB61Ea5c969194b54"
"outbox": "0x981f5C4070bC048186CDE1CcB61Ea5c969194b54",
"interchainGasPaymaster": "0xD7D2B0f61B834D98772e938Fa64425587C0f3481"
},
"domain": "1869622635",
"name": "optimismkovan",

@ -114,7 +114,6 @@ abacus:
# aws:
config:
signedCheckpointPollingInterval:
maxProcessingRetries:
multisigCheckpointSyncer:
threshold:
checkpointSyncers:

@ -158,9 +158,9 @@ fn main() -> ExitCode {
"ABC_BASE_SIGNERS_TEST2_TYPE" => "hexKey",
"ABC_BASE_SIGNERS_TEST3_KEY" => "701b615bbdfb9de65240bc28bd21bbc0d996645a3dd57e7b12bc2bdf6f192c82",
"ABC_BASE_SIGNERS_TEST3_TYPE" => "hexKey",
"ABC_RELAYER_GASPAYMENTENFORCEMENTPOLICY_TYPE" => "none",
"ABC_RELAYER_WHITELIST" => r#"[{"sourceAddress": "*", "destinationDomain": ["13372", "13373"], "destinationAddress": "*"}]"#,
"ABC_RELAYER_SIGNEDCHECKPOINTPOLLINGINTERVAL" => "5",
"ABC_RELAYER_MAXPROCESSINGRETRIES" => "5",
"ABC_RELAYER_MULTISIGCHECKPOINTSYNCER_THRESHOLD" => "1",
"ABC_RELAYER_MULTISIGCHECKPOINTSYNCER_CHECKPOINTSYNCERS_0x70997970c51812dc3a010c7d01b50e0d17dc79c8_TYPE" => "localStorage",
"ABC_RELAYER_MULTISIGCHECKPOINTSYNCER_CHECKPOINTSYNCERS_0x70997970c51812dc3a010c7d01b50e0d17dc79c8_PATH" => checkpoints_dir.path().to_str().unwrap(),

@ -1,6 +1,9 @@
import { ALL_KEY_ROLES, KEY_ROLE_ENUM } from '../../../src/agents/roles';
import { AgentConfig } from '../../../src/config';
import { ConnectionType } from '../../../src/config/agent';
import {
ConnectionType,
GasPaymentEnforcementPolicyType,
} from '../../../src/config/agent';
import { Contexts } from '../../contexts';
import { helloworldMatchingList } from '../../utils';
@ -61,8 +64,10 @@ export const abacus: AgentConfig<MainnetChains> = {
relayer: {
default: {
signedCheckpointPollingInterval: 5,
maxProcessingRetries: 10,
blacklist: releaseCandidateHelloworldMatchingList,
gasPaymentEnforcementPolicy: {
type: GasPaymentEnforcementPolicyType.None,
},
},
},
rolesWithKeys: ALL_KEY_ROLES,
@ -87,8 +92,10 @@ export const releaseCandidate: AgentConfig<MainnetChains> = {
relayer: {
default: {
signedCheckpointPollingInterval: 5,
maxProcessingRetries: 10,
whitelist: releaseCandidateHelloworldMatchingList,
gasPaymentEnforcementPolicy: {
type: GasPaymentEnforcementPolicyType.None,
},
},
},
rolesWithKeys: [KEY_ROLE_ENUM.Relayer, KEY_ROLE_ENUM.Kathy],

@ -1,6 +1,9 @@
import { ALL_KEY_ROLES } from '../../../src/agents/roles';
import { AgentConfig } from '../../../src/config';
import { ConnectionType } from '../../../src/config/agent';
import {
ConnectionType,
GasPaymentEnforcementPolicyType,
} from '../../../src/config/agent';
import { Contexts } from '../../contexts';
import { TestChains, chainNames } from './chains';
@ -28,7 +31,9 @@ export const abacus: AgentConfig<TestChains> = {
relayer: {
default: {
signedCheckpointPollingInterval: 5,
maxProcessingRetries: 10,
gasPaymentEnforcementPolicy: {
type: GasPaymentEnforcementPolicyType.None,
},
},
},
rolesWithKeys: ALL_KEY_ROLES,

@ -1,6 +1,9 @@
import { ALL_KEY_ROLES, KEY_ROLE_ENUM } from '../../../src/agents/roles';
import { AgentConfig } from '../../../src/config';
import { ConnectionType } from '../../../src/config/agent';
import {
ConnectionType,
GasPaymentEnforcementPolicyType,
} from '../../../src/config/agent';
import { Contexts } from '../../contexts';
import {
MATCHING_LIST_ALL_WILDCARDS,
@ -64,8 +67,10 @@ export const abacus: AgentConfig<TestnetChains> = {
relayer: {
default: {
signedCheckpointPollingInterval: 5,
maxProcessingRetries: 10,
blacklist: releaseCandidateHelloworldMatchingList,
gasPaymentEnforcementPolicy: {
type: GasPaymentEnforcementPolicyType.None,
},
},
},
rolesWithKeys: ALL_KEY_ROLES,
@ -90,9 +95,11 @@ export const flowcarbon: AgentConfig<TestnetChains> = {
relayer: {
default: {
signedCheckpointPollingInterval: 5,
maxProcessingRetries: 10,
// Blacklist everything for now
blacklist: MATCHING_LIST_ALL_WILDCARDS,
gasPaymentEnforcementPolicy: {
type: GasPaymentEnforcementPolicyType.None,
},
},
},
rolesWithKeys: [KEY_ROLE_ENUM.Relayer],
@ -121,9 +128,11 @@ export const releaseCandidate: AgentConfig<TestnetChains> = {
relayer: {
default: {
signedCheckpointPollingInterval: 5,
maxProcessingRetries: 10,
// Only process messages between the release candidate helloworld routers
whitelist: releaseCandidateHelloworldMatchingList,
gasPaymentEnforcementPolicy: {
type: GasPaymentEnforcementPolicyType.None,
},
},
},
rolesWithKeys: [KEY_ROLE_ENUM.Relayer, KEY_ROLE_ENUM.Kathy],

@ -96,12 +96,25 @@ interface MatchingListElement {
destinationAddress?: '*' | string | string[];
}
export enum GasPaymentEnforcementPolicyType {
None = 'none',
Minimum = 'minimum',
}
export type GasPaymentEnforcementPolicy =
| {
type: GasPaymentEnforcementPolicyType.None;
}
| {
type: GasPaymentEnforcementPolicyType.Minimum;
payment: string | number;
};
// Incomplete basic relayer agent config
interface BaseRelayerConfig {
// The polling interval to check for new signed checkpoints in seconds
signedCheckpointPollingInterval: number;
// The maxinmum number of times a processor will try to process a message
maxProcessingRetries: number;
gasPaymentEnforcementPolicy: GasPaymentEnforcementPolicy;
whitelist?: MatchingList;
blacklist?: MatchingList;
}
@ -425,11 +438,11 @@ export class ChainAgentConfig<Chain extends ChainName> {
const relayerConfig: RelayerConfig = {
signedCheckpointPollingInterval:
baseConfig.signedCheckpointPollingInterval,
maxProcessingRetries: baseConfig.maxProcessingRetries,
multisigCheckpointSyncer: {
threshold: this.validatorSet.threshold,
checkpointSyncers,
},
gasPaymentEnforcementPolicy: baseConfig.gasPaymentEnforcementPolicy,
};
if (baseConfig.whitelist) {
relayerConfig.whitelist = JSON.stringify(baseConfig.whitelist);

Loading…
Cancel
Save