mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-30 21:37:29 +00:00
set chain_id in test runtime
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user