igniter_lang 0.1.0.alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +65 -0
- data/RELEASE_NOTES.md +137 -0
- data/bin/igc +7 -0
- data/lib/igniter_lang/assembler.rb +717 -0
- data/lib/igniter_lang/classifier.rb +405 -0
- data/lib/igniter_lang/cli.rb +76 -0
- data/lib/igniter_lang/compilation_report.rb +99 -0
- data/lib/igniter_lang/compiler_orchestrator.rb +362 -0
- data/lib/igniter_lang/compiler_profile_contract_validator.rb +286 -0
- data/lib/igniter_lang/compiler_result.rb +77 -0
- data/lib/igniter_lang/diagnostics.rb +125 -0
- data/lib/igniter_lang/fragment_registry_compatibility_adapter.rb +129 -0
- data/lib/igniter_lang/internal_profile_assembly.rb +199 -0
- data/lib/igniter_lang/internal_profile_assembly_source_packet.rb +175 -0
- data/lib/igniter_lang/internal_profile_static_data_carrier.rb +286 -0
- data/lib/igniter_lang/oof_fragment_registry.rb +802 -0
- data/lib/igniter_lang/parser.rb +1736 -0
- data/lib/igniter_lang/runtime_smoke.rb +80 -0
- data/lib/igniter_lang/semanticir_emitter.rb +847 -0
- data/lib/igniter_lang/temporal_access_runtime.rb +437 -0
- data/lib/igniter_lang/temporal_executor.rb +457 -0
- data/lib/igniter_lang/typechecker.rb +821 -0
- data/lib/igniter_lang/version.rb +5 -0
- data/lib/igniter_lang.rb +27 -0
- metadata +72 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module IgniterLang
|
|
4
|
+
module RuntimeSmoke
|
|
5
|
+
begin
|
|
6
|
+
require_relative "../../experiments/runtime_machine_memory_proof/compiled_program"
|
|
7
|
+
PROOF_LOAD_ERROR = nil
|
|
8
|
+
rescue LoadError => e
|
|
9
|
+
PROOF_LOAD_ERROR = e
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
DEFAULT_AS_OF = defined?(RuntimeMachineMemoryProof::PROOF_AS_OF) ? RuntimeMachineMemoryProof::PROOF_AS_OF : nil
|
|
13
|
+
DEFAULT_MACHINE_ID = "runtime-machine/production-compiler-cli"
|
|
14
|
+
DEFAULT_SESSION_ID = "session/production-compiler-cli"
|
|
15
|
+
DEFAULT_RULE_VERSION = "production-compiler-cli-wrapper-v0"
|
|
16
|
+
|
|
17
|
+
module_function
|
|
18
|
+
|
|
19
|
+
def run(out_path:, sample_input:, as_of: DEFAULT_AS_OF, machine_id: DEFAULT_MACHINE_ID,
|
|
20
|
+
session_id: DEFAULT_SESSION_ID, rule_version: DEFAULT_RULE_VERSION)
|
|
21
|
+
ensure_available!
|
|
22
|
+
program = RuntimeMachineMemoryProof::CompiledProgram.load_igapp(out_path)
|
|
23
|
+
program.validate!
|
|
24
|
+
contract_id = program.contracts.keys.fetch(0)
|
|
25
|
+
backend = RuntimeMachineMemoryProof::MemoryTBackend.new
|
|
26
|
+
machine = RuntimeMachineMemoryProof::RuntimeMachine.new(
|
|
27
|
+
machine_id: machine_id,
|
|
28
|
+
session_id: session_id,
|
|
29
|
+
backend: backend
|
|
30
|
+
)
|
|
31
|
+
machine.boot
|
|
32
|
+
load = machine.load_program(program)
|
|
33
|
+
evaluation = machine.evaluate_program(contract_id, eval_input_for(contract_id, sample_input), as_of: as_of)
|
|
34
|
+
checkpoint = machine.checkpoint(horizon: { as_of: as_of, rule_version: rule_version })
|
|
35
|
+
resume = machine.resume(image: checkpoint.fetch(:semantic_image), requested_as_of: as_of)
|
|
36
|
+
|
|
37
|
+
{
|
|
38
|
+
"load_status" => load.fetch(:status),
|
|
39
|
+
"contract_id" => contract_id,
|
|
40
|
+
"evaluate_status" => evaluation.fetch(:status),
|
|
41
|
+
"outputs" => evaluation.fetch(:outputs),
|
|
42
|
+
"compatibility_report_status" => resume.fetch(:status),
|
|
43
|
+
"trusted" => load.fetch(:status) == "loaded" &&
|
|
44
|
+
evaluation.fetch(:status) == "ok" &&
|
|
45
|
+
resume.fetch(:status) == "trusted"
|
|
46
|
+
}
|
|
47
|
+
rescue => e
|
|
48
|
+
{
|
|
49
|
+
"load_status" => "blocked",
|
|
50
|
+
"error" => "#{e.class}: #{e.message}",
|
|
51
|
+
"trusted" => false
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def callback(**options)
|
|
56
|
+
lambda do |out_path:, sample_input:|
|
|
57
|
+
run(out_path: out_path, sample_input: sample_input, **options)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def eval_input_for(contract_id, sample_input)
|
|
62
|
+
return { "a" => 19, "b" => 23 } if contract_id == "Add"
|
|
63
|
+
|
|
64
|
+
sample_input
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def available?
|
|
68
|
+
defined?(RuntimeMachineMemoryProof::CompiledProgram) &&
|
|
69
|
+
defined?(RuntimeMachineMemoryProof::RuntimeMachine)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def ensure_available!
|
|
73
|
+
return if available?
|
|
74
|
+
|
|
75
|
+
message = "IgniterLang::RuntimeSmoke is proof-backed; runtime_machine_memory_proof is unavailable in this package context"
|
|
76
|
+
message = "#{message}: #{PROOF_LOAD_ERROR.message}" if PROOF_LOAD_ERROR
|
|
77
|
+
raise LoadError, message
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|