Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Custom proof size limit
  • Loading branch information
pmikolajczyk41 committed Jan 23, 2023
commit 0ac719f6000384f52a41defa845d2a6465f11b23
2 changes: 1 addition & 1 deletion aleph-client/Cargo.lock

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

14 changes: 13 additions & 1 deletion aleph-client/src/contract/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,15 @@ use crate::{

/// Default gas limit, which allows up to 25% of block execution time.
pub const DEFAULT_MAX_GAS: u64 = 250_000_000_000u64;
/// Default proof size limit, which allows up to 25% of block execution time.
pub const DEFAULT_MAX_PROOF_SIZE: u64 = 250_000_000_000u64;

/// Represents a contract instantiated on the chain.
pub struct ContractInstance {
address: AccountId,
transcoder: ContractMessageTranscoder,
max_gas_override: Option<u64>,
max_proof_size_override: Option<u64>,
}

impl ContractInstance {
Expand All @@ -76,6 +79,7 @@ impl ContractInstance {
address,
transcoder: ContractMessageTranscoder::load(metadata_path)?,
max_gas_override: None,
max_proof_size_override: None,
})
}

Expand All @@ -85,6 +89,12 @@ impl ContractInstance {
self.max_gas_override = limit_override;
}

/// From now on, the contract instance will use `limit_override` as the proof size limit for all
/// contract calls. If `limit_override` is `None`, then [DEFAULT_MAX_PROOF_SIZE] will be used.
pub fn override_proof_size_limit(&mut self, limit_override: Option<u64>) {
self.max_proof_size_override = limit_override;
}

/// The address of this contract instance.
pub fn address(&self) -> &AccountId {
&self.address
Expand Down Expand Up @@ -178,7 +188,9 @@ impl ContractInstance {
value,
Weight {
ref_time: self.max_gas_override.unwrap_or(DEFAULT_MAX_GAS),
proof_size: self.max_gas_override.unwrap_or(DEFAULT_MAX_GAS),
proof_size: self
.max_proof_size_override
.unwrap_or(DEFAULT_MAX_PROOF_SIZE),
},
None,
data,
Expand Down
2 changes: 1 addition & 1 deletion benches/payout-stakers/Cargo.lock

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

2 changes: 1 addition & 1 deletion bin/cliain/Cargo.lock

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

2 changes: 1 addition & 1 deletion e2e-tests/Cargo.lock

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

2 changes: 1 addition & 1 deletion flooder/Cargo.lock

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