Skip to content

Commit

Permalink
feat: add more info to message limits report (#417)
Browse files Browse the repository at this point in the history
* refactor(message_limits): general improvements

As more stuff needs to be added, lots of linting errors start to pop up
related to amount of lines in the functions and amount of function
parameters too. This refactors the code to allow further extension.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

* feat(message_limits): add more info to report

As to give more insights into what is happening with transaction sizes
and computing units used.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

* feat(message_limits): add ABI encoding option

For comparison reasons, allow the user to change the encoding of the
data payload to ABI.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

* feat(message_limits): number of accounts permutation

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

* refactor: avoid redundancy unwrapping CUs from tx

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

* refactor: use csv_async

Instead of manually writing comma separated header and values, use the
`csv_async` crate as to make things cleaner and avoid boilerplate code.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

* feat: add message limit reports to gitignore

Since these files are generated, we don't want to have them versioned.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>

---------

Signed-off-by: Guilherme Felipe da Silva <[email protected]>
  • Loading branch information
frenzox authored Sep 2, 2024
1 parent 1371f0d commit aea9fe6
Show file tree
Hide file tree
Showing 5 changed files with 553 additions and 170 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ node_modules
xtask-end-poll/target
**/target
rustc-ice-*

**/borsh_encoding_message_limits_report.csv
**/abi_encoding_message_limits_report.csv
61 changes: 61 additions & 0 deletions solana/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions solana/xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ ethers.workspace = true
evm-contracts-test-suite.workspace = true
axelar-solana-memo-program.workspace = true
solana-cli-config = "2.0.1"
solana-rpc = "2.0.1"
solana-rpc-client-api = "2.0.1"
solana-test-validator = "2.0.5"
solana-transaction-status = "2.0.1"
Expand Down Expand Up @@ -63,6 +64,10 @@ router-api = { path = "../../axelar-amplifier/packages/router-api" }
axelar-rkyv-encoding.workspace = true
axelar-executable.workspace = true
itertools.workspace = true
rand.workspace = true
thiserror.workspace = true
derive_builder = "0.20"
csv-async = { version = "1.3.0", features = ["tokio"] }

[dev-dependencies]
solana-program.workspace = true
Expand Down
19 changes: 17 additions & 2 deletions solana/xtask/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::path::PathBuf;
use std::sync::Arc;
use std::time::Duration;

use axelar_message_primitives::EncodingScheme;
use clap::{Parser, Subcommand};
use cmd::solana::SolanaContract;
use ethers::core::k256::ecdsa::SigningKey;
Expand Down Expand Up @@ -219,6 +220,11 @@ pub(crate) enum Solana {
MessageLimitsReport {
/// Where to output the report
output_dir: PathBuf,

/// Enable ABI encoding scheme. When ommited, borsh
/// encoding is used.
#[arg(short, long)]
abi_encoding: bool,
},
Init {
#[command(subcommand)]
Expand Down Expand Up @@ -448,8 +454,17 @@ async fn handle_solana(command: Solana) -> eyre::Result<()> {
ws_url.as_ref(),
)?;
}
Solana::MessageLimitsReport { output_dir } => {
cmd::solana::generate_message_limits_report(&output_dir).await?;
Solana::MessageLimitsReport {
output_dir,
abi_encoding,
} => {
let encoding = if abi_encoding {
EncodingScheme::AbiEncoding
} else {
EncodingScheme::Borsh
};

cmd::solana::generate_message_limits_report(&output_dir, encoding).await?;
}
Solana::Init { contract } => match contract {
SolanaInitSubcommand::GmpGateway {
Expand Down
Loading

0 comments on commit aea9fe6

Please sign in to comment.