Skip to content

Commit 9052e06

Browse files
committed
Removing the limitation of TransactionV1 with targeting VM2 which prevented using ByPackageHash and ByPackagename transaction invocation targets.
Changed TransactionLaneDefinition structure to not expose it's fields as public since manipulating them directly didn't cause the caches to invalidate. This made some tests unstable.
1 parent c8b7307 commit 9052e06

File tree

47 files changed

+2004
-541
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2004
-541
lines changed

Cargo.lock

Lines changed: 23 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

binary_port/src/error_code.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ pub enum ErrorCode {
369369
#[error("Transaction attempts to set a delegation amount above the highest allowed value")]
370370
InvalidDelegationAmount = 116,
371371
#[error("the transaction invocation target is unsupported under V2 runtime")]
372+
// This code is not used, but we had a production release with it so we can't reuse it
372373
UnsupportedInvocationTarget = 117,
373374
}
374375

@@ -568,9 +569,6 @@ impl From<InvalidTransactionV1> for ErrorCode {
568569
InvalidTransactionV1::InvalidDelegationAmount { .. } => {
569570
ErrorCode::InvalidDelegationAmount
570571
}
571-
InvalidTransactionV1::UnsupportedInvocationTarget { .. } => {
572-
ErrorCode::UnsupportedInvocationTarget
573-
}
574572
InvalidTransactionV1::MissingSeed => ErrorCode::InvalidTransactionMissingSeed,
575573
_other => ErrorCode::InvalidTransactionUnspecified,
576574
}

executor/wasm/src/lib.rs

Lines changed: 260 additions & 57 deletions
Large diffs are not rendered by default.

executor/wasm/tests/altbn128.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ use casper_executor_wasm::testing::{
77
};
88

99
use casper_executor_wasm::{chainspec_config, chainspec_config::ChainspecConfig};
10-
use casper_executor_wasm_interface::executor::{ExecuteWithProviderError, ExecutionKind};
10+
use casper_executor_wasm_interface::executor::{
11+
ExecuteWithProviderError, ExecutionKind, PackagePointer,
12+
};
1113
use casper_storage::global_state::state::CommitProvider;
1214
use once_cell::sync::Lazy;
1315

@@ -174,8 +176,10 @@ fn run_pairing_endpoint_test<T: BorshSerialize>(
174176
.with_shared_address_generator(Arc::clone(&address_generator))
175177
.with_transferred_value(0)
176178
.with_execution_kind(ExecutionKind::Stored {
177-
address: contract_address,
179+
package_pointer: PackagePointer::HashAddr(contract_address),
178180
entry_point: "pairing".to_owned(),
181+
version: None,
182+
protocol_version_major: None,
179183
})
180184
.with_serialized_input(input)
181185
.expect("expected serialized input to be correct")

executor/wasm/tests/collections.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use casper_executor_wasm::{
1010
};
1111

1212
use casper_executor_wasm::{chainspec_config, chainspec_config::ChainspecConfig};
13-
use casper_executor_wasm_interface::executor::ExecutionKind;
13+
use casper_executor_wasm_interface::executor::{ExecutionKind, PackagePointer};
1414
use casper_storage::global_state::state::CommitProvider;
1515
use once_cell::sync::Lazy;
1616

@@ -77,8 +77,10 @@ fn should_run_test_suite() {
7777
.with_shared_address_generator(Arc::clone(&address_generator))
7878
.with_transferred_value(0)
7979
.with_execution_kind(ExecutionKind::Stored {
80-
address: contract_address,
80+
package_pointer: PackagePointer::HashAddr(contract_address),
8181
entry_point: "assertions".to_owned(),
82+
version: None,
83+
protocol_version_major: None,
8284
})
8385
.build()
8486
.expect("should build");
@@ -145,8 +147,10 @@ fn inserting_into_non_existing_vec_index_fails() {
145147
.with_shared_address_generator(Arc::clone(&address_generator))
146148
.with_transferred_value(0)
147149
.with_execution_kind(ExecutionKind::Stored {
148-
address: contract_address,
150+
package_pointer: PackagePointer::HashAddr(contract_address),
149151
entry_point: "test_remove_invalid_index_prepare".to_owned(),
152+
version: None,
153+
protocol_version_major: None,
150154
})
151155
.build()
152156
.expect("should build");

executor/wasm/tests/hello_world.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use casper_executor_wasm::{
1010
ExecutorV2,
1111
};
1212
use casper_executor_wasm_interface::{
13-
executor::ExecutionKind,
14-
install::{InstallContractResult, InstallContractWithProviderResult},
13+
executor::{ExecutionKind, PackagePointer},
14+
install::InstallContractWithProviderResult,
1515
};
1616
use casper_storage::{
1717
data_access_layer::{QueryRequest, QueryResult},
@@ -95,8 +95,10 @@ fn should_store_state_after_changes() {
9595
.with_shared_address_generator(Arc::clone(&address_generator))
9696
.with_transferred_value(0)
9797
.with_execution_kind(ExecutionKind::Stored {
98-
address: contract_address,
98+
package_pointer: PackagePointer::HashAddr(contract_address),
9999
entry_point: "spanish".to_owned(),
100+
version: None,
101+
protocol_version_major: None,
100102
})
101103
.build()
102104
.expect("should build");
@@ -115,8 +117,10 @@ fn should_store_state_after_changes() {
115117
.with_shared_address_generator(Arc::clone(&address_generator))
116118
.with_transferred_value(0)
117119
.with_execution_kind(ExecutionKind::Stored {
118-
address: contract_address,
120+
package_pointer: PackagePointer::HashAddr(contract_address),
119121
entry_point: "french".to_owned(),
122+
version: None,
123+
protocol_version_major: None,
120124
})
121125
.build()
122126
.expect("should build");
@@ -176,8 +180,10 @@ fn should_fetch_data_with_contract_method() {
176180
.with_shared_address_generator(Arc::clone(&address_generator))
177181
.with_transferred_value(0)
178182
.with_execution_kind(ExecutionKind::Stored {
179-
address: contract_address,
183+
package_pointer: PackagePointer::HashAddr(contract_address),
180184
entry_point: "spanish".to_owned(),
185+
version: None,
186+
protocol_version_major: None,
181187
})
182188
.build()
183189
.expect("should build");
@@ -196,8 +202,10 @@ fn should_fetch_data_with_contract_method() {
196202
.with_shared_address_generator(Arc::clone(&address_generator))
197203
.with_transferred_value(0)
198204
.with_execution_kind(ExecutionKind::Stored {
199-
address: contract_address,
205+
package_pointer: PackagePointer::HashAddr(contract_address),
200206
entry_point: "get".to_owned(),
207+
version: None,
208+
protocol_version_major: None,
201209
})
202210
.build()
203211
.expect("should build");

0 commit comments

Comments
 (0)