File tree Expand file tree Collapse file tree 3 files changed +9
-10
lines changed Expand file tree Collapse file tree 3 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,8 @@ pub const BIG_MATH_GAS_OP: GasOp = GasOp {
53
53
// Allow up to 100,000 data sources to be created
54
54
pub const CREATE_DATA_SOURCE : Gas = Gas ( CONST_MAX_GAS_PER_HANDLER / 100_000 ) ;
55
55
56
+ pub const ENS_NAME_BY_HASH : Gas = Gas ( DEFAULT_BASE_COST ) ;
57
+
56
58
pub const LOG_OP : GasOp = GasOp {
57
59
// Allow up to 100,000 logs
58
60
base_cost : CONST_MAX_GAS_PER_HANDLER / 100_000 ,
Original file line number Diff line number Diff line change @@ -737,7 +737,12 @@ impl<C: Blockchain> HostExports<C> {
737
737
Ok ( ( ) )
738
738
}
739
739
740
- pub ( crate ) fn ens_name_by_hash ( & self , hash : & str ) -> Result < Option < String > , anyhow:: Error > {
740
+ pub ( crate ) fn ens_name_by_hash (
741
+ & self ,
742
+ hash : & str ,
743
+ gas : & GasCounter ,
744
+ ) -> Result < Option < String > , anyhow:: Error > {
745
+ gas. consume_host_fn ( gas:: ENS_NAME_BY_HASH ) ?;
741
746
Ok ( self . ens_lookup . find_name ( hash) ?)
742
747
}
743
748
Original file line number Diff line number Diff line change @@ -1852,16 +1852,8 @@ impl<C: Blockchain> WasmInstanceContext<C> {
1852
1852
gas : & GasCounter ,
1853
1853
hash_ptr : AscPtr < AscString > ,
1854
1854
) -> Result < AscPtr < AscString > , HostExportError > {
1855
- // Not enabled on the network, no gas consumed.
1856
- // This is unrelated to IPFS, but piggyback on the config to disallow it on the network.
1857
- if !self . experimental_features . allow_non_deterministic_ipfs {
1858
- return Err ( HostExportError :: Deterministic ( anyhow ! (
1859
- "`ens_name_by_hash` is deprecated"
1860
- ) ) ) ;
1861
- }
1862
-
1863
1855
let hash: String = asc_get ( self , hash_ptr, gas) ?;
1864
- let name = self . ctx . host_exports . ens_name_by_hash ( & hash) ?;
1856
+ let name = self . ctx . host_exports . ens_name_by_hash ( & hash, gas ) ?;
1865
1857
if name. is_none ( ) && self . ctx . host_exports . is_ens_data_empty ( ) ? {
1866
1858
return Err ( anyhow ! (
1867
1859
"Missing ENS data: see https://github.com/graphprotocol/ens-rainbow"
You can’t perform that action at this time.
0 commit comments