Skip to content
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

fix(generator): exceeded MAX_WRITE_DATA_BYTES_LIMIT error #685

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/generator/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub const MAX_TX_SIZE: usize = 50_000;
/// MAX withdrawal size 50 KB
pub const MAX_WITHDRAWAL_SIZE: usize = 50_000;
// 25 KB
pub const MAX_WRITE_DATA_BYTES_LIMIT: usize = 25_000;
pub const MAX_WRITE_DATA_BYTES_LIMIT: usize = 25 * 1024;
// 2MB
pub const MAX_READ_DATA_BYTES_LIMIT: usize = 1024 * 1024 * 2;
/// max cycles of a layer2 transaction
Expand Down
9 changes: 6 additions & 3 deletions crates/generator/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,11 +658,14 @@ impl Generator {
}

// check write data bytes
let write_data_bytes: usize = run_result.write_data.values().map(|data| data.len()).sum();
if write_data_bytes > MAX_WRITE_DATA_BYTES_LIMIT {
if let Some(data) = run_result
.write_data
.values()
.find(|data| data.len() > MAX_WRITE_DATA_BYTES_LIMIT)
{
return Err(TransactionError::ExceededMaxWriteData {
max_bytes: MAX_WRITE_DATA_BYTES_LIMIT,
used_bytes: write_data_bytes,
used_bytes: data.len(),
});
}
// check read data bytes
Expand Down