Skip to content

Commit

Permalink
pallet_revive: Account20 (#41)
Browse files Browse the repository at this point in the history
Signed-off-by: xermicus <[email protected]>
  • Loading branch information
xermicus authored Sep 4, 2024
1 parent 7c934e5 commit 393d901
Show file tree
Hide file tree
Showing 8 changed files with 530 additions and 501 deletions.
721 changes: 373 additions & 348 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ log = { version = "0.4" }
# polkadot-sdk and friends
codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" }
scale-info = { version = "2.11.1", default-features = false }
polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk", rev = "1c4141abeb4c581e503f07af2a3522e6918db591" }
polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk", rev = "d7b575338b2c647e04fc48bfbe00ea8f492fb580" }

# llvm
[workspace.dependencies.inkwell]
Expand Down
7 changes: 3 additions & 4 deletions crates/benchmarks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ pub fn create_specs(contract: &revive_integration::cases::Contract) -> revive_ru
actions: vec![
Instantiate {
code: Code::Bytes(contract.pvm_runtime.to_vec()),
origin: TestAccountId::Alice,
origin: TestAddress::Alice,
data: Default::default(),
value: Default::default(),
gas_limit: Default::default(),
storage_deposit_limit: Default::default(),
salt: Default::default(),
},
Call {
origin: TestAccountId::Alice,
dest: TestAccountId::Instantiated(0),
origin: TestAddress::Alice,
dest: TestAddress::Instantiated(0),
data: contract.calldata.to_vec(),
value: Default::default(),
gas_limit: Default::default(),
Expand Down Expand Up @@ -59,7 +59,6 @@ pub fn measure_evm(code: &[u8], input: &[u8], iters: u64) -> std::time::Duration
let log = revive_differential::Evm::default()
.code_blob(code.as_bytes().to_vec())
.input(input.to_vec().into())
.genesis_path("/tmp/genesis.json".into())
.bench(true)
.run();
assert!(log.output.run_success(), "evm run failed: {log:?}");
Expand Down
28 changes: 14 additions & 14 deletions crates/integration/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ macro_rules! test_spec {
fn $test_name() {
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").expect("should always exist");
let path = format!("{manifest_dir}/../integration/contracts/{}", $source_file);
specs_from_comment($contract_name, &path).remove(0).run();
Specs::from_comment($contract_name, &path).remove(0).run();
}
};
}
Expand All @@ -36,7 +36,7 @@ test_spec!(mstore8, "MStore8", "MStore8.sol");

fn instantiate(path: &str, contract: &str) -> Vec<SpecsAction> {
vec![Instantiate {
origin: TestAccountId::Alice,
origin: TestAddress::Alice,
value: 0,
gas_limit: Some(GAS_LIMIT),
storage_deposit_limit: None,
Expand All @@ -47,15 +47,15 @@ fn instantiate(path: &str, contract: &str) -> Vec<SpecsAction> {
pipeline: None,
},
data: vec![],
salt: vec![],
salt: OptionalHex::default(),
}]
}

fn run_differential(actions: Vec<SpecsAction>) {
Specs {
differential: true,
balances: vec![(ALICE, 1_000_000_000)],
actions,
..Default::default()
}
.run();
}
Expand All @@ -80,8 +80,8 @@ fn bitwise_byte() {
])
{
actions.push(Call {
origin: TestAccountId::Alice,
dest: TestAccountId::Instantiated(0),
origin: TestAddress::Alice,
dest: TestAddress::Instantiated(0),
value: 0,
gas_limit: None,
storage_deposit_limit: None,
Expand All @@ -107,8 +107,8 @@ fn unsigned_division() {
(one, U256::ZERO),
] {
actions.push(Call {
origin: TestAccountId::Alice,
dest: TestAccountId::Instantiated(0),
origin: TestAddress::Alice,
dest: TestAddress::Instantiated(0),
value: 0,
gas_limit: None,
storage_deposit_limit: None,
Expand Down Expand Up @@ -142,8 +142,8 @@ fn signed_division() {
(one, I256::ZERO),
] {
actions.push(Call {
origin: TestAccountId::Alice,
dest: TestAccountId::Instantiated(0),
origin: TestAddress::Alice,
dest: TestAddress::Instantiated(0),
value: 0,
gas_limit: None,
storage_deposit_limit: None,
Expand Down Expand Up @@ -171,8 +171,8 @@ fn unsigned_remainder() {
(U256::MAX, U256::ZERO),
] {
actions.push(Call {
origin: TestAccountId::Alice,
dest: TestAccountId::Instantiated(0),
origin: TestAddress::Alice,
dest: TestAddress::Instantiated(0),
value: 0,
gas_limit: None,
storage_deposit_limit: None,
Expand Down Expand Up @@ -212,8 +212,8 @@ fn signed_remainder() {
(I256::ZERO, I256::ZERO),
] {
actions.push(Call {
origin: TestAccountId::Alice,
dest: TestAccountId::Instantiated(0),
origin: TestAddress::Alice,
dest: TestAddress::Instantiated(0),
value: 0,
gas_limit: None,
storage_deposit_limit: None,
Expand Down
6 changes: 3 additions & 3 deletions crates/llvm-context/src/polkavm/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ where
&[
self.xlen_type().const_int(transient as u64, false).into(),
storage_key_pointer_casted.into(),
self.integer_const(crate::polkavm::XLEN, 32).into(),
self.xlen_type().const_all_ones().into(),
storage_value_pointer.to_int(self).into(),
storage_value_length_pointer.to_int(self).into(),
],
Expand Down Expand Up @@ -813,7 +813,7 @@ where
&[
self.xlen_type().const_int(transient as u64, false).into(),
storage_key_pointer_casted.into(),
self.integer_const(crate::polkavm::XLEN, 32).into(),
self.xlen_type().const_all_ones().into(),
storage_value_pointer_casted.into(),
self.integer_const(crate::polkavm::XLEN, 32).into(),
],
Expand Down Expand Up @@ -1249,7 +1249,7 @@ where
self.llvm.custom_width_int_type(crate::polkavm::XLEN as u32)
}

/// Returns the register witdh sized type.
/// Returns the sentinel pointer value.
pub fn sentinel_pointer(&self) -> Pointer<'ctx> {
let sentinel_pointer = self
.xlen_type()
Expand Down
Loading

0 comments on commit 393d901

Please sign in to comment.