set chain_id in test runtime

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
Cyrill Leutwiler
2024-09-28 19:17:41 +02:00
parent 287272b789
commit 066acc4663
3 changed files with 18 additions and 1 deletions
+16
View File
@@ -30,6 +30,14 @@ pragma solidity ^0.8;
},
"data": "fc9c8d39"
}
},
{
"Call": {
"dest": {
"Instantiated": 0
},
"data": "3af973b1"
}
}
]
}
@@ -43,4 +51,12 @@ contract Context {
function caller() public view returns (address ret) {
ret = msg.sender;
}
function chain_id() public view returns (uint) {
uint256 id;
assembly {
id := chainid()
}
return id;
}
}
@@ -43,7 +43,7 @@ pub fn chain_id<'ctx, D>(
where
D: Dependency + Clone,
{
Ok(context.word_const(0).as_basic_value_enum())
context.build_runtime_call_to_getter(runtime_api::imports::CHAIN_ID)
}
/// Translates the `block_number` instruction.
+1
View File
@@ -82,4 +82,5 @@ impl pallet_revive::Config for Runtime {
type InstantiateOrigin = EnsureSigned<AccountId32>;
type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent;
type Debug = ();
type ChainId = ConstU64<420_420_420>;
}