2021-10-24 19:10:23 -05:00
|
|
|
data Response:
|
|
|
|
peer_id: string
|
|
|
|
timestamp: u64
|
|
|
|
eip_validation: bool
|
|
|
|
ts_validation: bool
|
|
|
|
|
|
|
|
data EipResponse:
|
|
|
|
signature: string
|
|
|
|
validation: Response
|
|
|
|
|
|
|
|
data ValidationResult:
|
|
|
|
stderr: string
|
|
|
|
stdout: EipResponse
|
|
|
|
|
|
|
|
|
2021-10-24 12:32:30 -05:00
|
|
|
data DBRecord:
|
2021-11-06 18:51:59 -05:00
|
|
|
signature: string
|
2021-10-24 12:32:30 -05:00
|
|
|
event_address: string
|
|
|
|
eip712_doc: string
|
2021-10-11 01:36:53 -05:00
|
|
|
peer_id: string
|
|
|
|
timestamp: u64
|
|
|
|
eip_validation: bool
|
|
|
|
ts_validation: bool
|
2021-10-24 12:32:30 -05:00
|
|
|
signed_response: string
|
2021-10-11 01:36:53 -05:00
|
|
|
|
2021-10-24 12:32:30 -05:00
|
|
|
data DBResult:
|
|
|
|
stderr: string
|
|
|
|
stdout: []DBRecord
|
2021-10-11 01:36:53 -05:00
|
|
|
|
2021-10-24 12:32:30 -05:00
|
|
|
service EIPValidator("EIPValidator"):
|
2021-10-24 19:10:23 -05:00
|
|
|
eip712_validation_string(eip_str: string, peer_id: string) -> ValidationResult
|
|
|
|
eip712_validation_url(eip_str: string, peer_id: string) -> ValidationResult
|
2021-10-11 01:36:53 -05:00
|
|
|
|
|
|
|
service DataProvider("DataProvider"):
|
2021-10-24 12:32:30 -05:00
|
|
|
get_records() -> DBResult
|
2021-11-06 18:51:59 -05:00
|
|
|
get_record(signature: string) -> DBResult
|
2021-10-24 12:32:30 -05:00
|
|
|
get_record_count() -> u64
|
2021-10-24 18:25:58 -05:00
|
|
|
delete_records(password: string) -> DBResult
|
2021-10-11 01:36:53 -05:00
|
|
|
|
|
|
|
|
2021-10-24 19:10:23 -05:00
|
|
|
func validate(eip712_url: string, node: string, relay:string) -> ValidationResult:
|
2021-10-11 01:36:53 -05:00
|
|
|
on node via relay:
|
2021-10-24 12:32:30 -05:00
|
|
|
res <- EIPValidator.eip712_validation_url(eip712_url, node)
|
2021-10-11 01:36:53 -05:00
|
|
|
<- res
|
|
|
|
|
2021-10-24 12:32:30 -05:00
|
|
|
func get_records(node: string, relay:string) -> DBResult:
|
2021-10-11 01:36:53 -05:00
|
|
|
on node via relay:
|
|
|
|
res <- DataProvider.get_records()
|
|
|
|
<- res
|
|
|
|
|
2021-11-06 18:51:59 -05:00
|
|
|
func get_record(signature: string, node: string, relay:string) -> DBResult:
|
2021-10-11 01:36:53 -05:00
|
|
|
on node via relay:
|
2021-11-06 18:51:59 -05:00
|
|
|
res <- DataProvider.get_record(signature)
|
2021-10-24 12:32:30 -05:00
|
|
|
<- res
|
|
|
|
|
|
|
|
func get_record_count(node: string, relay:string) -> u64:
|
|
|
|
on node via relay:
|
|
|
|
res <- DataProvider.get_record_count()
|
|
|
|
<- res
|
|
|
|
|
2021-10-24 18:25:58 -05:00
|
|
|
func delete_records(password: string, node: string, relay:string) -> DBResult:
|
2021-10-24 12:32:30 -05:00
|
|
|
on node via relay:
|
2021-10-24 18:25:58 -05:00
|
|
|
result <- DataProvider.delete_records(password)
|
2021-10-24 12:32:30 -05:00
|
|
|
<- result
|
|
|
|
|
|
|
|
|
2021-11-07 15:19:09 -06:00
|
|
|
-- Example to collect many node validations and run them through a simple frequency count
|
|
|
|
-- algorithm
|
|
|
|
data EIPLocation:
|
|
|
|
node: string
|
|
|
|
relay: string
|
|
|
|
|
|
|
|
service ConsensusService("ConsensusService"):
|
|
|
|
consensus([]bool) -> bool
|
|
|
|
|
|
|
|
func eip_consensus((signature: string, node_locations:[]EIPLocation, service_node: string, consensus_service: string) -> bool:
|
|
|
|
result: *bool
|
|
|
|
|
|
|
|
for loc in node_locations par:
|
|
|
|
on node via relay:
|
|
|
|
res <- DataProvider.get_record(signature)
|
|
|
|
result <- res.ts_validation
|
|
|
|
|
|
|
|
on service_node:
|
|
|
|
ConsensusService consensus_service
|
|
|
|
consensus <- ConsensusService.consensus(result)
|
|
|
|
<- consensus
|
|
|
|
|
|
|
|
|
|
|
|
|