reduce ++hard usage in jael for speed

This commit is contained in:
Philip Monk 2019-01-10 15:49:37 -08:00
parent 3d3f8149d3
commit ba9bf4f031
No known key found for this signature in database
GPG Key ID: B66E1F02604E44EC
4 changed files with 50 additions and 6 deletions

View File

@ -2,14 +2,15 @@
/- json-rpc
=, json-rpc
::
|_ res=response
!:
|_ res=raw-response
::
++ grab :: convert from
|%
++ noun response :: from noun
++ noun raw-response :: from noun
++ httr :: from httr
|= hit/httr:eyre
^- response
^- raw-response
~| hit
?: ?=($2 (div p.hit 100))
=, html
@ -18,6 +19,16 @@
++ json :: from json
=, dejs-soft:format
|= a=json
^- raw-response
=; resp
?- -.resp
%error resp
%fail resp
%batch resp
%result
~| resp
[%result id.resp (crip (en-json:html res.resp))]
==
^- response
=; dere
=+ res=((ar dere) a)

View File

@ -1,5 +1,14 @@
|%
++ raw-response
$~ [%fail *httr:eyre]
$% [%result id=@t res=@t]
[%error id=@t code=@t message=@t] ::TODO data?
[%fail hit=httr:eyre]
[%batch bas=(list response)]
==
::
++ response ::TODO id should be optional
$~ [%fail *httr:eyre]
$% [%result id=@t res=json]
[%error id=@t code=@t message=@t] ::TODO data?
[%fail hit=httr:eyre]

View File

@ -1906,7 +1906,16 @@
~& [%yikes cuz]
+>.$
?> ?=(%json-rpc-response mar)
=+ rep=~|(res ((hard response:rpc:jstd) q.res))
=+ raw-rep=~|(res ((hard raw-response:rpc:jstd) q.res))
=/ rep=response:rpc:jstd
?- -.raw-rep
%error raw-rep
%fail raw-rep
%batch raw-rep
%result
~| raw-rep
[%result id.raw-rep (need (de-json:html res.raw-rep))]
==
?: ?=(%fail -.rep)
?: =(405 p.hit.rep)
~& 'HTTP 405 error (expected if using infura)'

View File

@ -103,7 +103,20 @@
|%
++ rpc
|%
:: The json-rpc-response mark doesn't parse the json for `res`
:: so that we can efficiently ++hard the value in %jael. It's
:: much slower to ++hard json than to simply re-parse it.
::
++ raw-response
$~ [%fail *httr:eyre]
$% [%result id=@t res=@t]
[%error id=@t code=@t message=@t] ::TODO data?
[%fail hit=httr:eyre]
[%batch bas=(list response)]
==
::
++ response ::TODO id should be optional
$~ [%fail *httr:eyre]
$% [%result id=@t res=json]
[%error id=@t code=@t message=@t] ::TODO data?
[%fail hit=httr:eyre]
@ -7174,11 +7187,12 @@
|%
:: azimuth: data contract
::
++ azimuth 0x308a.b6a6.024c.f198.b57e.008d.0ac9.ad02.1988.6579
:: ++ azimuth 0x308a.b6a6.024c.f198.b57e.008d.0ac9.ad02.1988.6579 :: ropsten
++ azimuth 0x223c.067f.8cf2.8ae1.73ee.5caf.ea60.ca44.c335.fecb :: mainnet
::
:: launch: block number of azimuth deploy
::
++ launch 4.601.630
++ launch 6.784.800
--
::
:: hashes of ship event signatures
@ -8483,6 +8497,7 @@
:: boot keys must match the contract
::
?. =(pub:ex:cub pass.net)
~& [%key-mismatch pub:ex:cub pass.net]
[%| %key-mismatch]
:: life must match the contract
::