mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-12 09:21:01 +00:00
Implement the gasprice opcode (#127)
This commit is contained in:
Generated
+9
-9
@@ -9724,7 +9724,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "sp-crypto-ec-utils"
|
name = "sp-crypto-ec-utils"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
source = "git+https://github.com/paritytech/polkadot-sdk#447902eff4a574e66894ad60cb41999b05bf5e84"
|
source = "git+https://github.com/paritytech/polkadot-sdk#1e89a311471eba937a9552d7d1f55af1661feb08"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ark-bls12-377",
|
"ark-bls12-377",
|
||||||
"ark-bls12-377-ext",
|
"ark-bls12-377-ext",
|
||||||
@@ -9791,7 +9791,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "sp-debug-derive"
|
name = "sp-debug-derive"
|
||||||
version = "14.0.0"
|
version = "14.0.0"
|
||||||
source = "git+https://github.com/paritytech/polkadot-sdk#447902eff4a574e66894ad60cb41999b05bf5e84"
|
source = "git+https://github.com/paritytech/polkadot-sdk#1e89a311471eba937a9552d7d1f55af1661feb08"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -9811,7 +9811,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "sp-externalities"
|
name = "sp-externalities"
|
||||||
version = "0.25.0"
|
version = "0.25.0"
|
||||||
source = "git+https://github.com/paritytech/polkadot-sdk#447902eff4a574e66894ad60cb41999b05bf5e84"
|
source = "git+https://github.com/paritytech/polkadot-sdk#1e89a311471eba937a9552d7d1f55af1661feb08"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"environmental",
|
"environmental",
|
||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
@@ -10020,7 +10020,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "sp-runtime-interface"
|
name = "sp-runtime-interface"
|
||||||
version = "24.0.0"
|
version = "24.0.0"
|
||||||
source = "git+https://github.com/paritytech/polkadot-sdk#447902eff4a574e66894ad60cb41999b05bf5e84"
|
source = "git+https://github.com/paritytech/polkadot-sdk#1e89a311471eba937a9552d7d1f55af1661feb08"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"impl-trait-for-tuples",
|
"impl-trait-for-tuples",
|
||||||
@@ -10052,7 +10052,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "sp-runtime-interface-proc-macro"
|
name = "sp-runtime-interface-proc-macro"
|
||||||
version = "17.0.0"
|
version = "17.0.0"
|
||||||
source = "git+https://github.com/paritytech/polkadot-sdk#447902eff4a574e66894ad60cb41999b05bf5e84"
|
source = "git+https://github.com/paritytech/polkadot-sdk#1e89a311471eba937a9552d7d1f55af1661feb08"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"Inflector",
|
"Inflector",
|
||||||
"expander",
|
"expander",
|
||||||
@@ -10141,7 +10141,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?rev=447902eff4a574e6689
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "sp-std"
|
name = "sp-std"
|
||||||
version = "14.0.0"
|
version = "14.0.0"
|
||||||
source = "git+https://github.com/paritytech/polkadot-sdk#447902eff4a574e66894ad60cb41999b05bf5e84"
|
source = "git+https://github.com/paritytech/polkadot-sdk#1e89a311471eba937a9552d7d1f55af1661feb08"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sp-storage"
|
name = "sp-storage"
|
||||||
@@ -10158,7 +10158,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "sp-storage"
|
name = "sp-storage"
|
||||||
version = "19.0.0"
|
version = "19.0.0"
|
||||||
source = "git+https://github.com/paritytech/polkadot-sdk#447902eff4a574e66894ad60cb41999b05bf5e84"
|
source = "git+https://github.com/paritytech/polkadot-sdk#1e89a311471eba937a9552d7d1f55af1661feb08"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"impl-serde",
|
"impl-serde",
|
||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
@@ -10193,7 +10193,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "sp-tracing"
|
name = "sp-tracing"
|
||||||
version = "16.0.0"
|
version = "16.0.0"
|
||||||
source = "git+https://github.com/paritytech/polkadot-sdk#447902eff4a574e66894ad60cb41999b05bf5e84"
|
source = "git+https://github.com/paritytech/polkadot-sdk#1e89a311471eba937a9552d7d1f55af1661feb08"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
"tracing",
|
"tracing",
|
||||||
@@ -10290,7 +10290,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "sp-wasm-interface"
|
name = "sp-wasm-interface"
|
||||||
version = "20.0.0"
|
version = "20.0.0"
|
||||||
source = "git+https://github.com/paritytech/polkadot-sdk#447902eff4a574e66894ad60cb41999b05bf5e84"
|
source = "git+https://github.com/paritytech/polkadot-sdk#1e89a311471eba937a9552d7d1f55af1661feb08"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"impl-trait-for-tuples",
|
"impl-trait-for-tuples",
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
pragma solidity ^0.8;
|
||||||
|
|
||||||
|
/* runner.json
|
||||||
|
{
|
||||||
|
"differential": false,
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"Instantiate": {
|
||||||
|
"code": {
|
||||||
|
"Solidity": {
|
||||||
|
"contract": "GasPrice"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"VerifyCall": {
|
||||||
|
"success": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
contract GasPrice {
|
||||||
|
constructor() payable {
|
||||||
|
assert(tx.gasprice == 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,6 +46,7 @@ test_spec!(immutables, "Immutables", "Immutables.sol");
|
|||||||
test_spec!(transaction, "Transaction", "Transaction.sol");
|
test_spec!(transaction, "Transaction", "Transaction.sol");
|
||||||
test_spec!(block_hash, "BlockHash", "BlockHash.sol");
|
test_spec!(block_hash, "BlockHash", "BlockHash.sol");
|
||||||
test_spec!(delegate, "Delegate", "Delegate.sol");
|
test_spec!(delegate, "Delegate", "Delegate.sol");
|
||||||
|
test_spec!(gas_price, "GasPrice", "GasPrice.sol");
|
||||||
|
|
||||||
fn instantiate(path: &str, contract: &str) -> Vec<SpecsAction> {
|
fn instantiate(path: &str, contract: &str) -> Vec<SpecsAction> {
|
||||||
vec![Instantiate {
|
vec![Instantiate {
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ where
|
|||||||
|
|
||||||
/// Translates the `gas_price` instruction.
|
/// Translates the `gas_price` instruction.
|
||||||
pub fn gas_price<'ctx, D>(
|
pub fn gas_price<'ctx, D>(
|
||||||
_context: &mut Context<'ctx, D>,
|
context: &mut Context<'ctx, D>,
|
||||||
) -> anyhow::Result<inkwell::values::BasicValueEnum<'ctx>>
|
) -> anyhow::Result<inkwell::values::BasicValueEnum<'ctx>>
|
||||||
where
|
where
|
||||||
D: Dependency + Clone,
|
D: Dependency + Clone,
|
||||||
{
|
{
|
||||||
todo!()
|
Ok(context.word_const(1).as_basic_value_enum())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Translates the `tx.origin` instruction.
|
/// Translates the `tx.origin` instruction.
|
||||||
|
|||||||
@@ -113,3 +113,5 @@ POLKAVM_IMPORT(void, return_data_size, uint32_t)
|
|||||||
POLKAVM_IMPORT(void, set_immutable_data, uint32_t, uint32_t);
|
POLKAVM_IMPORT(void, set_immutable_data, uint32_t, uint32_t);
|
||||||
|
|
||||||
POLKAVM_IMPORT(void, value_transferred, uint32_t)
|
POLKAVM_IMPORT(void, value_transferred, uint32_t)
|
||||||
|
|
||||||
|
POLKAVM_IMPORT(void, weight_to_fee, uint64_t, uint64_t, uint32_t);
|
||||||
|
|||||||
@@ -64,9 +64,11 @@ pub static SET_IMMUTABLE_DATA: &str = "set_immutable_data";
|
|||||||
|
|
||||||
pub static VALUE_TRANSFERRED: &str = "value_transferred";
|
pub static VALUE_TRANSFERRED: &str = "value_transferred";
|
||||||
|
|
||||||
|
pub static WEIGHT_TO_FEE: &str = "weight_to_fee";
|
||||||
|
|
||||||
/// All imported runtime API symbols.
|
/// All imported runtime API symbols.
|
||||||
/// Useful for configuring common attributes and linkage.
|
/// Useful for configuring common attributes and linkage.
|
||||||
pub static IMPORTS: [&str; 27] = [
|
pub static IMPORTS: [&str; 28] = [
|
||||||
SBRK,
|
SBRK,
|
||||||
MEMORY_SIZE,
|
MEMORY_SIZE,
|
||||||
ADDRESS,
|
ADDRESS,
|
||||||
@@ -94,6 +96,7 @@ pub static IMPORTS: [&str; 27] = [
|
|||||||
SET_IMMUTABLE_DATA,
|
SET_IMMUTABLE_DATA,
|
||||||
SET_STORAGE,
|
SET_STORAGE,
|
||||||
VALUE_TRANSFERRED,
|
VALUE_TRANSFERRED,
|
||||||
|
WEIGHT_TO_FEE,
|
||||||
];
|
];
|
||||||
|
|
||||||
/// Creates a LLVM module from the [BITCODE].
|
/// Creates a LLVM module from the [BITCODE].
|
||||||
|
|||||||
Reference in New Issue
Block a user