Skip to content

Commit

Permalink
Merge pull request #129 from covalenthq/use-2-different-proofchains
Browse files Browse the repository at this point in the history
change to call 2 different proofchains
  • Loading branch information
noslav authored May 19, 2023
2 parents 2dc2fa6 + f18a3f4 commit dd9baa8
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 76 deletions.
3 changes: 2 additions & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import Config
config :rudder,
ipfs_pinner_url: System.get_env("IPFS_PINNER_URL", "http://127.0.0.1:3001"),
operator_private_key: System.get_env("BLOCK_RESULT_OPERATOR_PRIVATE_KEY"),
proofchain_address: "0x4f2E285227D43D9eB52799D0A28299540452446E",
bsp_proofchain_address: "0x4f2E285227D43D9eB52799D0A28299540452446E",
brp_proofchain_address: "0x4f2E285227D43D9eB52799D0A28299540452446E",
proofchain_chain_id: 1284,
block_specimen_chain_id: 1,
proofchain_node: System.get_env("NODE_ETHEREUM_MAINNET"),
Expand Down
3 changes: 2 additions & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ config :phoenix, :plug_init_mode, :runtime
# Default these should point to moonbase alpha since we do all the development testing there
config :rudder,
operator_private_key: System.get_env("BLOCK_RESULT_OPERATOR_PRIVATE_KEY"),
proofchain_address: "0x19492a5019B30471aA8fa2c6D9d39c99b5Cda20C",
bsp_proofchain_address: "0x1BFa3b5E9bE2c5298B7DE11B5Acb08c37683f4eF",
brp_proofchain_address: "0xeFD84B6F1C04Ad9A7D666E21C9608a2ea2FE4B83",
proofchain_chain_id: 1287,
proofchain_node: System.get_env("NODE_ETHEREUM_MAINNET"),
ipfs_pinner_url: System.get_env("IPFS_PINNER_URL"),
Expand Down
3 changes: 2 additions & 1 deletion config/docker.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import Config

config :rudder,
operator_private_key: "8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba",
proofchain_address: "0xCF3d5540525D191D6492F1E0928d4e816c29778c",
bsp_proofchain_address: "0xce44d283b806C62698285D83c2Ca3F1e42Eb7112",
brp_proofchain_address: "0x3402ce1e416e082ed3Ba3d9dcba10353F3b64499",
proofchain_chain_id: 31337,
proofchain_node: "http://hardhat-node:8545/",
ipfs_pinner_url: "http://ipfs-pinner:3001",
Expand Down
3 changes: 2 additions & 1 deletion config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ config :phoenix, :plug_init_mode, :runtime
# Default these should point to moonbase alpha since we do all the development testing there
config :rudder,
operator_private_key: System.get_env("BLOCK_RESULT_OPERATOR_PRIVATE_KEY"),
proofchain_address: "0x4f2E285227D43D9eB52799D0A28299540452446E",
bsp_proofchain_address: "0x4f2E285227D43D9eB52799D0A28299540452446E",
brp_proofchain_address: "0x4f2E285227D43D9eB52799D0A28299540452446E",
proofchain_chain_id: 1284,
proofchain_node: System.get_env("NODE_ETHEREUM_MAINNET"),
ipfs_pinner_url: System.get_env("IPFS_PINNER_URL"),
Expand Down
3 changes: 2 additions & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import Config

config :rudder,
operator_private_key: "8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba",
proofchain_address: "0xCF3d5540525D191D6492F1E0928d4e816c29778c",
bsp_proofchain_address: "0xce44d283b806C62698285D83c2Ca3F1e42Eb7112",
brp_proofchain_address: "0x3402ce1e416e082ed3Ba3d9dcba10353F3b64499",
proofchain_chain_id: 31337,
proofchain_node: "http://127.0.0.1:8545/",
ipfs_pinner_url: "http://127.0.0.1:3001",
Expand Down
67 changes: 0 additions & 67 deletions lib/rudder/proof_chain/block_result_event_listener.ex

This file was deleted.

2 changes: 1 addition & 1 deletion lib/rudder/proof_chain/block_specimen_event_listener.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defmodule Rudder.ProofChain.BlockSpecimenEventListener do
reregister_process()
Logger.info("starting event listener")
Application.ensure_all_started(:rudder)
proofchain_address = Application.get_env(:rudder, :proofchain_address)
proofchain_address = Application.get_env(:rudder, :bsp_proofchain_address)
push_bsps_to_process(Rudder.Journal.items_with_status(:discover))
block_height = load_last_checked_block()
listen_for_event(proofchain_address, block_height)
Expand Down
6 changes: 3 additions & 3 deletions lib/rudder/proof_chain/proof_chain_interactor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule Rudder.ProofChain.Interactor do

@submit_brp_selector "submitBlockResultProof(uint64, uint64, bytes32, bytes32, string)"
@is_session_open_selector ABI.FunctionSelector.decode(
"isSessionOpen(uint64,uint64,bool,address) -> bool"
"isSessionOpen(uint64,uint64,address) -> bool"
)
@get_urls_selector ABI.FunctionSelector.decode("getURLS(bytes32) -> string[] memory")

Expand All @@ -21,7 +21,7 @@ defmodule Rudder.ProofChain.Interactor do
end

defp get_proofchain() do
proofchain_address = Application.get_env(:rudder, :proofchain_address)
proofchain_address = Application.get_env(:rudder, :brp_proofchain_address)
Rudder.RPC.PublicKeyHash.parse(proofchain_address)
end

Expand Down Expand Up @@ -52,7 +52,7 @@ defmodule Rudder.ProofChain.Interactor do
{block_height, _} = Integer.parse(block_height)
operator = get_operator_wallet()
chain_id = Application.get_env(:rudder, :block_specimen_chain_id)
rpc_params = [chain_id, block_height, false, operator.address.bytes]
rpc_params = [chain_id, block_height, operator.address.bytes]
data = {@is_session_open_selector, rpc_params}
make_call(data)
end
Expand Down

0 comments on commit dd9baa8

Please sign in to comment.